ReactOS  0.4.14-dev-554-g2f8d847
gdi_private.h
Go to the documentation of this file.
1 /*
2  * GDI definitions
3  *
4  * Copyright 1993 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #ifndef __WINE_GDI_PRIVATE_H
22 #define __WINE_GDI_PRIVATE_H
23 
24 #include <limits.h>
25 #include <math.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wingdi.h"
29 #include <wine/gdi_driver.h>
30 
31 /* Metafile defines */
32 #define META_EOF 0x0000
33 /* values of mtType in METAHEADER. Note however that the disk image of a disk
34  based metafile has mtType == 1 */
35 #define METAFILE_MEMORY 1
36 #define METAFILE_DISK 2
37 #define MFHEADERSIZE (sizeof(METAHEADER))
38 #define MFVERSION 0x300
39 
40 typedef struct {
45 
47 {
53 };
54 
55 /* DC_ATTR LCD Types */
56 #define LDC_LDC 0x00000001
57 #define LDC_EMFLDC 0x00000002
58 
59 typedef struct tagWINEDC
60 {
64  union {
65  PVOID pvEmfDC; /* Pointer to ENHMETAFILE structure */
66  PHYSDEV physDev; /* current top of the physdev stack */
67  };
76  HBRUSH hBrush;
77  HPEN hPen;
80  LONG refcount; /* thread refcount */
83  HPALETTE hPalette;
84 } WINEDC, DC;
85 
87 
88 /* brush.c */
90 
91 /* dc.c */
93 extern void free_dc_ptr( DC *dc ) DECLSPEC_HIDDEN;
95 extern void release_dc_ptr( DC *dc ) DECLSPEC_HIDDEN;
96 
97 /* dib.c */
98 extern int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) DECLSPEC_HIDDEN;
99 
100 /* enhmetafile.c */
101 extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk ) DECLSPEC_HIDDEN;
102 
103 /* gdiobj.c */
104 extern HGDIOBJ alloc_gdi_handle( void *obj, WORD type, const struct gdi_obj_funcs *funcs ) DECLSPEC_HIDDEN;
107 extern void *GDI_GetObjPtr( HGDIOBJ, WORD ) DECLSPEC_HIDDEN;
108 extern void GDI_ReleaseObj( HGDIOBJ ) DECLSPEC_HIDDEN;
111 
112 /* metafile.c */
113 extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh) DECLSPEC_HIDDEN;
115 
116 /* Format of comment record added by GetWinMetaFileBits */
117 #include <pshpack2.h>
118 typedef struct
119 {
120  DWORD magic; /* WMFC */
121  WORD unk04; /* 1 */
122  WORD unk06; /* 0 */
123  WORD unk08; /* 0 */
124  WORD unk0a; /* 1 */
126  DWORD unk0e; /* 0 */
131  BYTE emf_data[1];
133 #include <poppack.h>
134 
135 #define WMFC_MAGIC 0x43464d57
136 /* palette.c */
137 extern HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg) DECLSPEC_HIDDEN;
139 
140 #define EMR_SETLINKEDUFI 119
141 
142 #define GET_DC_PHYSDEV(dc,func) \
143  get_physdev_entry_point( (dc)->physDev, FIELD_OFFSET(struct gdi_dc_funcs,func))
144 
145 static inline PHYSDEV pop_dc_driver( DC *dc, const struct gdi_dc_funcs *funcs )
146 {
147  PHYSDEV dev, *pdev = &dc->physDev;
148  while (*pdev && (*pdev)->funcs != funcs) pdev = &(*pdev)->next;
149  if (!*pdev) return NULL;
150  dev = *pdev;
151  *pdev = dev->next;
152  return dev;
153 }
154 
155 static inline PHYSDEV find_dc_driver( DC *dc, const struct gdi_dc_funcs *funcs )
156 {
157  PHYSDEV dev;
158 
159  for (dev = dc->physDev; dev; dev = dev->next) if (dev->funcs == funcs) return dev;
160  return NULL;
161 }
162 
163 /* Undocumented value for DIB's iUsage: Indicates a mono DIB w/o pal entries */
164 #define DIB_PAL_MONO 2
165 
166 BOOL WINAPI SetVirtualResolution(HDC hdc, DWORD horz_res, DWORD vert_res, DWORD horz_size, DWORD vert_size);
167 
168 static inline int get_dib_stride( int width, int bpp )
169 {
170  return ((width * bpp + 31) >> 3) & ~3;
171 }
172 
173 static inline int get_dib_image_size( const BITMAPINFO *info )
174 {
175  return get_dib_stride( info->bmiHeader.biWidth, info->bmiHeader.biBitCount )
176  * abs( info->bmiHeader.biHeight );
177 }
178 
179 /* only for use on sanitized BITMAPINFO structures */
180 static inline int get_dib_info_size( const BITMAPINFO *info, UINT coloruse )
181 {
182  if (info->bmiHeader.biCompression == BI_BITFIELDS)
183  return sizeof(BITMAPINFOHEADER) + 3 * sizeof(DWORD);
184  if (coloruse == DIB_PAL_COLORS)
185  return sizeof(BITMAPINFOHEADER) + info->bmiHeader.biClrUsed * sizeof(WORD);
186  return FIELD_OFFSET( BITMAPINFO, bmiColors[info->bmiHeader.biClrUsed] );
187 }
188 
189 #define GdiWorldSpaceToDeviceSpace 0x204
191 
192 /* Special sauce for reactos */
193 #define GDIRealizePalette RealizePalette
194 #define GDISelectPalette SelectPalette
195 
197 #define get_full_gdi_handle GdiFixUpHandle
198 
199 extern void push_dc_driver_ros(PHYSDEV *dev, PHYSDEV physdev, const struct gdi_dc_funcs *funcs);
200 #define push_dc_driver push_dc_driver_ros
201 #if 0
202 BOOL WINAPI SetWorldTransformForMetafile(HDC hdc, const XFORM *pxform);
203 #define SetWorldTransform SetWorldTransformForMetafile
204 #endif
205 #ifdef _M_ARM
206 #define DbgRaiseAssertionFailure() __emit(0xdefc)
207 #else
208 #define DbgRaiseAssertionFailure() __int2c()
209 #endif // _M_ARM
210 
211 #undef ASSERT
212 #define ASSERT(x) if (!(x)) DbgRaiseAssertionFailure()
213 
214 #endif /* __WINE_GDI_PRIVATE_H */
215 
HPALETTE hPalette
Definition: gdi_private.h:83
#define abs(i)
Definition: fconv.c:206
struct EMRSETTEXTJUSTIFICATION * PEMRSETTEXTJUSTIFICATION
GLint GLint GLsizei width
Definition: gl.h:1546
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
PVOID pvEmfDC
Definition: gdi_private.h:65
ABORTPROC pAbortProc
Definition: gdi_private.h:69
static PHYSDEV find_dc_driver(DC *dc, const struct gdi_dc_funcs *funcs)
Definition: gdi_private.h:155
HGDIOBJ alloc_gdi_handle(void *obj, WORD type, const struct gdi_obj_funcs *funcs) DECLSPEC_HIDDEN
#define DIB_PAL_COLORS
Definition: wingdi.h:365
struct gdi_physdev * next
Definition: gdi_driver.h:32
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define INT
Definition: polytest.cpp:20
static HDC
Definition: imagelist.c:92
struct tagWINEDC WINEDC
u32_t magic(void)
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
BOOL get_brush_bitmap_info(HBRUSH handle, BITMAPINFO *info, void **bits, UINT *usage) DECLSPEC_HIDDEN
const char * filename
Definition: ioapi.h:135
#define BOOL
Definition: nt_native.h:43
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
int32_t INT
Definition: typedefs.h:56
void release_dc_ptr(DC *dc) DECLSPEC_HIDDEN
#define BI_BITFIELDS
Definition: mmreg.h:507
static int dev
Definition: mkdosfs.c:536
void GDI_ReleaseObj(HGDIOBJ) DECLSPEC_HIDDEN
Definition: rosglue.c:289
HANDLE hPrinter
Definition: gdi_private.h:71
_In_ DWORD _Out_ LPXFORM pxf
Definition: ntgdi.h:2251
int bitmap_info_size(const BITMAPINFO *info, WORD coloruse) DECLSPEC_HIDDEN
Definition: rosglue.c:449
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
PHYSDEV physDev
Definition: gdi_private.h:66
INT(* pGetObjectA)(HGDIOBJ handle, INT count, LPVOID buffer)
Definition: gdi_private.h:49
BOOL APIENTRY NtGdiGetTransform(_In_ HDC hdc, _In_ DWORD iXform, _Out_ LPXFORM pxf)
#define GDIRealizePalette
Definition: gdi_private.h:193
smooth NULL
Definition: ftsmooth.c:416
struct tagWINEDC DC
#define _Out_
Definition: no_sal2.h:323
void push_dc_driver_ros(PHYSDEV *dev, PHYSDEV physdev, const struct gdi_dc_funcs *funcs)
Definition: rosglue.c:403
HBRUSH hBrush
Definition: gdi_private.h:76
DC * alloc_dc_ptr(WORD magic) DECLSPEC_HIDDEN
Definition: rosglue.c:295
PDEVMODEW pdm
Definition: gdi_private.h:72
Definition: polytest.cpp:40
_In_ DWORD iXform
Definition: ntgdi.h:2251
BOOL(* pDeleteObject)(HGDIOBJ handle)
Definition: gdi_private.h:52
BOOL(CALLBACK * ABORTPROC)(HDC, int)
Definition: wingdi.h:2910
ULONG Flags
Definition: gdi_private.h:62
HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh) DECLSPEC_HIDDEN
Definition: metafile.c:107
#define WINAPI
Definition: msvc.h:8
static struct __wine_debug_functions funcs
Definition: debug.c:59
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk) DECLSPEC_HIDDEN
Definition: enhmetafile.c:249
static int get_dib_stride(int width, int bpp)
Definition: gdi_private.h:168
static PHYSDEV pop_dc_driver(DC *dc, const struct gdi_dc_funcs *funcs)
Definition: gdi_private.h:145
ULONG DevCaps[36]
Definition: gdi_private.h:75
void free_dc_ptr(DC *dc) DECLSPEC_HIDDEN
HGDIOBJ(* pSelectObject)(HGDIOBJ handle, HDC hdc)
Definition: gdi_private.h:48
HDC hdc
Definition: main.c:9
struct gdi_physdev NullPhysDev
Definition: gdi_private.h:79
LPWSTR pwszPort
Definition: gdi_private.h:68
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
PVOID pUMdhpdev
Definition: gdi_private.h:74
unsigned char BYTE
Definition: mem.h:68
#define GDISelectPalette
Definition: gdi_private.h:194
BOOL WINAPI SetVirtualResolution(HDC hdc, DWORD horz_res, DWORD vert_res, DWORD horz_size, DWORD vert_size)
Definition: rosglue.c:523
BOOL(* pUnrealizeObject)(HGDIOBJ handle)
Definition: gdi_private.h:51
INT saveLevel
Definition: gdi_private.h:81
static int get_dib_image_size(const BITMAPINFO *info)
Definition: gdi_private.h:173
HPEN hPen
Definition: gdi_private.h:77
#define _In_
Definition: no_sal2.h:204
void * HGDIOBJ
Definition: windef.h:252
#define DECLSPEC_HIDDEN
Definition: precomp.h:8
DWORD CallBackTick
Definition: gdi_private.h:70
WINEDC * get_physdev_dc(PHYSDEV dev)
Definition: rosglue.c:191
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
unsigned int UINT
Definition: ndis.h:50
DC * get_dc_ptr(HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:378
HGDIOBJ WINAPI GdiFixUpHandle(HGDIOBJ hGdiObj)
Definition: misc.c:734
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
void GDI_hdc_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:416
CONST void * LPCVOID
Definition: windef.h:191
METAHEADER * MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCVOID filename, BOOL unicode) DECLSPEC_HIDDEN
Definition: metafile.c:271
void GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:432
static int get_dib_info_size(const BITMAPINFO *info, UINT coloruse)
Definition: gdi_private.h:180
unsigned int ULONG
Definition: retypes.h:1
void * free_gdi_handle(HGDIOBJ handle) DECLSPEC_HIDDEN
Definition: rosglue.c:248
void * GDI_GetObjPtr(HGDIOBJ, WORD) DECLSPEC_HIDDEN
Definition: rosglue.c:255
static const WCHAR dc[]
#define get_full_gdi_handle
Definition: gdi_private.h:197
DWORD bpp
Definition: surface.c:181
const struct gdi_dc_funcs * funcs
Definition: gdi_driver.h:31
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG refcount
Definition: gdi_private.h:80
PVOID pUMPDev
Definition: gdi_private.h:73
HFONT hFont
Definition: gdi_private.h:82
#define APIENTRY
Definition: api.h:79
INT(* pGetObjectW)(HGDIOBJ handle, INT count, LPVOID buffer)
Definition: gdi_private.h:50