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