w.i.p support for compositing screens with alpha and different pixfmts. alpha composi...
[aros:aros.git] / AROS / workbench / devs / monitors / Compositor / compositor_intern.h
1 #ifndef _COMPOSITOR_INTERN_H
2 #define _COMPOSITOR_INTERN_H
3
4 /*
5     Copyright © 2010-2013, The AROS Development Team. All rights reserved.
6     $Id$
7 */
8
9 #include "compositor.h"
10
11 #include <exec/nodes.h>
12 #include <exec/lists.h>
13 #include <exec/semaphores.h>
14 #include <graphics/gfx.h>
15
16 struct StackBitMapNode
17 {
18     struct MinNode              n;
19     OOP_Object                  *bm;
20     struct Region               *screenregion;
21     struct Rectangle            screenvisiblerect;      /* Visible part */
22     SIPTR                       leftedge;               /* Offset */
23     SIPTR                       topedge;
24     IPTR                        sbmflags;
25 };
26
27 // sbmflags bits 0 to 3 are reserved for the normal compositing flags.
28 #define STACKNODEB_HASALPHA      4
29 #define STACKNODEF_HASALPHA      (1 << STACKNODEB_HASALPHA)
30 #define STACKNODEB_VISIBLE       5
31 #define STACKNODEF_VISIBLE       (1 << STACKNODEB_VISIBLE)
32 #define STACKNODEB_DISPLAYABLE   6
33 #define STACKNODEF_DISPLAYABLE   (1 << STACKNODEB_DISPLAYABLE)
34
35 struct HIDDCompositorData
36 {
37     struct GfxBase              *GraphicsBase;
38     struct IntuitionBase        *IntuitionBase;
39
40     /* Bitmap to which all screen bitmaps are composited. Height/Width always 
41        matches visible mode */
42     OOP_Object                  *displaybitmap;
43     OOP_Object                  *intermedbitmap;
44
45     /* Pointer to actuall screen bitmap, result of last HIDD_Gfx_Show().
46        Needed for graphics.library only. */
47     OOP_Object                  *screenbitmap;
48
49     /* Pointer to top bitmap on stack */
50     OOP_Object                  *topbitmap;
51
52     HIDDT_ModeID                screenmodeid;   /* ModeID of currently visible mode             */
53     struct Rectangle            displayrect;     /* Dimensions of currently visible mode         */
54     struct Region               *alpharegion;
55
56     struct MinList              bitmapstack;
57     struct SignalSemaphore      semaphore;
58
59     struct Hook                 defaultbackfill;
60     struct Hook                 *backfillhook;
61
62     OOP_Object                  *gfx;           /* GFX driver object                            */
63     OOP_Object                  *fb;            /* Framebuffer bitmap (if present)              */
64     OOP_Object                  *gc;            /* GC object used for drawing operations        */
65     ULONG                       capabilities;
66     ULONG                       flags;        
67     BOOL                        modeschanged;   /* TRUE if new top bitmap has different mode than current screenmodeid */
68 };
69
70 #define COMPSTATEB_HASALPHA     0
71 #define COMPSTATEF_HASALPHA     (1 << COMPSTATEB_HASALPHA)
72
73 #define METHOD(base, id, name) \
74   base ## __ ## id ## __ ## name (OOP_Class *cl, OOP_Object *o, struct p ## id ## _ ## name *msg)
75
76 #define LOCK_COMPOSITOR_READ       { ObtainSemaphoreShared(&compdata->semaphore); }
77 #define LOCK_COMPOSITOR_WRITE      { ObtainSemaphore(&compdata->semaphore); }
78 #define UNLOCK_COMPOSITOR          { ReleaseSemaphore(&compdata->semaphore); }
79
80 extern OOP_AttrBase HiddCompositorAttrBase;
81 extern const struct OOP_InterfaceDescr Compositor_ifdescr[];
82
83 #endif /* _COMPOSITOR_INTERN_H */