2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Basic support functions for layers.library.
9 #include "layers_intern.h"
10 #include <exec/types.h>
11 #include <graphics/gfx.h>
12 #include <graphics/clip.h>
28 /***************************************************************************/
30 /***************************************************************************/
32 void BltRPtoCR(struct RastPort
* rp
,
35 struct LayersBase
* LayersBase
);
37 void BltCRtoRP(struct RastPort
* rp
,
40 struct LayersBase
* LayersBase
);
42 /***************************************************************************/
44 /***************************************************************************/
46 void _CallLayerHook(struct Hook
* h
,
52 struct LayersBase
* LayersBase
);
55 /***************************************************************************/
57 /***************************************************************************/
59 void SetLayerPriorities(struct Layer_Info
* li
);
60 struct Layer
* internal_WhichLayer(struct Layer
* l
, WORD x
, WORD y
);
61 struct Layer
*CreateLayerTagList(struct Layer_Info
*li
, struct BitMap
*bm
, LONG x0
, LONG y0
,
62 LONG x1
, LONG y1
, LONG flags
, int priority
, struct TagItem
*tagList
,
63 struct LayersBase
*LayersBase
);
64 void _FreeLayer(struct Layer
* l
, struct LayersBase
*LayersBase
);
65 struct Layer
*GetFirstFamilyMember(struct Layer
*l
);
68 /***************************************************************************/
70 /***************************************************************************/
72 BOOL _AllocExtLayerInfo
73 (struct Layer_Info
* li
, struct LayersBase
*LayersBase
);
75 void _FreeExtLayerInfo
76 (struct Layer_Info
* li
, struct LayersBase
*LayersBase
);
79 (struct Layer_Info
* li
, struct LayersBase
* LayersBase
);
82 (struct Layer_Info
* li
, struct LayersBase
* LayersBase
);
85 (struct Layer_Info
* li
, struct LayersBase
* LayersBase
);
88 (struct Layer_Info
* li
, struct LayersBase
* LayersBase
);
90 /***************************************************************************/
92 /***************************************************************************/
94 //void _TranslateRect(struct Rectangle *rect, WORD dx, WORD dy);
95 struct ClipRect
* internal_WhichClipRect(struct Layer
* L
, WORD x
, WORD y
);
98 /***************************************************************************/
99 /* RESOURCE HANDLING */
100 /***************************************************************************/
102 BOOL
AddLayersResource(struct Layer_Info
* li
,
106 struct ResourceNode
* AddLayersResourceNode(struct Layer_Info
* li
);
108 struct ClipRect
* _AllocClipRect(struct Layer
* L
, struct LayersBase
*LayersBase
);
109 void _FreeClipRect(struct ClipRect
* CR
, struct Layer
* L
, struct LayersBase
*LayersBase
);
110 void _FreeClipRectListBM(struct Layer
* L
, struct ClipRect
* CR
, struct LayersBase
*LayersBase
);
112 void FreeCRBitMap(struct ClipRect
* cr
);
114 void * AllocLayerStruct(ULONG Size
,
116 struct Layer_Info
* li
,
117 struct LayersBase
* LayersBase
);
119 void FreeLayerResources(struct Layer_Info
* li
,
122 /***************************************************************************/
124 /***************************************************************************/
126 void CleanTopLayer(struct Layer_Info
* LI
);
127 void CleanupLayers(struct Layer_Info
* LI
);
128 void UnsplitLayers(struct Layer_Info
* LI
, struct Rectangle
* rect
);
129 void CopyAndFreeClipRectsClipRects(struct Layer
* L
,
130 struct ClipRect
* srcCR
,
131 struct ClipRect
* destCR
);
132 int _CopyClipRectsToClipRects(struct Layer
* l
,
133 struct ClipRect
* oldcr
,
134 struct ClipRect
* newcr
,
140 struct LayersBase
*LayersBase
);
141 void UninstallClipRegionClipRects(struct Layer_Info
* LI
);
142 void InstallClipRegionClipRects(struct Layer_Info
* LI
);
144 /***************************************************************************/
145 /* TRANSPARENCY HOOK */
146 /***************************************************************************/
148 struct Region
*doCreateLayer(struct Hook
*shapeHook
, struct Region
*layershape
,
149 LONG x0
, LONG y0
, LONG x1
, LONG y1
,
150 APTR data
, struct LayersBase
*LayersBase
);
151 void doChangeLayer(struct Layer
*l
, struct LayersBase
*LayersBase
);
153 /*-----------------------------------END-----------------------------------*/
155 #define RECTAREA(r) (((r)->MaxX - (r)->MinX + 1) * ((r)->MaxY - (r)->MinY + 1))
157 #define DO_OVERLAP(r1,r2) (!( ((r1)->MinX > (r2)->MaxX) || \
158 ((r1)->MinY > (r2)->MaxY) || \
159 ((r1)->MaxX < (r2)->MinX) || \
160 ((r1)->MaxY < (r2)->MinY) ))
162 #define IS_EMPTYREGION(r) (NULL == (r)->RegionRectangle)
164 #define IS_ROOTLAYER(l) ((l) == (l)->LayerInfo->check_lp)
166 #define CHECKDAMAGELIST(l) \
167 if (IS_EMPTYREGION(l->DamageList)) \
169 l->Flags &= ~LAYERREFRESH; \
172 l->Flags |= LAYERREFRESH;
174 int _BackupPartsOfLayer(struct Layer
* l
,
175 struct Region
* hide_region
,
177 int backupsimplerefresh
,
178 struct LayersBase
*);
180 int _ShowPartsOfLayer(struct Layer
* l
,
181 struct Region
* show_region
,
182 struct LayersBase
*);
184 int _ShowLayer(struct Layer
* l
, struct LayersBase
*LayersBase
);
186 struct Layer
* _FindFirstFamilyMember(struct Layer
* l
);
188 void _BackFillRegion(struct Layer
* l
,
191 struct LayersBase
* LayersBase
);
193 struct ClipRect
* _CreateClipRectsFromRegion(struct Region
*r
,
196 struct Region
*inverter
,
197 struct LayersBase
*LayersBase
);
199 struct Region
*_InternalInstallClipRegion(struct Layer
*l
, struct Region
*region
,
200 WORD srcdx
, WORD destdx
,
201 struct LayersBase
*LayersBase
);