[WIN32K]
[reactos.git] / reactos / win32ss / gdi / eng / 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 #define BMF_POOLALLOC 0x100
84
85 /* Internal interface */
86
87 #define SURFACE_AllocSurfaceWithHandle() ((PSURFACE) GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_BITMAP, sizeof(SURFACE)))
88 #define SURFACE_FreeSurface(pBMObj) GDIOBJ_FreeObj((POBJ) pBMObj, GDIObjType_SURF_TYPE)
89 #define SURFACE_FreeSurfaceByHandle(hBMObj) GDIOBJ_FreeObjByHandle((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
90
91 /* NOTE: Use shared locks! */
92 #define SURFACE_ShareLockSurface(hBMObj) \
93 ((PSURFACE) GDIOBJ_ShareLockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP))
94 #define SURFACE_UnlockSurface(pBMObj) \
95 GDIOBJ_vUnlockObject ((POBJ)pBMObj)
96 #define SURFACE_ShareUnlockSurface(pBMObj) \
97 GDIOBJ_vDereferenceObject ((POBJ)pBMObj)
98
99 #define GDIDEV(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))
100 #define GDIDEVFUNCS(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))->DriverFunctions
101
102 extern UCHAR gajBitsPerFormat[];
103 #define BitsPerFormat(Format) gajBitsPerFormat[Format]
104
105 #define WIDTH_BYTES_ALIGN32(cx, bpp) ((((cx) * (bpp) + 31) & ~31) >> 3)
106 #define WIDTH_BYTES_ALIGN16(cx, bpp) ((((cx) * (bpp) + 15) & ~15) >> 3)
107
108 ULONG
109 FASTCALL
110 BitmapFormat(ULONG cBits, ULONG iCompression);
111
112 BOOL
113 NTAPI
114 SURFACE_Cleanup(PVOID ObjectBody);
115
116 PSURFACE
117 NTAPI
118 SURFACE_AllocSurface(
119 _In_ USHORT iType,
120 _In_ ULONG cx,
121 _In_ ULONG cy,
122 _In_ ULONG iFormat,
123 _In_ ULONG fjBitmap,
124 _In_opt_ ULONG cjWidth,
125 _In_opt_ PVOID pvBits);