add the common pc IRQTYPE definitions, and copy them for both the 32bit and 64bit...
[AROS.git] / rom / intuition / fillrectclass.c
blob5590ef01360eb05a1ffb4ef0b384f396d1961601
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
6 AROS fillrectclass implementation.
7 */
9 #include <exec/types.h>
11 #include <intuition/intuition.h>
12 #include <intuition/intuitionbase.h>
13 #include <intuition/classes.h>
14 #include <intuition/classusr.h>
15 #include <intuition/imageclass.h>
17 #include <graphics/gfxbase.h>
18 #include <graphics/gfxmacros.h>
20 #include <utility/tagitem.h>
21 #include <utility/hooks.h>
23 #include <clib/macros.h>
25 #include <proto/exec.h>
26 #include <proto/intuition.h>
27 #include <proto/graphics.h>
28 #include <proto/utility.h>
30 #include <string.h>
32 #ifndef __MORPHOS__
33 #include <aros/asmcall.h>
34 #include <proto/alib.h>
35 #include "intuition_intern.h"
36 #endif /* !__MORPHOS__ */
38 /****************************************************************************/
40 IPTR fillrect_set(Class *cl, Object *obj, struct opSet *msg)
42 struct IntuitionBase *IntuitionBase = (struct IntuitionBase *)cl->cl_UserData;
43 struct Library *UtilityBase = GetPrivIBase(IntuitionBase)->UtilityBase;
44 struct TagItem *tag, *tstate = msg->ops_AttrList;
45 struct FillRectData *data = INST_DATA(cl, obj);
47 IPTR retval = 0;
49 while((tag = NextTagItem(&tstate)))
51 switch(tag->ti_Tag)
53 case IA_APattern:
54 ((struct Image *)obj)->ImageData = (APTR)tag->ti_Data;
55 retval = 1;
56 break;
58 case IA_APatSize:
59 data->apatsize = (WORD)tag->ti_Data;
60 retval = 1;
61 break;
63 case IA_Mode:
64 data->mode = (WORD)tag->ti_Data;
65 retval = 1;
66 break;
70 return retval;
73 /****************************************************************************/
75 IPTR FillRectClass__IM_DRAW(Class *cl, Object *obj, struct impDraw *msg)
77 struct IntuitionBase *IntuitionBase = (struct IntuitionBase *)cl->cl_UserData;
78 struct GfxBase *GfxBase = GetPrivIBase(IntuitionBase)->GfxBase;
79 struct FillRectData *data = INST_DATA(cl, obj);
80 struct RastPort rp;
81 WORD x1, y1, x2, y2;
83 if (!((struct impDraw *)msg)->imp_RPort) return 0;
85 memcpy(&rp,((struct impDraw *)msg)->imp_RPort,sizeof (struct RastPort));
87 SetABPenDrMd(&rp, IM_FGPEN((struct Image *)obj),
88 IM_BGPEN((struct Image *)obj),
89 data->mode);
91 SetAfPt(&rp, (APTR)((struct Image *)obj)->ImageData, data->apatsize);
93 x1 = ((struct Image *)obj)->LeftEdge + ((struct impDraw *)msg)->imp_Offset.X;
94 y1 = ((struct Image *)obj)->TopEdge + ((struct impDraw *)msg)->imp_Offset.Y;
96 if (msg->MethodID == IM_DRAW)
98 x2 = x1 + ((struct Image *)obj)->Width - 1;
99 y2 = y1 + ((struct Image *)obj)->Height - 1;
101 else
103 x2 = x1 + msg->imp_Dimensions.Width - 1;
104 y2 = y1 + msg->imp_Dimensions.Height - 1;
107 RectFill(&rp, x1, y1, x2, y2);
109 return 0;
112 /****************************************************************************/
114 IPTR FillRectClass__OM_NEW(Class *cl, Object *obj, struct opSet *msg)
116 obj = (Object *)DoSuperMethodA(cl, obj, (Msg)msg);
117 if (obj)
118 fillrect_set(cl, obj, msg);
120 return (IPTR)obj;
123 /****************************************************************************/
125 IPTR FillRectClass__OM_SET(Class *cl, Object *obj, struct opSet *msg)
127 return fillrect_set(cl, obj, msg) + DoSuperMethodA(cl, obj, (Msg)msg);
130 /****************************************************************************/