27942cb5c76309776caa9ba0c1b5411f9ef7f489
[reactos.git] / subsystems / win32 / win32k / include / surface.h
1 #pragma once
2
3 #include "win32.h"
4 #include "gdiobj.h"
5
6 #define PDEV_SURFACE 0x80000000
7
8 /* GDI surface object */
9 typedef struct _SURFACE
10 {
11 BASEOBJECT BaseObject;
12
13 SURFOBJ SurfObj;
14 //XDCOBJ * pdcoAA;
15 FLONG flags;
16 struct _PALETTE *ppal;
17 //UINT unk_050;
18
19 union
20 {
21 HANDLE hSecureUMPD; // if UMPD_SURFACE set
22 HANDLE hMirrorParent;// if MIRROR_SURFACE set
23 HANDLE hDDSurface; // if DIRECTDRAW_SURFACE set
24 };
25
26 SIZEL sizlDim; /* For SetBitmapDimension(), do NOT use
27 to get width/height of bitmap, use
28 bitmap.bmWidth/bitmap.bmHeight for
29 that */
30
31 HDC hdc; // Doc in "Undocumented Windows", page 546, seems to be supported with XP.
32 ULONG cRef;
33 HPALETTE hpalHint;
34
35 /* For device-independent bitmaps: */
36 HANDLE hDIBSection;
37 HANDLE hSecure;
38 DWORD dwOffset;
39 //UINT unk_078;
40
41 /* reactos specific */
42 DWORD dsBitfields[3]; // hack, should probably use palette instead
43 DWORD biClrUsed;
44 DWORD biClrImportant;
45 } SURFACE, *PSURFACE;
46
47 // flags field:
48 //#define HOOK_BITBLT 0x00000001
49 //#define HOOK_STRETCHBLT 0x00000002
50 //#define HOOK_PLGBLT 0x00000004
51 //#define HOOK_TEXTOUT 0x00000008
52 //#define HOOK_PAINT 0x00000010
53 //#define HOOK_STROKEPATH 0x00000020
54 //#define HOOK_FILLPATH 0x00000040
55 //#define HOOK_STROKEANDFILLPATH 0x00000080
56 //#define HOOK_LINETO 0x00000100
57 //#define SHAREACCESS_SURFACE 0x00000200
58 //#define HOOK_COPYBITS 0x00000400
59 //#define REDIRECTION_SURFACE 0x00000800 // ?
60 //#define HOOK_MOVEPANNING 0x00000800
61 //#define HOOK_SYNCHRONIZE 0x00001000
62 //#define HOOK_STRETCHBLTROP 0x00002000
63 //#define HOOK_SYNCHRONIZEACCESS 0x00004000
64 //#define USE_DEVLOCK_SURFACE 0x00004000
65 //#define HOOK_TRANSPARENTBLT 0x00008000
66 //#define HOOK_ALPHABLEND 0x00010000
67 //#define HOOK_GRADIENTFILL 0x00020000
68 //#if (NTDDI_VERSION < 0x06000000)
69 // #define HOOK_FLAGS 0x0003B5FF
70 //#else
71 // #define HOOK_FLAGS 0x0003B5EF
72 //#endif
73 #define UMPD_SURFACE 0x00040000
74 #define MIRROR_SURFACE 0x00080000
75 #define DIRECTDRAW_SURFACE 0x00100000
76 #define DRIVER_CREATED_SURFACE 0x00200000
77 #define ENG_CREATE_DEVICE_SURFACE 0x00400000
78 #define DDB_SURFACE 0x00800000
79 #define LAZY_DELETE_SURFACE 0x01000000
80 #define BANDING_SURFACE 0x02000000
81 #define API_BITMAP 0x04000000
82 #define PALETTE_SELECT_SET 0x08000000
83 #define UNREADABLE_SURFACE 0x10000000
84 #define DYNAMIC_MODE_PALETTE 0x20000000
85 #define ABORT_SURFACE 0x40000000
86 #define PDEV_SURFACE 0x80000000
87
88
89 #define BMF_DONT_FREE 0x100
90 #define BMF_RLE_HACK 0x200
91
92
93 /* Internal interface */
94
95 #define SURFACE_AllocSurfaceWithHandle() ((PSURFACE) GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_BITMAP))
96 #define SURFACE_FreeSurface(pBMObj) GDIOBJ_FreeObj((POBJ) pBMObj, GDIObjType_SURF_TYPE)
97 #define SURFACE_FreeSurfaceByHandle(hBMObj) GDIOBJ_FreeObjByHandle((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
98
99 /* NOTE: Use shared locks! */
100 #define SURFACE_LockSurface(hBMObj) \
101 ((PSURFACE) GDIOBJ_LockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP))
102 #define SURFACE_ShareLockSurface(hBMObj) \
103 ((PSURFACE) GDIOBJ_ShareLockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP))
104 #define SURFACE_UnlockSurface(pBMObj) \
105 GDIOBJ_UnlockObjByPtr ((POBJ)pBMObj)
106 #define SURFACE_ShareUnlockSurface(pBMObj) \
107 GDIOBJ_ShareUnlockObjByPtr ((POBJ)pBMObj)
108
109 BOOL INTERNAL_CALL SURFACE_Cleanup(PVOID ObjectBody);
110
111 PSURFACE
112 NTAPI
113 SURFACE_AllocSurface(
114 IN ULONG iType,
115 IN ULONG cx,
116 IN ULONG cy,
117 IN ULONG iFormat);
118
119 BOOL
120 NTAPI
121 SURFACE_bSetBitmapBits(
122 IN PSURFACE psurf,
123 IN USHORT fjBitmap,
124 IN ULONG ulWidth,
125 IN PVOID pvBits OPTIONAL);
126
127 #define GDIDEV(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))
128 #define GDIDEVFUNCS(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))->DriverFunctions
129
130 ULONG FASTCALL BitmapFormat (WORD Bits, DWORD Compression);
131 extern UCHAR gajBitsPerFormat[];
132 #define BitsPerFormat(Format) gajBitsPerFormat[Format]