ReactOS  0.4.13-dev-52-g0efcfec
surface.h
Go to the documentation of this file.
1 #pragma once
2 
3 /* GDI surface object */
4 typedef struct _SURFACE
5 {
7 
9  //XDCOBJ * pdcoAA;
11  struct _PALETTE * const ppal; // Use SURFACE_vSetPalette to assign a palette
12  //UINT unk_050;
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 */
38 } SURFACE, *PSURFACE;
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,
71  DRIVER_CREATED_SURFACE = 0x00200000,
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,
79  DYNAMIC_MODE_PALETTE = 0x20000000,
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))
94 VOID
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 
108 extern 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 
114 ULONG
115 FASTCALL
116 BitmapFormat(ULONG cBits, ULONG iCompression);
117 
118 VOID
119 NTAPI
120 SURFACE_vCleanup(PVOID ObjectBody);
121 
122 PSURFACE
123 NTAPI
125  _In_ USHORT iType,
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 
135 VOID
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 
HANDLE hSecureUMPD
Definition: surface.h:16
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
_In_ ULONG iType
Definition: winddi.h:3748
static HDC
Definition: imagelist.c:92
struct _PALETTE *const ppal
Definition: surface.h:11
VOID NTAPI GDIOBJ_vDereferenceObject(POBJ pobj)
Definition: gdiobj.c:626
#define FASTCALL
Definition: nt_native.h:50
#define _In_opt_
Definition: no_sal2.h:213
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
SURFOBJ SurfObj
Definition: surface.h:8
FORCEINLINE VOID SURFACE_ShareLockByPointer(PSURFACE psurf)
Definition: surface.h:95
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
ULONG FASTCALL BitmapFormat(ULONG cBits, ULONG iCompression)
Definition: surface.c:39
#define FORCEINLINE
Definition: ntbasedef.h:221
unsigned long FLONG
Definition: ntbasedef.h:373
BASEOBJECT BaseObject
Definition: surface.h:6
_SURFACEFLAGS
Definition: surface.h:41
ULONG cRef
Definition: surface.h:27
unsigned long DWORD
Definition: ntddk_ex.h:95
#define _Inout_
Definition: no_sal2.h:244
FORCEINLINE VOID SURFACE_vSetPalette(_Inout_ PSURFACE psurf, _In_ PPALETTE ppal)
Definition: surface.h:136
unsigned char UCHAR
Definition: xmlstorage.h:181
HANDLE hSecure
Definition: surface.h:32
VOID NTAPI SURFACE_vCleanup(PVOID ObjectBody)
Definition: surface.c:67
HANDLE hDDSurface
Definition: surface.h:18
_In_ SIZEL _In_ ULONG iFormat
Definition: winddi.h:3467
#define _In_
Definition: no_sal2.h:204
UCHAR gajBitsPerFormat[]
Definition: surface.c:21
HPALETTE hpalHint
Definition: surface.h:28
DWORD dwOffset
Definition: surface.h:33
unsigned short USHORT
Definition: pedump.c:61
FLONG flags
Definition: surface.h:10
HANDLE hDIBSection
Definition: surface.h:31
VOID NTAPI GDIOBJ_vReferenceObjectByPointer(POBJ pobj)
Definition: gdiobj.c:729
struct _SURFACE SURFACE
HDC hdc
Definition: surface.h:26
_Out_opt_ int * cx
Definition: commctrl.h:570
unsigned int ULONG
Definition: retypes.h:1
SIZEL sizlDim
Definition: surface.h:21
struct _SURFACE * PSURFACE
DWORD biClrImportant
Definition: surface.h:37
HANDLE hMirrorParent
Definition: surface.h:17