cybergraphics.library: simplify code by returning the bitmap as handle APTR since...
[aros:aros.git] / AROS / workbench / libs / cgfx / unlockbitmaptaglist.c
1 /*
2     Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3     $Id$
4
5     Desc:
6     Lang: english
7 */
8
9 #include <aros/debug.h>
10 #include <cybergraphx/cybergraphics.h>
11 #include <hidd/graphics.h>
12 #include <proto/oop.h>
13 #include <proto/utility.h>
14
15 #include "cybergraphics_intern.h"
16
17 /*****************************************************************************
18
19     NAME */
20 #include <proto/cybergraphics.h>
21
22         AROS_LH2(void, UnLockBitMapTagList,
23
24 /*  SYNOPSIS */
25         AROS_LHA(APTR            , Handle, A0),
26         AROS_LHA(struct TagItem *, Tags, A1),
27
28 /*  LOCATION */
29         struct Library *, CyberGfxBase, 30, Cybergraphics)
30
31 /*  FUNCTION
32         Releases exclusive access to a bitmap. Options for the unlocking
33         process are given in a taglist. The possible tags are as follows:
34             UBMI_UPDATERECTS (struct RectList *) - pointer to a series of
35                 rectangle lists that need to be refreshed.
36             UBMI_REALLYUNLOCK (BOOL) - if FALSE, the bitmap will not be
37                 unlocked; only rectangle updates will be done.
38
39     INPUTS
40         Handle - handle to the bitmap to unlock.
41         Tags - a taglist as described above.
42
43     RESULT
44         None.
45
46     NOTES
47
48     EXAMPLE
49
50     BUGS
51
52     SEE ALSO
53         UnLockBitMap(), LockBitMapTagList()
54
55     INTERNALS
56
57 *****************************************************************************/
58 {
59     AROS_LIBFUNC_INIT
60     
61     struct TagItem *tag;
62     BOOL reallyunlock = TRUE;
63     struct RectList *rl = NULL;
64     struct BitMap *bm = (struct BitMap *)Handle;
65
66     if (bm)
67     {
68         while ((tag = NextTagItem(&Tags)))
69         {
70             switch (tag->ti_Tag)
71             {
72                 case UBMI_REALLYUNLOCK:
73                     reallyunlock = (BOOL)tag->ti_Data;
74                     break;
75                     
76                 case UBMI_UPDATERECTS:
77                 {
78                     rl = (struct RectList *)tag->ti_Data;
79                     break;
80                 }
81             
82                 default:
83                     D(bug("!!! UNKNOWN TAG PASSED TO UnLockBitMapTagList() !!!\n"));
84                     break;
85             }
86         }
87         
88         if (reallyunlock)
89             HIDD_BM_ReleaseDirectAccess(HIDD_BM_OBJ(bm));
90
91         if (rl)
92         {
93             
94         }
95         else
96             UpdateBitMap(bm, 0, 0, GetCyberMapAttr(bm, CYBRMATTR_WIDTH), GetCyberMapAttr(bm, CYBRMATTR_HEIGHT));
97     }
98     AROS_LIBFUNC_EXIT
99 } /* UnLockBitMapTagList */