2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
11 #include <intuition/intuition.h>
12 #include <intuition/intuitionbase.h>
13 #include <intuition/screens.h>
14 #include <graphics/clip.h>
15 #include <graphics/rastport.h>
16 #include <graphics/regions.h>
17 #include <proto/exec.h>
18 #include <proto/dos.h>
19 #include <proto/graphics.h>
25 #define ARG_TEMPLATE "FAST=F/S,NUMBERS=N/S,RECTFILL=RF/S"
29 #define ARG_RECTFILL 2
32 extern struct IntuitionBase
*IntuitionBase
;
34 static struct Screen
*scr
;
35 static struct Window
*win
;
36 static struct Layer
*lay
;
37 static struct RDArgs
*MyArgs
;
38 static IPTR Args
[NUM_ARGS
];
41 static void Cleanup(char *msg
)
47 printf("damagelist: %s\n",msg
);
53 if (MyArgs
) FreeArgs(MyArgs
);
58 static void GetArguments(void)
60 if (!(MyArgs
= ReadArgs(ARG_TEMPLATE
,Args
,0)))
62 Fault(IoErr(),0,s
,255);
67 static void Action(void)
71 struct RegionRectangle
*rr
;
72 WORD x
, y
, x1
, y1
, x2
, y2
, i
, count
= 0;
74 puts("Activate the window whose damagelist you want to see.\n");
75 puts("You have 3 seconds of time!\n\n");
79 win
= IntuitionBase
->ActiveWindow
;
80 if (!win
) Cleanup("No active window!");
87 if (!dr
) Cleanup("Layer does not have a damagelist!");
88 rr
= dr
->RegionRectangle
;
89 if (!rr
) Cleanup("Damagelist is empty!");
91 if (!(rp
= CloneRastPort(&win
->WScreen
->RastPort
)))
93 Cleanup("Can´t clone screen rastport!");
99 x1
= lay
->bounds
.MinX
+ dr
->bounds
.MinX
+ rr
->bounds
.MinX
;
100 y1
= lay
->bounds
.MinY
+ dr
->bounds
.MinY
+ rr
->bounds
.MinY
;
101 x2
= lay
->bounds
.MinX
+ dr
->bounds
.MinX
+ rr
->bounds
.MaxX
;
102 y2
= lay
->bounds
.MinY
+ dr
->bounds
.MinY
+ rr
->bounds
.MaxY
;
104 printf("#%04d (%4d,%4d) - (%4d, %4d) Size: %4d x %4d\n",
114 for(i
= 0; i
< (Args
[ARG_FAST
] ? 1 : 8);i
++)
116 SetAPen(rp
,1 + (i
& 1));
118 if (Args
[ARG_RECTFILL
])
120 RectFill(rp
,x1
,y1
,x2
,y2
);
122 RectFill(rp
,x1
,y1
,x2
,y1
);
123 RectFill(rp
,x2
,y1
,x2
,y2
);
124 RectFill(rp
,x1
,y2
,x2
,y2
);
125 RectFill(rp
,x1
,y1
,x1
,y2
);
128 if (!Args
[ARG_FAST
]) Delay(10);
131 if (Args
[ARG_NUMBERS
])
133 sprintf(s
,"%d",count
);
134 i
= TextLength(rp
,s
,strlen(s
));
136 x
= (x1
+ x2
- i
) / 2;
137 y
= (y1
+ y2
- rp
->TxHeight
) / 2;
142 } else if (x
>= scr
->Width
- i
)
144 x
= scr
->Width
- i
- 1;
150 } else if (y
>= scr
->Height
- rp
->TxHeight
)
152 y
= scr
->Height
- rp
->TxHeight
- 1;
158 Move(rp
,x
+ 1, y
+ 1 + rp
->TxBaseline
);
162 Move(rp
,x
, y
+ rp
->TxBaseline
);