additional debug to help identify a problem on x86_64
[AROS.git] / workbench / libs / cgfx / unlockbitmaptaglist.c
blobf61f1895ac06bd39b35c93a08cefb495f6e1071b
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #define DEBUG 0
10 #include <aros/debug.h>
12 #include <proto/oop.h>
13 #include <proto/utility.h>
15 #include <cybergraphx/cybergraphics.h>
16 #include <hidd/graphics.h>
18 #include "cybergraphics_intern.h"
21 struct RectList
23 ULONG rl_num; // no. of rects in this list
24 struct RectList *rl_next; // pointer to next list
25 struct Rectangle rect1; // First Rectangle in the list
28 /*****************************************************************************
30 NAME */
31 #include <proto/cybergraphics.h>
33 AROS_LH2(void, UnLockBitMapTagList,
35 /* SYNOPSIS */
36 AROS_LHA(APTR , Handle, A0),
37 AROS_LHA(struct TagItem *, Tags, A1),
39 /* LOCATION */
40 struct Library *, CyberGfxBase, 30, Cybergraphics)
42 /* FUNCTION
43 Releases exclusive access to a bitmap. Options for the unlocking
44 process are given in a taglist. The possible tags are as follows:
45 UBMI_UPDATERECTS (struct RectList *) - pointer to a series of
46 rectangle lists that need to be refreshed.
47 UBMI_REALLYUNLOCK (BOOL) - if FALSE, the bitmap will not be
48 unlocked; only rectangle updates will be done.
50 INPUTS
51 Handle - handle to the bitmap to unlock.
52 Tags - a taglist as described above.
54 RESULT
55 None.
57 NOTES
59 EXAMPLE
61 BUGS
63 SEE ALSO
64 UnLockBitMap(), LockBitMapTagList()
66 INTERNALS
68 *****************************************************************************/
70 AROS_LIBFUNC_INIT
72 struct TagItem *tag;
73 BOOL reallyunlock = TRUE;
74 struct RectList *rl = NULL;
75 struct BitMap *bm = (struct BitMap *)Handle;
77 D(bug("[Cybergfx] %s(0x%p, 0x%p)\n", __PRETTY_FUNCTION__, bm, Tags));
79 if ((bm) && (IS_HIDD_BM(bm)))
81 while ((tag = NextTagItem(&Tags)))
83 switch (tag->ti_Tag)
85 case UBMI_REALLYUNLOCK:
86 reallyunlock = (BOOL)tag->ti_Data;
87 break;
89 case UBMI_UPDATERECTS:
91 rl = (struct RectList *)tag->ti_Data;
92 break;
95 default:
96 D(bug("[Cybergfx] %s: !!! UNKNOWN TAG %08x !!!\n", __PRETTY_FUNCTION__, tag->ti_Tag));
97 break;
101 if (reallyunlock)
103 D(bug("[Cybergfx] %s: Calling HIDD_BM_ReleaseDirectAccess...\n", __PRETTY_FUNCTION__));
104 HIDD_BM_ReleaseDirectAccess(HIDD_BM_OBJ(bm));
107 if (rl)
109 while (rl)
111 struct Rectangle *rectCurrent;
112 int count;
114 D(bug("[Cybergfx] %s: RectList @ 0x%p\n", __PRETTY_FUNCTION__, rl));
116 if ((count = rl->rl_num) > 0)
118 D(bug("[Cybergfx] %s: %d entries\n", __PRETTY_FUNCTION__, rl->rl_num));
120 for (rectCurrent = &rl->rect1; count > 0; count--)
122 D(bug("[Cybergfx] %s: Updating BitMap Rect [%d, %d -> %d, %d]\n", __PRETTY_FUNCTION__, rectCurrent->MinX, rectCurrent->MinY, rectCurrent->MaxX, rectCurrent->MaxY));
123 UpdateBitMap(bm, rectCurrent->MinX, rectCurrent->MinY, rectCurrent->MaxX - rectCurrent->MinX + 1, rectCurrent->MaxY - rectCurrent->MinY + 1);
124 rectCurrent = &rectCurrent[1];
127 rl = rl->rl_next;
130 else
132 D(bug("[Cybergfx] %s: Updating full bitmap\n", __PRETTY_FUNCTION__));
133 UpdateBitMap(bm, 0, 0, GetCyberMapAttr(bm, CYBRMATTR_WIDTH), GetCyberMapAttr(bm, CYBRMATTR_HEIGHT));
136 else
138 D(bug("[Cybergfx] %s: Called on Illegal BitMap @ 0x%p\n", __PRETTY_FUNCTION__, bm));
141 AROS_LIBFUNC_EXIT
142 } /* UnLockBitMapTagList */