ReactOS 0.4.15-dev-8339-g4028de8
surface.h
Go to the documentation of this file.
1#pragma once
2
3/* GDI surface object */
4typedef struct _SURFACE
5{
7
9 //XDCOBJ * pdcoAA;
11 struct _PALETTE * const ppal; // Use SURFACE_vSetPalette to assign a palette
13
14 union
15 {
16 HANDLE hSecureUMPD; // if UMPD_SURFACE set
17 HANDLE hMirrorParent;// if MIRROR_SURFACE set
18 HANDLE hDDSurface; // if DIRECTDRAW_SURFACE set
19 };
20
21 SIZEL sizlDim; /* For SetBitmapDimension(), do NOT use
22 to get width/height of bitmap, use
23 bitmap.bmWidth/bitmap.bmHeight for
24 that */
25
26 HDC hdc; // Doc in "Undocumented Windows", page 546, seems to be supported with XP.
28 HPALETTE hpalHint;
29
30 /* For device-independent bitmaps: */
34 //UINT unk_078;
35
36 /* reactos specific */
39
40/* flags field */
42{
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 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 UMPD_SURFACE = 0x00040000,
69 MIRROR_SURFACE = 0x00080000,
70 DIRECTDRAW_SURFACE = 0x00100000,
73 DDB_SURFACE = 0x00800000,
74 LAZY_DELETE_SURFACE = 0x01000000,
75 BANDING_SURFACE = 0x02000000,
76 API_BITMAP = 0x04000000,
77 PALETTE_SELECT_SET = 0x08000000,
78 UNREADABLE_SURFACE = 0x10000000,
80 ABORT_SURFACE = 0x40000000,
81 PDEV_SURFACE = 0x80000000
82};
83
84#define BMF_POOLALLOC 0x100
85
86/* Internal interface */
87
88#define SURFACE_AllocSurfaceWithHandle() ((PSURFACE) GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_BITMAP, sizeof(SURFACE)))
89
90/* NOTE: Use shared locks! */
91#define SURFACE_ShareLockSurface(hBMObj) \
92 ((PSURFACE) GDIOBJ_ShareLockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP))
94VOID
96{
98}
99
100#define SURFACE_UnlockSurface(pBMObj) \
101 GDIOBJ_vUnlockObject ((POBJ)pBMObj)
102#define SURFACE_ShareUnlockSurface(pBMObj) \
103 GDIOBJ_vDereferenceObject ((POBJ)pBMObj)
104
105#define GDIDEV(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))
106#define GDIDEVFUNCS(SurfObj) ((PDEVOBJ *)((SurfObj)->hdev))->DriverFunctions
107
108extern UCHAR gajBitsPerFormat[];
109#define BitsPerFormat(Format) gajBitsPerFormat[Format]
110
111#define WIDTH_BYTES_ALIGN32(cx, bpp) ((((cx) * (bpp) + 31) & ~31) >> 3)
112#define WIDTH_BYTES_ALIGN16(cx, bpp) ((((cx) * (bpp) + 15) & ~15) >> 3)
113
114ULONG
116BitmapFormat(ULONG cBits, ULONG iCompression);
117
118VOID
119NTAPI
120SURFACE_vCleanup(PVOID ObjectBody);
121
123NTAPI
126 _In_ ULONG cx,
127 _In_ ULONG cy,
129 _In_ ULONG fjBitmap,
130 _In_opt_ ULONG cjWidth,
131 _In_opt_ ULONG cjBits,
132 _In_opt_ PVOID pvBits);
133
135VOID
137 _Inout_ PSURFACE psurf,
138 _In_ PPALETTE ppal)
139{
140 if (psurf->ppal)
141 GDIOBJ_vDereferenceObject((POBJ)psurf->ppal);
142 if (ppal)
144 *(PVOID*)&psurf->ppal = ppal;
145}
146
unsigned long DWORD
Definition: ntddk_ex.h:95
static HDC
Definition: imagelist.c:92
#define _Inout_
Definition: ms_sal.h:378
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
#define FASTCALL
Definition: nt_native.h:50
unsigned long FLONG
Definition: ntbasedef.h:366
unsigned short USHORT
Definition: pedump.c:61
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
ULONG cRef
Definition: surface.h:27
SURFOBJ SurfObj
Definition: surface.h:8
HANDLE hMirrorParent
Definition: surface.h:17
HANDLE hSecureUMPD
Definition: surface.h:16
HANDLE hDIBSection
Definition: surface.h:31
SIZEL sizlDim
Definition: surface.h:21
struct _EWNDOBJ * pWinObj
Definition: surface.h:12
HDC hdc
Definition: surface.h:26
HANDLE hSecure
Definition: surface.h:32
DWORD dwOffset
Definition: surface.h:33
HANDLE hDDSurface
Definition: surface.h:18
HPALETTE hpalHint
Definition: surface.h:28
DWORD biClrImportant
Definition: surface.h:37
struct _PALETTE *const ppal
Definition: surface.h:11
BASEOBJECT BaseObject
Definition: surface.h:6
FLONG flags
Definition: surface.h:10
#define NTAPI
Definition: typedefs.h:36
uint32_t ULONG
Definition: typedefs.h:59
#define FORCEINLINE
Definition: wdftypes.h:67
struct _SURFACE SURFACE
FORCEINLINE VOID SURFACE_vSetPalette(_Inout_ PSURFACE psurf, _In_ PPALETTE ppal)
Definition: surface.h:136
FORCEINLINE VOID SURFACE_ShareLockByPointer(PSURFACE psurf)
Definition: surface.h:95
_SURFACEFLAGS
Definition: surface.h:42
@ MIRROR_SURFACE
Definition: surface.h:69
@ UNREADABLE_SURFACE
Definition: surface.h:78
@ BANDING_SURFACE
Definition: surface.h:75
@ LAZY_DELETE_SURFACE
Definition: surface.h:74
@ API_BITMAP
Definition: surface.h:76
@ DRIVER_CREATED_SURFACE
Definition: surface.h:71
@ ABORT_SURFACE
Definition: surface.h:80
@ PDEV_SURFACE
Definition: surface.h:81
@ UMPD_SURFACE
Definition: surface.h:68
@ ENG_CREATE_DEVICE_SURFACE
Definition: surface.h:72
@ DDB_SURFACE
Definition: surface.h:73
@ PALETTE_SELECT_SET
Definition: surface.h:77
@ SHAREACCESS_SURFACE
Definition: surface.h:52
@ DIRECTDRAW_SURFACE
Definition: surface.h:70
@ DYNAMIC_MODE_PALETTE
Definition: surface.h:79
UCHAR gajBitsPerFormat[]
Definition: surface.c:21
struct _SURFACE * PSURFACE
ULONG FASTCALL BitmapFormat(ULONG cBits, ULONG iCompression)
Definition: surface.c:39
PSURFACE NTAPI SURFACE_AllocSurface(_In_ USHORT iType, _In_ ULONG cx, _In_ ULONG cy, _In_ ULONG iFormat, _In_ ULONG fjBitmap, _In_opt_ ULONG cjWidth, _In_opt_ ULONG cjBits, _In_opt_ PVOID pvBits)
Definition: surface.c:116
VOID NTAPI SURFACE_vCleanup(PVOID ObjectBody)
Definition: surface.c:67
VOID NTAPI GDIOBJ_vDereferenceObject(POBJ pobj)
Definition: gdiobj.c:631
VOID NTAPI GDIOBJ_vReferenceObjectByPointer(POBJ pobj)
Definition: gdiobj.c:734
_In_ ULONG iType
Definition: winddi.h:3748
_In_ SIZEL _In_ ULONG iFormat
Definition: winddi.h:3468
unsigned char UCHAR
Definition: xmlstorage.h:181