ReactOS 0.4.15-dev-5666-gc548b97
gdi_private.h File Reference
#include <limits.h>
#include <math.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include <pshpack2.h>
#include <poppack.h>
Include dependency graph for gdi_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  EMRSETTEXTJUSTIFICATION
 
struct  tagEMRESCAPE
 
struct  gdi_obj_funcs
 
struct  tagWINEDC
 
struct  emf_in_wmf_comment
 

Macros

#define GDI_HANDLE_TYPE_MASK   0x007f0000
 
#define GDI_HANDLE_GET_TYPE(h)    (((ULONG_PTR)(h)) & GDI_HANDLE_TYPE_MASK)
 
#define GdiWorldSpaceToDeviceSpace   0x204
 
#define DCB_WINDOWMGR   0x8000 /* Queries the Windows bounding rectangle instead of the application's */
 
#define META_EOF   0x0000
 
#define METAFILE_MEMORY   1
 
#define METAFILE_DISK   2
 
#define MFHEADERSIZE   (sizeof(METAHEADER))
 
#define MFVERSION   0x300
 
#define LDC_LDC   0x00000001
 
#define LDC_EMFLDC   0x00000002
 
#define WMFC_MAGIC   0x43464d57
 
#define EMR_SETLINKEDUFI   119
 
#define DIB_PAL_MONO   2
 
#define GdiWorldSpaceToDeviceSpace   0x204
 
#define GDIRealizePalette   RealizePalette
 
#define GDISelectPalette   SelectPalette
 
#define get_full_gdi_handle   GdiFixUpHandle
 
#define DbgRaiseAssertionFailure()   __int2c()
 
#define ASSERT(x)   if (!(x)) DbgRaiseAssertionFailure()
 

Typedefs

typedef enum GDILoObjType GDILOOBJTYPE
 
typedef enum GDILoObjTypePGDILOOBJTYPE
 
typedef struct EMRSETTEXTJUSTIFICATIONPEMRSETTEXTJUSTIFICATION
 
typedef struct tagEMRESCAPE EMRESCAPE
 
typedef struct tagEMRESCAPEPEMRESCAPE
 
typedef struct tagEMRESCAPE EMRNAMEDESCAPE
 
typedef struct tagEMRESCAPEPEMRNAMEDESCAPE
 
typedef struct emfPEMF
 
typedef struct tagWINEDC WINEDC
 
typedef struct tagWINEDC DC
 

Enumerations

enum  GDILoObjType {
  GDILoObjType_LO_BRUSH_TYPE = 0x100000 , GDILoObjType_LO_DC_TYPE = 0x10000 , GDILoObjType_LO_BITMAP_TYPE = 0x50000 , GDILoObjType_LO_PALETTE_TYPE = 0x80000 ,
  GDILoObjType_LO_FONT_TYPE = 0xa0000 , GDILoObjType_LO_REGION_TYPE = 0x40000 , GDILoObjType_LO_ICMLCS_TYPE = 0x90000 , GDILoObjType_LO_CLIENTOBJ_TYPE = 0x60000 ,
  GDILoObjType_LO_UMPD_TYPE = 0x110000 , GDILoObjType_LO_META_TYPE = 0x150000 , GDILoObjType_LO_ALTDC_TYPE = 0x210000 , GDILoObjType_LO_PEN_TYPE = 0x300000 ,
  GDILoObjType_LO_EXTPEN_TYPE = 0x500000 , GDILoObjType_LO_DIBSECTION_TYPE = 0x250000 , GDILoObjType_LO_METAFILE16_TYPE = 0x260000 , GDILoObjType_LO_METAFILE_TYPE = 0x460000 ,
  GDILoObjType_LO_METADC16_TYPE = 0x660000 , GDILoObjType_LO_BRUSH_TYPE = 0x100000 , GDILoObjType_LO_DC_TYPE = 0x10000 , GDILoObjType_LO_BITMAP_TYPE = 0x50000 ,
  GDILoObjType_LO_PALETTE_TYPE = 0x80000 , GDILoObjType_LO_FONT_TYPE = 0xa0000 , GDILoObjType_LO_REGION_TYPE = 0x40000 , GDILoObjType_LO_ICMLCS_TYPE = 0x90000 ,
  GDILoObjType_LO_CLIENTOBJ_TYPE = 0x60000 , GDILoObjType_LO_UMPD_TYPE = 0x110000 , GDILoObjType_LO_META_TYPE = 0x150000 , GDILoObjType_LO_ALTDC_TYPE = 0x210000 ,
  GDILoObjType_LO_PEN_TYPE = 0x300000 , GDILoObjType_LO_EXTPEN_TYPE = 0x500000 , GDILoObjType_LO_DIBSECTION_TYPE = 0x250000 , GDILoObjType_LO_METAFILE16_TYPE = 0x260000 ,
  GDILoObjType_LO_METAFILE_TYPE = 0x460000 , GDILoObjType_LO_METADC16_TYPE = 0x660000
}
 

Functions

HRGN APIENTRY NtGdiPathToRegion (_In_ HDC hdc)
 
HDC APIENTRY NtGdiCreateMetafileDC (_In_ HDC hdc)
 
BOOL APIENTRY NtGdiGetTransform (_In_ HDC hdc, _In_ DWORD iXform, _Out_ LPXFORM pxf)
 
BOOL WINAPI GetBoundsRectAlt (HDC hdc, LPRECT prc, UINT flags)
 
BOOL WINAPI SetBoundsRectAlt (HDC hdc, LPRECT prc, UINT flags)
 
HGDIOBJ WINAPI GdiCreateClientObj (_In_ PVOID pvObject, _In_ GDILOOBJTYPE eObjType)
 
PVOID WINAPI GdiGetClientObjLink (_In_ HGDIOBJ hobj)
 
PVOID WINAPI GdiDeleteClientObj (_In_ HGDIOBJ hobj)
 
INT WINAPI NamedEscape (HDC, PWCHAR, INT, INT, LPSTR, INT, LPSTR)
 
static BOOL is_meta_dc (HDC hdc)
 
BOOL get_brush_bitmap_info (HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage) DECLSPEC_HIDDEN
 
DCalloc_dc_ptr (WORD magic) DECLSPEC_HIDDEN
 
void free_dc_ptr (DC *dc) DECLSPEC_HIDDEN
 
DCget_dc_ptr (HDC hdc) DECLSPEC_HIDDEN
 
void release_dc_ptr (DC *dc) DECLSPEC_HIDDEN
 
int bitmap_info_size (const BITMAPINFO *info, WORD coloruse) DECLSPEC_HIDDEN
 
HENHMETAFILE EMF_Create_HENHMETAFILE (ENHMETAHEADER *emh, DWORD filesize, BOOL on_disk) DECLSPEC_HIDDEN
 
HGDIOBJ alloc_gdi_handle (void *obj, WORD type, const struct gdi_obj_funcs *funcs) DECLSPEC_HIDDEN
 
voidfree_gdi_handle (HGDIOBJ handle) DECLSPEC_HIDDEN
 
HGDIOBJ get_full_gdi_handle (HGDIOBJ handle) DECLSPEC_HIDDEN
 
voidGDI_GetObjPtr (HGDIOBJ, WORD) DECLSPEC_HIDDEN
 
void GDI_ReleaseObj (HGDIOBJ) DECLSPEC_HIDDEN
 
void GDI_hdc_using_object (HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN
 
void GDI_hdc_not_using_object (HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN
 
HMETAFILE MF_Create_HMETAFILE (METAHEADER *mh) DECLSPEC_HIDDEN
 
METAHEADERMF_CreateMetaHeaderDisk (METAHEADER *mr, LPCVOID filename, BOOL unicode) DECLSPEC_HIDDEN
 
HPALETTE WINAPI GDISelectPalette (HDC hdc, HPALETTE hpal, WORD wBkg) DECLSPEC_HIDDEN
 
UINT WINAPI GDIRealizePalette (HDC hdc) DECLSPEC_HIDDEN
 
DWORD WINAPI GetDCDWord (_In_ HDC hdc, _In_ UINT u, _In_ DWORD dwError)
 
BOOL WINAPI SetVirtualResolution (HDC hdc, DWORD horz_res, DWORD vert_res, DWORD horz_size, DWORD vert_size)
 
static int get_dib_stride (int width, int bpp)
 
static int get_dib_image_size (const BITMAPINFO *info)
 
static int get_dib_info_size (const BITMAPINFO *info, UINT coloruse)
 
HGDIOBJ WINAPI GdiFixUpHandle (HGDIOBJ hGdiObj)
 
BOOL EMFDRV_LineTo (WINEDC *dc, INT x, INT y)
 
BOOL EMFDRV_RoundRect (WINEDC *dc, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height)
 
BOOL EMFDRV_ArcChordPie (WINEDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend, DWORD type)
 
BOOL EMFDRV_Arc (WINEDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
 
BOOL EMFDRV_ArcTo (WINEDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
 
BOOL EMFDRV_Pie (WINEDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
 
BOOL EMFDRV_Chord (WINEDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
 
BOOL EMFDRV_Ellipse (WINEDC *dc, INT left, INT top, INT right, INT bottom)
 
BOOL EMFDRV_Rectangle (WINEDC *dc, INT left, INT top, INT right, INT bottom)
 
COLORREF EMFDRV_SetPixel (WINEDC *dc, INT x, INT y, COLORREF color)
 
BOOL EMFDRV_PolylineTo (WINEDC *dc, const POINT *pt, INT count)
 
BOOL EMFDRV_PolyBezier (WINEDC *dc, const POINT *pts, DWORD count)
 
BOOL EMFDRV_PolyBezierTo (WINEDC *dc, const POINT *pts, DWORD count)
 
BOOL EMFDRV_PolyPolyline (WINEDC *dc, const POINT *pt, const DWORD *counts, UINT polys)
 
BOOL EMFDRV_PolyPolygon (WINEDC *dc, const POINT *pt, const INT *counts, UINT polys)
 
BOOL EMFDRV_PolyDraw (WINEDC *dc, const POINT *pts, const BYTE *types, DWORD count)
 
BOOL EMFDRV_FillRgn (WINEDC *dc, HRGN hrgn, HBRUSH hbrush)
 
BOOL EMFDRV_FrameRgn (WINEDC *dc, HRGN hrgn, HBRUSH hbrush, INT width, INT height)
 
BOOL EMFDRV_InvertRgn (WINEDC *dc, HRGN hrgn)
 
BOOL EMFDRV_ExtTextOut (WINEDC *dc, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx)
 
BOOL EMFDRV_GradientFill (WINEDC *dc, TRIVERTEX *vert_array, ULONG nvert, void *grad_array, ULONG ngrad, ULONG mode)
 
BOOL EMFDRV_FillPath (WINEDC *dc)
 
BOOL EMFDRV_StrokeAndFillPath (WINEDC *dc)
 
BOOL EMFDRV_StrokePath (WINEDC *dc)
 
BOOL EMFDRV_AlphaBlend (WINEDC *dc_dst, INT x_dst, INT y_dst, INT width_dst, INT height_dst, HDC dc_src, INT x_src, INT y_src, INT width_src, INT height_src, BLENDFUNCTION func)
 
BOOL EMFDRV_PatBlt (WINEDC *dc, INT left, INT top, INT width, INT height, DWORD rop)
 
INT EMFDRV_StretchDIBits (WINEDC *dc, INT x_dst, INT y_dst, INT width_dst, INT height_dst, INT x_src, INT y_src, INT width_src, INT height_src, const void *bits, BITMAPINFO *info, UINT wUsage, DWORD dwRop)
 
INT EMFDRV_SetDIBitsToDevice (WINEDC *dc, INT x_dst, INT y_dst, DWORD width, DWORD height, INT x_src, INT y_src, UINT startscan, UINT lines, const void *bits, BITMAPINFO *info, UINT usage)
 
HBITMAP EMFDRV_SelectBitmap (WINEDC *dc, HBITMAP hbitmap)
 

Macro Definition Documentation

◆ ASSERT

#define ASSERT (   x)    if (!(x)) DbgRaiseAssertionFailure()

Definition at line 242 of file gdi_private.h.

◆ DbgRaiseAssertionFailure

#define DbgRaiseAssertionFailure ( )    __int2c()

Definition at line 238 of file gdi_private.h.

◆ DCB_WINDOWMGR

#define DCB_WINDOWMGR   0x8000 /* Queries the Windows bounding rectangle instead of the application's */

Definition at line 62 of file gdi_private.h.

◆ DIB_PAL_MONO

#define DIB_PAL_MONO   2

Definition at line 196 of file gdi_private.h.

◆ EMR_SETLINKEDUFI

#define EMR_SETLINKEDUFI   119

Definition at line 193 of file gdi_private.h.

◆ GDI_HANDLE_GET_TYPE

#define GDI_HANDLE_GET_TYPE (   h)     (((ULONG_PTR)(h)) & GDI_HANDLE_TYPE_MASK)

Definition at line 54 of file gdi_private.h.

◆ GDI_HANDLE_TYPE_MASK

#define GDI_HANDLE_TYPE_MASK   0x007f0000

Definition at line 53 of file gdi_private.h.

◆ GDIRealizePalette

#define GDIRealizePalette   RealizePalette

Definition at line 225 of file gdi_private.h.

◆ GDISelectPalette

#define GDISelectPalette   SelectPalette

Definition at line 226 of file gdi_private.h.

◆ GdiWorldSpaceToDeviceSpace [1/2]

#define GdiWorldSpaceToDeviceSpace   0x204

Definition at line 221 of file gdi_private.h.

◆ GdiWorldSpaceToDeviceSpace [2/2]

#define GdiWorldSpaceToDeviceSpace   0x204

Definition at line 221 of file gdi_private.h.

◆ get_full_gdi_handle

#define get_full_gdi_handle   GdiFixUpHandle

Definition at line 229 of file gdi_private.h.

◆ LDC_EMFLDC

#define LDC_EMFLDC   0x00000002

Definition at line 105 of file gdi_private.h.

◆ LDC_LDC

#define LDC_LDC   0x00000001

Definition at line 104 of file gdi_private.h.

◆ META_EOF

#define META_EOF   0x0000

Definition at line 71 of file gdi_private.h.

◆ METAFILE_DISK

#define METAFILE_DISK   2

Definition at line 75 of file gdi_private.h.

◆ METAFILE_MEMORY

#define METAFILE_MEMORY   1

Definition at line 74 of file gdi_private.h.

◆ MFHEADERSIZE

#define MFHEADERSIZE   (sizeof(METAHEADER))

Definition at line 76 of file gdi_private.h.

◆ MFVERSION

#define MFVERSION   0x300

Definition at line 77 of file gdi_private.h.

◆ WMFC_MAGIC

#define WMFC_MAGIC   0x43464d57

Definition at line 186 of file gdi_private.h.

Typedef Documentation

◆ DC

typedef struct tagWINEDC DC

◆ EMRESCAPE

◆ EMRNAMEDESCAPE

◆ GDILOOBJTYPE

◆ PEMF

typedef struct emf* PEMF

Definition at line 107 of file gdi_private.h.

◆ PEMRESCAPE

◆ PEMRNAMEDESCAPE

◆ PEMRSETTEXTJUSTIFICATION

◆ PGDILOOBJTYPE

◆ WINEDC

Enumeration Type Documentation

◆ GDILoObjType

Enumerator
GDILoObjType_LO_BRUSH_TYPE 
GDILoObjType_LO_DC_TYPE 
GDILoObjType_LO_BITMAP_TYPE 
GDILoObjType_LO_PALETTE_TYPE 
GDILoObjType_LO_FONT_TYPE 
GDILoObjType_LO_REGION_TYPE 
GDILoObjType_LO_ICMLCS_TYPE 
GDILoObjType_LO_CLIENTOBJ_TYPE 
GDILoObjType_LO_UMPD_TYPE 
GDILoObjType_LO_META_TYPE 
GDILoObjType_LO_ALTDC_TYPE 
GDILoObjType_LO_PEN_TYPE 
GDILoObjType_LO_EXTPEN_TYPE 
GDILoObjType_LO_DIBSECTION_TYPE 
GDILoObjType_LO_METAFILE16_TYPE 
GDILoObjType_LO_METAFILE_TYPE 
GDILoObjType_LO_METADC16_TYPE 
GDILoObjType_LO_BRUSH_TYPE 
GDILoObjType_LO_DC_TYPE 
GDILoObjType_LO_BITMAP_TYPE 
GDILoObjType_LO_PALETTE_TYPE 
GDILoObjType_LO_FONT_TYPE 
GDILoObjType_LO_REGION_TYPE 
GDILoObjType_LO_ICMLCS_TYPE 
GDILoObjType_LO_CLIENTOBJ_TYPE 
GDILoObjType_LO_UMPD_TYPE 
GDILoObjType_LO_META_TYPE 
GDILoObjType_LO_ALTDC_TYPE 
GDILoObjType_LO_PEN_TYPE 
GDILoObjType_LO_EXTPEN_TYPE 
GDILoObjType_LO_DIBSECTION_TYPE 
GDILoObjType_LO_METAFILE16_TYPE 
GDILoObjType_LO_METAFILE_TYPE 
GDILoObjType_LO_METADC16_TYPE 

Definition at line 31 of file gdi_private.h.

32{
44 GDILoObjType_LO_PEN_TYPE = 0x300000,
enum GDILoObjType * PGDILOOBJTYPE
@ GDILoObjType_LO_FONT_TYPE
Definition: gdi_private.h:37
@ GDILoObjType_LO_PALETTE_TYPE
Definition: gdi_private.h:36
@ GDILoObjType_LO_UMPD_TYPE
Definition: gdi_private.h:41
@ GDILoObjType_LO_CLIENTOBJ_TYPE
Definition: gdi_private.h:40
@ GDILoObjType_LO_BRUSH_TYPE
Definition: gdi_private.h:33
@ GDILoObjType_LO_BITMAP_TYPE
Definition: gdi_private.h:35
@ GDILoObjType_LO_METAFILE_TYPE
Definition: gdi_private.h:48
@ GDILoObjType_LO_METADC16_TYPE
Definition: gdi_private.h:49
@ GDILoObjType_LO_REGION_TYPE
Definition: gdi_private.h:38
@ GDILoObjType_LO_EXTPEN_TYPE
Definition: gdi_private.h:45
@ GDILoObjType_LO_METAFILE16_TYPE
Definition: gdi_private.h:47
@ GDILoObjType_LO_ICMLCS_TYPE
Definition: gdi_private.h:39
@ GDILoObjType_LO_DC_TYPE
Definition: gdi_private.h:34
@ GDILoObjType_LO_PEN_TYPE
Definition: gdi_private.h:44
@ GDILoObjType_LO_META_TYPE
Definition: gdi_private.h:42
@ GDILoObjType_LO_ALTDC_TYPE
Definition: gdi_private.h:43
@ GDILoObjType_LO_DIBSECTION_TYPE
Definition: gdi_private.h:46
enum GDILoObjType GDILOOBJTYPE

Function Documentation

◆ alloc_dc_ptr()

DC * alloc_dc_ptr ( WORD  magic)

Definition at line 106 of file rosglue.c.

107{
108 WINEDC* pWineDc;
109
110 /* Allocate the Wine DC */
111 pWineDc = HeapAlloc(GetProcessHeap(), 0, sizeof(*pWineDc));
112 if (pWineDc == NULL)
113 {
114 return NULL;
115 }
116
117 ZeroMemory(pWineDc, sizeof(*pWineDc));
119 pWineDc->hPen = GetStockObject(BLACK_PEN);
120
121 if (magic == OBJ_ENHMETADC)
122 {
123 /* We create a metafile DC, but we ignore the reference DC, this is
124 handled by the wine code */
125 pWineDc->hdc = NtGdiCreateMetafileDC(NULL);
126 if (pWineDc->hdc == NULL)
127 {
128 HeapFree(GetProcessHeap(), 0, pWineDc);
129 return NULL;
130 }
131
132 pWineDc->iType = LDC_EMFLDC;
133
134 /* Set the Wine DC as LDC */
135 GdiSetLDC(pWineDc->hdc, pWineDc);
136 }
137 else
138 {
139 // nothing else supported!
140 ASSERT(FALSE);
141 }
142
143 return pWineDc;
144}
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
BOOL FASTCALL GdiSetLDC(HDC hdc, PVOID pvLDC)
Definition: misc.c:802
#define LDC_EMFLDC
Definition: gdi_private.h:105
#define ASSERT(a)
Definition: mode.c:44
u32_t magic(void)
__kernel_entry W32KAPI HDC APIENTRY NtGdiCreateMetafileDC(_In_ HDC hdc)
#define OBJ_ENHMETADC
Definition: objidl.idl:1420
HBRUSH hBrush
Definition: gdi_private.h:128
#define ZeroMemory
Definition: winbase.h:1670
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WHITE_BRUSH
Definition: wingdi.h:902
#define BLACK_PEN
Definition: wingdi.h:903

Referenced by CreateEnhMetaFileW(), and MFDRV_AllocMetaFile().

◆ alloc_gdi_handle()

HGDIOBJ alloc_gdi_handle ( void obj,
WORD  type,
const struct gdi_obj_funcs funcs 
)

◆ bitmap_info_size()

int bitmap_info_size ( const BITMAPINFO info,
WORD  coloruse 
)

Definition at line 199 of file rosglue.c.

202{
203 unsigned int colors, size, masks = 0;
204
205 if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
206 {
207 const BITMAPCOREHEADER *core = (const BITMAPCOREHEADER *)info;
208 colors = (core->bcBitCount <= 8) ? 1 << core->bcBitCount : 0;
209 return sizeof(BITMAPCOREHEADER) + colors *
210 ((coloruse == DIB_RGB_COLORS) ? sizeof(RGBTRIPLE) : sizeof(WORD));
211 }
212 else /* assume BITMAPINFOHEADER */
213 {
214 if (info->bmiHeader.biClrUsed) colors = min( info->bmiHeader.biClrUsed, 256 );
215 else colors = info->bmiHeader.biBitCount > 8 ? 0 : 1 << info->bmiHeader.biBitCount;
216 if (info->bmiHeader.biCompression == BI_BITFIELDS) masks = 3;
217 size = max( info->bmiHeader.biSize, sizeof(BITMAPINFOHEADER) + masks * sizeof(DWORD) );
218 return size + colors * ((coloruse == DIB_RGB_COLORS) ? sizeof(RGBQUAD) : sizeof(WORD));
219 }
220}
ULONG RGBQUAD
Definition: precomp.h:50
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLsizeiptr size
Definition: glext.h:5919
#define BI_BITFIELDS
Definition: mmreg.h:507
static const BYTE masks[8]
Definition: dib.c:2760
#define min(a, b)
Definition: monoChain.cc:55
#define max(a, b)
Definition: svc.c:63
#define DIB_RGB_COLORS
Definition: wingdi.h:367
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

◆ EMF_Create_HENHMETAFILE()

HENHMETAFILE EMF_Create_HENHMETAFILE ( ENHMETAHEADER emh,
DWORD  filesize,
BOOL  on_disk 
)

Definition at line 259 of file enhmetafile.c.

260{
261 HENHMETAFILE hmf;
262 ENHMETAFILEOBJ *metaObj;
263
264 if (emh->iType != EMR_HEADER)
265 {
267 return 0;
268 }
269 if (emh->dSignature != ENHMETA_SIGNATURE ||
270 (emh->nBytes & 3)) /* refuse to load unaligned EMF as Windows does */
271 {
272 WARN("Invalid emf header type 0x%08x sig 0x%08x.\n",
273 emh->iType, emh->dSignature);
274 return 0;
275 }
276 if (filesize < emh->nBytes)
277 {
278 WARN("File truncated (got %u bytes, header says %u)\n", emh->nBytes, filesize);
279 return 0;
280 }
281
282 if (!(metaObj = HeapAlloc( GetProcessHeap(), 0, sizeof(*metaObj) ))) return 0;
283
284 metaObj->emh = emh;
285 metaObj->on_disk = on_disk;
286
287 if (!(hmf = alloc_gdi_handle( metaObj, OBJ_ENHMETAFILE, NULL )))
288 HeapFree( GetProcessHeap(), 0, metaObj );
289 return hmf;
290}
#define WARN(fmt,...)
Definition: debug.h:112
#define SetLastError(x)
Definition: compat.h:752
HGDIOBJ alloc_gdi_handle(void *obj, WORD type, const struct gdi_obj_funcs *funcs) DECLSPEC_HIDDEN
#define OBJ_ENHMETAFILE
Definition: objidl.idl:1421
ENHMETAHEADER * emh
Definition: enhmetafile.c:63
DWORD dSignature
Definition: wingdi.h:2324
#define ERROR_INVALID_DATA
Definition: winerror.h:116
#define ENHMETA_SIGNATURE
Definition: wingdi.h:204
#define EMR_HEADER
Definition: wingdi.h:75

Referenced by CloseEnhMetaFile(), CopyEnhMetaFileA(), CopyEnhMetaFileW(), EMF_GetEnhMetaFile(), and SetEnhMetaFileBits().

◆ EMFDRV_AlphaBlend()

BOOL EMFDRV_AlphaBlend ( WINEDC dc_dst,
INT  x_dst,
INT  y_dst,
INT  width_dst,
INT  height_dst,
HDC  dc_src,
INT  x_src,
INT  y_src,
INT  width_src,
INT  height_src,
BLENDFUNCTION  func 
)

Definition at line 394 of file emfdrv.c.

397{
398 /* FIXME: update bound rect */
399 return TRUE;
400}
#define TRUE
Definition: types.h:120

◆ EMFDRV_Arc()

BOOL EMFDRV_Arc ( WINEDC dc,
INT  left,
INT  top,
INT  right,
INT  bottom,
INT  xstart,
INT  ystart,
INT  xend,
INT  yend 
)

Definition at line 227 of file emfdrv.c.

229{
230 return EMFDRV_ArcChordPie( dc, left, top, right, bottom, xstart, ystart,
231 xend, yend, EMR_ARC );
232}
BOOL EMFDRV_ArcChordPie(WINEDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend, DWORD type)
Definition: emfdrv.c:120
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726
static const WCHAR dc[]
#define EMR_ARC
Definition: wingdi.h:119

◆ EMFDRV_ArcChordPie()

BOOL EMFDRV_ArcChordPie ( WINEDC dc,
INT  left,
INT  top,
INT  right,
INT  bottom,
INT  xstart,
INT  ystart,
INT  xend,
INT  yend,
DWORD  type 
)

Definition at line 120 of file emfdrv.c.

122{
123 INT temp, x_centre, y_centre, i;
124 double angle_start, angle_end;
125 double xinter_start, yinter_start, xinter_end, yinter_end;
126 EMRARC emr;
127 RECTL bounds;
128
129 if (left == right || top == bottom) return FALSE;
130
131 if (left > right) { temp = left; left = right; right = temp; }
132 if (top > bottom) { temp = top; top = bottom; bottom = temp; }
133
134 if (GetGraphicsMode(dc->hdc) == GM_COMPATIBLE)//dc->attr->graphics_mode == GM_COMPATIBLE)
135 {
136 right--;
137 bottom--;
138 }
139
140 emr.emr.iType = type;
141 emr.emr.nSize = sizeof(emr);
142 emr.rclBox.left = left;
143 emr.rclBox.top = top;
144 emr.rclBox.right = right;
145 emr.rclBox.bottom = bottom;
146 emr.ptlStart.x = xstart;
147 emr.ptlStart.y = ystart;
148 emr.ptlEnd.x = xend;
149 emr.ptlEnd.y = yend;
150
151 /* Now calculate the BBox */
152 x_centre = (left + right + 1) / 2;
153 y_centre = (top + bottom + 1) / 2;
154
155 xstart -= x_centre;
156 ystart -= y_centre;
157 xend -= x_centre;
158 yend -= y_centre;
159
160 /* invert y co-ords to get angle anti-clockwise from x-axis */
161 angle_start = atan2( -(double)ystart, (double)xstart );
162 angle_end = atan2( -(double)yend, (double)xend );
163
164 /* These are the intercepts of the start/end lines with the arc */
165 xinter_start = (right - left + 1)/2 * cos(angle_start) + x_centre;
166 yinter_start = -(bottom - top + 1)/2 * sin(angle_start) + y_centre;
167 xinter_end = (right - left + 1)/2 * cos(angle_end) + x_centre;
168 yinter_end = -(bottom - top + 1)/2 * sin(angle_end) + y_centre;
169
170 if (angle_start < 0) angle_start += 2 * M_PI;
171 if (angle_end < 0) angle_end += 2 * M_PI;
172 if (angle_end < angle_start) angle_end += 2 * M_PI;
173
174 bounds.left = min( xinter_start, xinter_end );
175 bounds.top = min( yinter_start, yinter_end );
176 bounds.right = max( xinter_start, xinter_end );
177 bounds.bottom = max( yinter_start, yinter_end );
178
179 for (i = 0; i <= 8; i++)
180 {
181 if(i * M_PI / 2 < angle_start) /* loop until we're past start */
182 continue;
183 if(i * M_PI / 2 > angle_end) /* if we're past end we're finished */
184 break;
185
186 /* the arc touches the rectangle at the start of quadrant i, so adjust
187 BBox to reflect this. */
188
189 switch(i % 4) {
190 case 0:
191 bounds.right = right;
192 break;
193 case 1:
194 bounds.top = top;
195 break;
196 case 2:
197 bounds.left = left;
198 break;
199 case 3:
200 bounds.bottom = bottom;
201 break;
202 }
203 }
204
205 /* If we're drawing a pie then make sure we include the centre */
206 if (type == EMR_PIE)
207 {
208 if (bounds.left > x_centre) bounds.left = x_centre;
209 else if (bounds.right < x_centre) bounds.right = x_centre;
210 if (bounds.top > y_centre) bounds.top = y_centre;
211 else if (bounds.bottom < y_centre) bounds.bottom = y_centre;
212 }
213 else if (type == EMR_ARCTO)
214 {
215 POINT pt;
216 //pt = dc->attr->cur_pos;
217 GetCurrentPositionEx(dc->hdc, &pt);
218 bounds.left = min( bounds.left, pt.x );
219 bounds.top = min( bounds.top, pt.y );
220 bounds.right = max( bounds.right, pt.x );
221 bounds.bottom = max( bounds.bottom, pt.y );
222 }
223 emfdrv_update_bounds( dc, &bounds );
224 return TRUE;
225}
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
valarray< _Tp > atan2(const valarray< _Tp > &__x, const valarray< _Tp > &__y)
Definition: _valarray.h:928
#define pt(x, y)
Definition: drawing.c:79
static void emfdrv_update_bounds(WINEDC *dc, RECTL *rect)
Definition: emfdrv.c:46
#define M_PI
Definition: emfdrv.c:43
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static calc_node_t temp
Definition: rpn_ieee.c:38
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
POINTL ptlStart
Definition: wingdi.h:1717
RECTL rclBox
Definition: wingdi.h:1716
POINTL ptlEnd
Definition: wingdi.h:1718
EMR emr
Definition: wingdi.h:1715
DWORD iType
Definition: wingdi.h:1690
DWORD nSize
Definition: wingdi.h:1691
int32_t INT
Definition: typedefs.h:58
#define GM_COMPATIBLE
Definition: wingdi.h:864
int WINAPI GetGraphicsMode(_In_ HDC)
BOOL WINAPI GetCurrentPositionEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:241
#define EMR_PIE
Definition: wingdi.h:121
#define EMR_ARCTO
Definition: wingdi.h:129

Referenced by EMFDC_ArcChordPie(), EMFDRV_Arc(), EMFDRV_ArcTo(), EMFDRV_Chord(), and EMFDRV_Pie().

◆ EMFDRV_ArcTo()

BOOL EMFDRV_ArcTo ( WINEDC dc,
INT  left,
INT  top,
INT  right,
INT  bottom,
INT  xstart,
INT  ystart,
INT  xend,
INT  yend 
)

Definition at line 234 of file emfdrv.c.

236{
237 return EMFDRV_ArcChordPie( dc, left, top, right, bottom, xstart, ystart,
238 xend, yend, EMR_ARCTO );
239}

◆ EMFDRV_Chord()

BOOL EMFDRV_Chord ( WINEDC dc,
INT  left,
INT  top,
INT  right,
INT  bottom,
INT  xstart,
INT  ystart,
INT  xend,
INT  yend 
)

Definition at line 248 of file emfdrv.c.

250{
251 return EMFDRV_ArcChordPie( dc, left, top, right, bottom, xstart, ystart,
252 xend, yend, EMR_CHORD );
253}
#define EMR_CHORD
Definition: wingdi.h:120

◆ EMFDRV_Ellipse()

BOOL EMFDRV_Ellipse ( WINEDC dc,
INT  left,
INT  top,
INT  right,
INT  bottom 
)

Definition at line 255 of file emfdrv.c.

256{
257 RECTL bounds;
258
259 if (left == right || top == bottom) return FALSE;
260
261 bounds.left = min( left, right );
262 bounds.top = min( top, bottom );
263 bounds.right = max( left, right );
264 bounds.bottom = max( top, bottom );
265 if (GetGraphicsMode(dc->hdc) == GM_COMPATIBLE)//dc->attr->graphics_mode == GM_COMPATIBLE)
266 {
267 bounds.right--;
268 bounds.bottom--;
269 }
270
271 emfdrv_update_bounds( dc, &bounds );
272 return TRUE;
273}

Referenced by EMFDC_Ellipse().

◆ EMFDRV_ExtTextOut()

BOOL EMFDRV_ExtTextOut ( WINEDC dc,
INT  x,
INT  y,
UINT  flags,
const RECT lprect,
LPCWSTR  str,
UINT  count,
const INT lpDx 
)

Definition at line 362 of file emfdrv.c.

364{
365 /* FIXME: update bounding rect */
366 return TRUE;
367}

◆ EMFDRV_FillPath()

BOOL EMFDRV_FillPath ( WINEDC dc)

Definition at line 376 of file emfdrv.c.

377{
378 /* FIXME: update bound rect */
379 return TRUE;
380}

◆ EMFDRV_FillRgn()

BOOL EMFDRV_FillRgn ( WINEDC dc,
HRGN  hrgn,
HBRUSH  hbrush 
)

Definition at line 344 of file emfdrv.c.

345{
346 /* FIXME: update bounding rect */
347 return TRUE;
348}

◆ EMFDRV_FrameRgn()

BOOL EMFDRV_FrameRgn ( WINEDC dc,
HRGN  hrgn,
HBRUSH  hbrush,
INT  width,
INT  height 
)

Definition at line 350 of file emfdrv.c.

351{
352 /* FIXME: update bounding rect */
353 return TRUE;
354}

◆ EMFDRV_GradientFill()

BOOL EMFDRV_GradientFill ( WINEDC dc,
TRIVERTEX vert_array,
ULONG  nvert,
void grad_array,
ULONG  ngrad,
ULONG  mode 
)

Definition at line 369 of file emfdrv.c.

371{
372 /* FIXME: update bounding rect */
373 return TRUE;
374}

◆ EMFDRV_InvertRgn()

BOOL EMFDRV_InvertRgn ( WINEDC dc,
HRGN  hrgn 
)

Definition at line 356 of file emfdrv.c.

357{
358 /* FIXME: update bounding rect */
359 return TRUE;
360}

◆ EMFDRV_LineTo()

BOOL EMFDRV_LineTo ( WINEDC dc,
INT  x,
INT  y 
)

Definition at line 83 of file emfdrv.c.

84{
85 RECTL bounds;
86 POINT pt;
87
88 //pt = dc->attr->cur_pos;
90
91 bounds.left = min( x, pt.x );
92 bounds.top = min( y, pt.y );
93 bounds.right = max( x, pt.x );
94 bounds.bottom = max( y, pt.y );
95 emfdrv_update_bounds( dc, &bounds );
96 return TRUE;
97}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by EMFDC_LineTo().

◆ EMFDRV_PatBlt()

BOOL EMFDRV_PatBlt ( WINEDC dc,
INT  left,
INT  top,
INT  width,
INT  height,
DWORD  rop 
)

Definition at line 402 of file emfdrv.c.

403{
404 /* FIXME: update bound rect */
405 return TRUE;
406}

◆ EMFDRV_Pie()

BOOL EMFDRV_Pie ( WINEDC dc,
INT  left,
INT  top,
INT  right,
INT  bottom,
INT  xstart,
INT  ystart,
INT  xend,
INT  yend 
)

Definition at line 241 of file emfdrv.c.

243{
244 return EMFDRV_ArcChordPie( dc, left, top, right, bottom, xstart, ystart,
245 xend, yend, EMR_PIE );
246}

◆ EMFDRV_PolyBezier()

BOOL EMFDRV_PolyBezier ( WINEDC dc,
const POINT pts,
DWORD  count 
)

Definition at line 311 of file emfdrv.c.

312{
313 /* FIXME: update bounding rect */
314 return TRUE;
315}

◆ EMFDRV_PolyBezierTo()

BOOL EMFDRV_PolyBezierTo ( WINEDC dc,
const POINT pts,
DWORD  count 
)

Definition at line 317 of file emfdrv.c.

318{
319 /* FIXME: update bounding rect */
320 return TRUE;
321}

◆ EMFDRV_PolyDraw()

BOOL EMFDRV_PolyDraw ( WINEDC dc,
const POINT pts,
const BYTE types,
DWORD  count 
)

Definition at line 337 of file emfdrv.c.

339{
340 /* FIXME: update bounding rect */
341 return TRUE;
342}

◆ EMFDRV_PolylineTo()

BOOL EMFDRV_PolylineTo ( WINEDC dc,
const POINT pt,
INT  count 
)

Definition at line 305 of file emfdrv.c.

306{
307 /* FIXME: update bounding rect */
308 return TRUE;
309}

◆ EMFDRV_PolyPolygon()

BOOL EMFDRV_PolyPolygon ( WINEDC dc,
const POINT pt,
const INT counts,
UINT  polys 
)

Definition at line 330 of file emfdrv.c.

332{
333 /* FIXME: update bounding rect */
334 return TRUE;
335}

◆ EMFDRV_PolyPolyline()

BOOL EMFDRV_PolyPolyline ( WINEDC dc,
const POINT pt,
const DWORD counts,
UINT  polys 
)

Definition at line 323 of file emfdrv.c.

325{
326 /* FIXME: update bounding rect */
327 return TRUE;
328}

◆ EMFDRV_Rectangle()

BOOL EMFDRV_Rectangle ( WINEDC dc,
INT  left,
INT  top,
INT  right,
INT  bottom 
)

Definition at line 275 of file emfdrv.c.

276{
277 RECTL bounds;
278
279 if (left == right || top == bottom) return FALSE;
280
281 bounds.left = min( left, right );
282 bounds.top = min( top, bottom );
283 bounds.right = max( left, right );
284 bounds.bottom = max( top, bottom );
285 if (GetGraphicsMode(dc->hdc) == GM_COMPATIBLE)//dc->attr->graphics_mode == GM_COMPATIBLE)
286 {
287 bounds.right--;
288 bounds.bottom--;
289 }
290
291 emfdrv_update_bounds( dc, &bounds );
292 return TRUE;
293}

Referenced by EMFDC_Rectangle().

◆ EMFDRV_RoundRect()

BOOL EMFDRV_RoundRect ( WINEDC dc,
INT  left,
INT  top,
INT  right,
INT  bottom,
INT  ell_width,
INT  ell_height 
)

Definition at line 99 of file emfdrv.c.

101{
102 RECTL bounds;
103
104 if (left == right || top == bottom) return FALSE;
105
106 bounds.left = min( left, right );
107 bounds.top = min( top, bottom );
108 bounds.right = max( left, right );
109 bounds.bottom = max( top, bottom );
110 if (GetGraphicsMode(dc->hdc) == GM_COMPATIBLE)//dc->attr->graphics_mode == GM_COMPATIBLE)
111 {
112 bounds.right--;
113 bounds.bottom--;
114 }
115
116 emfdrv_update_bounds( dc, &bounds );
117 return TRUE;
118}

Referenced by EMFDC_RoundRect().

◆ EMFDRV_SelectBitmap()

HBITMAP EMFDRV_SelectBitmap ( WINEDC dc,
HBITMAP  hbitmap 
)

Definition at line 426 of file emfdrv.c.

427{
428 return 0;
429}

◆ EMFDRV_SetDIBitsToDevice()

INT EMFDRV_SetDIBitsToDevice ( WINEDC dc,
INT  x_dst,
INT  y_dst,
DWORD  width,
DWORD  height,
INT  x_src,
INT  y_src,
UINT  startscan,
UINT  lines,
const void bits,
BITMAPINFO info,
UINT  usage 
)

Definition at line 417 of file emfdrv.c.

421{
422 /* FIXME: Update bound rect */
423 return lines;
424}
eMaj lines
Definition: tritemp.h:206

◆ EMFDRV_SetPixel()

COLORREF EMFDRV_SetPixel ( WINEDC dc,
INT  x,
INT  y,
COLORREF  color 
)

Definition at line 295 of file emfdrv.c.

296{
297 RECTL bounds;
298
299 bounds.left = bounds.right = x;
300 bounds.top = bounds.bottom = y;
301 emfdrv_update_bounds( dc, &bounds );
302 return CLR_INVALID;
303}
#define CLR_INVALID
Definition: wingdi.h:883

Referenced by EMFDC_SetPixel().

◆ EMFDRV_StretchDIBits()

INT EMFDRV_StretchDIBits ( WINEDC dc,
INT  x_dst,
INT  y_dst,
INT  width_dst,
INT  height_dst,
INT  x_src,
INT  y_src,
INT  width_src,
INT  height_src,
const void bits,
BITMAPINFO info,
UINT  wUsage,
DWORD  dwRop 
)

Definition at line 408 of file emfdrv.c.

412{
413 /* FIXME: Update bound rect */
414 return height_src;
415}

◆ EMFDRV_StrokeAndFillPath()

BOOL EMFDRV_StrokeAndFillPath ( WINEDC dc)

Definition at line 382 of file emfdrv.c.

383{
384 /* FIXME: update bound rect */
385 return TRUE;
386}

◆ EMFDRV_StrokePath()

BOOL EMFDRV_StrokePath ( WINEDC dc)

Definition at line 388 of file emfdrv.c.

389{
390 /* FIXME: update bound rect */
391 return TRUE;
392}

◆ free_dc_ptr()

◆ free_gdi_handle()

void * free_gdi_handle ( HGDIOBJ  handle)

Definition at line 59 of file rosglue.c.

60{
61 /* Should be a client object */
62 return GdiDeleteClientObj(hobj);
63}
PVOID WINAPI GdiDeleteClientObj(_In_ HGDIOBJ hobj)
Definition: clientobj.c:173

Referenced by DeleteMetaFile(), and EMF_Delete_HENHMETAFILE().

◆ GDI_GetObjPtr()

void * GDI_GetObjPtr ( HGDIOBJ  hobj,
WORD  wType 
)

Definition at line 66 of file rosglue.c.

69{
70 GDILOOBJTYPE eObjType;
71
72 /* Check if the object type matches */
73 eObjType = ConvertObjectType(wType);
74 if ((eObjType == 0) || (GDI_HANDLE_GET_TYPE(hobj) != eObjType))
75 {
76 return NULL;
77 }
78
79 /* Check if we have an ALTDC */
80 if (eObjType == GDILoObjType_LO_ALTDC_TYPE)
81 {
82 /* Object is stored as LDC */
83 return GdiGetLDC(hobj);
84 }
85
86 /* Check for client objects */
87 if ((eObjType == GDILoObjType_LO_METAFILE_TYPE) ||
88 (eObjType == GDILoObjType_LO_METAFILE16_TYPE) ||
90 {
91 return GdiGetClientObjLink(hobj);
92 }
93
94 /* This should never happen! */
96 return NULL;
97}
PVOID WINAPI GdiGetClientObjLink(_In_ HGDIOBJ hobj)
Definition: clientobj.c:61
PLDC FASTCALL GdiGetLDC(HDC hDC)
Definition: misc.c:785
static GDILOOBJTYPE ConvertObjectType(WORD wType)
Definition: rosglue.c:11
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31

Referenced by EMF_GetEnhMetaHeader(), get_metafile_bits(), and GetMetaFileBitsEx().

◆ GDI_hdc_not_using_object()

void GDI_hdc_not_using_object ( HGDIOBJ  obj,
HDC  hdc 
)

Definition at line 182 of file rosglue.c.

185{
186 HDC hdcLink;
187
188 /* Remove the HDC link for the object */
189 hdcLink = GdiRemoveClientObjLink(hobj);
190 ASSERT(hdcLink == hdc);
191}
PVOID WINAPI GdiRemoveClientObjLink(_In_ HGDIOBJ hobj)
Definition: clientobj.c:98
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92

Referenced by EMFDC_DeleteDC(), EMFDRV_DeleteDC(), metadc_free(), and MFDRV_DeleteDC().

◆ GDI_hdc_using_object()

void GDI_hdc_using_object ( HGDIOBJ  obj,
HDC  hdc 
)

Definition at line 166 of file rosglue.c.

169{
170 /* Record that we have an object in use by a METADC. We simply link the
171 object to the HDC that we use. Wine API does not give us a way to
172 respond to failure, so we silently ignore it */
173 if (!GdiCreateClientObjLink(hobj, hdc))
174 {
175 /* Ignore failure, and return */
176 DPRINT1("Failed to create link for selected METADC object.\n");
177 return;
178 }
179}
#define DPRINT1
Definition: precomp.h:8
BOOL WINAPI GdiCreateClientObjLink(_In_ HGDIOBJ hobj, _In_ PVOID pvObject)
Definition: clientobj.c:24

Referenced by emfdc_select_brush(), emfdc_select_font(), emfdc_select_pen(), EMFDC_SelectPalette(), EMFDC_SetDCBrushColor(), EMFDC_SetDCPenColor(), EMFDRV_SelectBrush(), EMFDRV_SelectFont(), EMFDRV_SelectPalette(), EMFDRV_SelectPen(), EMFDRV_SetDCBrushColor(), EMFDRV_SetDCPenColor(), METADC_SelectBrush(), METADC_SelectFont(), METADC_SelectPen(), MFDRV_SelectBrush(), MFDRV_SelectFont(), and MFDRV_SelectPen().

◆ GDI_ReleaseObj()

void GDI_ReleaseObj ( HGDIOBJ  hobj)

Definition at line 100 of file rosglue.c.

101{
102 /* We don't do any reference-counting */
103}

Referenced by EMF_GetEnhMetaHeader(), get_metafile_bits(), and GetMetaFileBitsEx().

◆ GdiCreateClientObj()

HGDIOBJ WINAPI GdiCreateClientObj ( _In_ PVOID  pvObject,
_In_ GDILOOBJTYPE  eObjType 
)

Definition at line 148 of file clientobj.c.

151{
152 HGDIOBJ hobj;
153
154 /* Call win32k to create a client object handle */
155 hobj = NtGdiCreateClientObj(eObjType);
156 if (hobj == NULL)
157 {
158 return NULL;
159 }
160
161 /* Create the client object link */
162 if (!GdiCreateClientObjLink(hobj, pvObject))
163 {
165 return NULL;
166 }
167
168 return hobj;
169}
BOOL WINAPI GdiCreateClientObjLink(_In_ HGDIOBJ hobj, _In_ PVOID pvObject)
Definition: clientobj.c:24
__kernel_entry W32KAPI HANDLE APIENTRY NtGdiCreateClientObj(_In_ ULONG ulType)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiDeleteClientObj(_In_ HANDLE h)

◆ GdiDeleteClientObj()

PVOID WINAPI GdiDeleteClientObj ( _In_ HGDIOBJ  hobj)

Definition at line 173 of file clientobj.c.

175{
176 PVOID pvObject;
177
178 /* Remove the client object link */
179 pvObject = GdiRemoveClientObjLink(hobj);
180 if (pvObject == NULL)
181 {
182 return NULL;
183 }
184
185 /* Call win32k to delete the handle */
186 if (!NtGdiDeleteClientObj(hobj))
187 {
188 ASSERT(FALSE);
189 }
190
191 return pvObject;
192}
PVOID WINAPI GdiRemoveClientObjLink(_In_ HGDIOBJ hobj)
Definition: clientobj.c:98

◆ GdiFixUpHandle()

HGDIOBJ WINAPI GdiFixUpHandle ( HGDIOBJ  hGdiObj)

Definition at line 734 of file misc.c.

735{
737
738 if (GDI_HANDLE_GET_UPPER(hGdiObj))
739 {
740 return hGdiObj;
741 }
742
743 /* FIXME is this right ?? */
744
746
747 /* Rebuild handle for Object */
748 return (HGDIOBJ)(((ULONG_PTR)(hGdiObj)) | (Entry->Type << GDI_ENTRY_UPPER_SHIFT));
749}
#define ULONG_PTR
Definition: config.h:101
#define GDI_HANDLE_GET_UPPER(h)
Definition: gdi.h:43
#define GDI_HANDLE_GET_INDEX(h)
Definition: gdi.h:28
#define GDI_ENTRY_UPPER_SHIFT
Definition: ntgdihdl.h:35
base of all file and directory entries
Definition: entries.h:83
Definition: gdi.h:2
PGDI_TABLE_ENTRY GdiHandleTable
Definition: misc.c:33

◆ GdiGetClientObjLink()

PVOID WINAPI GdiGetClientObjLink ( _In_ HGDIOBJ  hobj)

Definition at line 61 of file clientobj.c.

63{
64 ULONG iHashIndex;
65 PCLIENTOBJLINK pcol;
66 PVOID pvObject = NULL;
67
68 /* Calculate the hash index */
69 iHashIndex = (ULONG_PTR)hobj % _countof(gapcolHashTable);
70
71 /* Enter the critical section */
73
74 /* Loop the link entries in this hash bucket */
75 pcol = gapcolHashTable[iHashIndex];
76 while (pcol != NULL)
77 {
78 /* Check if this is the object we want */
79 if (pcol->hobj == hobj)
80 {
81 /* Get the object pointer and bail out */
82 pvObject = pcol->pvObj;
83 break;
84 }
85
86 /* Go to the next entry */
87 pcol = pcol->pcolNext;
88 }
89
90 /* Leave the critical section */
92
93 return pvObject;
94}
PCLIENTOBJLINK gapcolHashTable[127]
Definition: clientobj.c:20
CRITICAL_SECTION gcsClientObjLinks
Definition: clientobj.c:10
unsigned int ULONG
Definition: retypes.h:1
#define _countof(array)
Definition: sndvol32.h:68
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

◆ GDIRealizePalette()

UINT WINAPI GDIRealizePalette ( HDC  hdc)

◆ GDISelectPalette()

HPALETTE WINAPI GDISelectPalette ( HDC  hdc,
HPALETTE  hpal,
WORD  wBkg 
)

◆ get_brush_bitmap_info()

BOOL get_brush_bitmap_info ( HBRUSH  handle,
BITMAPINFO info,
void bits,
UINT usage 
)

◆ get_dc_ptr()

DC * get_dc_ptr ( HDC  hdc)

Definition at line 147 of file rosglue.c.

148{
149 /* Check for EMF DC */
151 {
152 /* The Wine DC is stored as the LDC */
153 return (WINEDC*)GdiGetLDC(hdc);
154 }
155
156 /* Check for METADC16 */
158 {
159 return GdiGetClientObjLink(hdc);
160 }
161
162 return NULL;
163}

Referenced by CloseEnhMetaFile(), emfdc_delete_object(), EMFDC_GdiComment(), EMFDC_MaskBlt(), EMFDC_PlgBlt(), emfdrv_stretchblt(), and MFDRV_CloseMetaFile().

◆ get_dib_image_size()

static int get_dib_image_size ( const BITMAPINFO info)
inlinestatic

Definition at line 205 of file gdi_private.h.

206{
207 return get_dib_stride( info->bmiHeader.biWidth, info->bmiHeader.biBitCount )
208 * abs( info->bmiHeader.biHeight );
209}
#define abs(i)
Definition: fconv.c:206
static int get_dib_stride(int width, int bpp)
Definition: gdi_private.h:200

◆ get_dib_info_size()

static int get_dib_info_size ( const BITMAPINFO info,
UINT  coloruse 
)
inlinestatic

Definition at line 212 of file gdi_private.h.

213{
214 if (info->bmiHeader.biCompression == BI_BITFIELDS)
215 return sizeof(BITMAPINFOHEADER) + 3 * sizeof(DWORD);
216 if (coloruse == DIB_PAL_COLORS)
217 return sizeof(BITMAPINFOHEADER) + info->bmiHeader.biClrUsed * sizeof(WORD);
218 return FIELD_OFFSET( BITMAPINFO, bmiColors[info->bmiHeader.biClrUsed] );
219}
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define DIB_PAL_COLORS
Definition: wingdi.h:366

Referenced by emfdc_create_brush(), EMFDC_SetDIBitsToDevice(), EMFDC_StretchDIBits(), EMFDRV_CreateBrushIndirect(), EMFDRV_SetDIBitsToDevice(), EMFDRV_StretchDIBits(), metadc_create_brush(), METADC_SetDIBitsToDevice(), METADC_StretchDIBits(), MFDRV_CreateBrushIndirect(), MFDRV_SetDIBitsToDevice(), MFDRV_StretchBlt(), and MFDRV_StretchDIBits().

◆ get_dib_stride()

static int get_dib_stride ( int  width,
int  bpp 
)
inlinestatic

Definition at line 200 of file gdi_private.h.

201{
202 return ((width * bpp + 31) >> 3) & ~3;
203}
DWORD bpp
Definition: surface.c:185
GLint GLint GLsizei width
Definition: gl.h:1546

Referenced by get_dib_image_size().

◆ get_full_gdi_handle()

HGDIOBJ get_full_gdi_handle ( HGDIOBJ  handle)

◆ GetBoundsRectAlt()

BOOL WINAPI GetBoundsRectAlt ( HDC  hdc,
LPRECT  prc,
UINT  flags 
)

Definition at line 1068 of file misc.c.

1069{
1070 return NtGdiGetBoundsRect(hdc, prc, flags);
1071}
DWORD APIENTRY NtGdiGetBoundsRect(IN HDC hdc, OUT LPRECT prc, IN DWORD flags)
Definition: dcutil.c:708
GLbitfield flags
Definition: glext.h:7161
_Out_ LPRECT prc
Definition: ntgdi.h:1658

◆ GetDCDWord()

DWORD WINAPI GetDCDWord ( _In_ HDC  hdc,
_In_ UINT  u,
_In_ DWORD  dwError 
)

Definition at line 787 of file dc.c.

791{
792 DWORD dwResult;
793
794 if (!NtGdiGetDCDword(hdc, u, &dwResult))
795 {
796 return dwError;
797 }
798
799 return dwResult;
800}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
__kernel_entry W32KAPI BOOL APIENTRY NtGdiGetDCDword(_In_ HDC hdc, _In_ UINT u, _Out_ DWORD *Result)

Referenced by GetArcDirection(), and GetRelAbs().

◆ is_meta_dc()

static BOOL is_meta_dc ( HDC  hdc)
inlinestatic

Definition at line 135 of file gdi_private.h.

136{
138}
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi_private.h:54

Referenced by EnumEnhMetaFile().

◆ MF_Create_HMETAFILE()

HMETAFILE MF_Create_HMETAFILE ( METAHEADER mh)

Definition at line 107 of file metafile.c.

108{
109 return alloc_gdi_handle( mh, OBJ_METAFILE, NULL );
110}
#define OBJ_METAFILE
Definition: objidl.idl:1417

Referenced by CloseMetaFile(), CopyMetaFileW(), GetMetaFileA(), GetMetaFileW(), and SetMetaFileBitsEx().

◆ MF_CreateMetaHeaderDisk()

METAHEADER * MF_CreateMetaHeaderDisk ( METAHEADER mr,
LPCVOID  filename,
BOOL  unicode 
)

Definition at line 271 of file metafile.c.

272{
273 METAHEADERDISK *mhd;
274
275 mh = HeapReAlloc( GetProcessHeap(), 0, mh,
276 sizeof(METAHEADER) + sizeof(METAHEADERDISK));
277 mh->mtType = METAFILE_DISK;
278 mhd = (METAHEADERDISK *)((char *)mh + sizeof(METAHEADER));
279
280 if( uni )
282 mhd->filename, sizeof mhd->filename, NULL, NULL);
283 else
284 lstrcpynA( mhd->filename, filename, sizeof mhd->filename );
285 return mh;
286}
#define CP_ACP
Definition: compat.h:109
#define lstrcpynA
Definition: compat.h:751
#define HeapReAlloc
Definition: compat.h:734
#define WideCharToMultiByte
Definition: compat.h:111
#define METAFILE_DISK
Definition: gdi32p.h:77
const char * filename
Definition: ioapi.h:137
CHAR filename[0x100]
Definition: metafile.c:74
struct tagMETAHEADER METAHEADER

Referenced by CreateMetaFileW().

◆ NamedEscape()

INT WINAPI NamedEscape ( HDC  hdc,
PWCHAR  pDriver,
INT  iEsc,
INT  cjIn,
LPSTR  pjIn,
INT  cjOut,
LPSTR  pjOut 
)

Definition at line 229 of file misc.c.

236{
237 /* FIXME metadc, metadc are done most in user mode, and we do not support it
238 * Windows 2000/XP/Vista ignore the current hdc, that are being pass and always set hdc to NULL
239 * when it calls to NtGdiExtEscape from NamedEscape
240 */
242}
FxDriver * pDriver
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
__kernel_entry W32KAPI INT APIENTRY NtGdiExtEscape(_In_opt_ HDC hdc, _In_reads_opt_(cwcDriver) PWCHAR pDriver, _In_ INT cwcDriver, _In_ INT iEsc, _In_ INT cjIn, _In_reads_bytes_opt_(cjIn) LPSTR pjIn, _In_ INT cjOut, _Out_writes_bytes_opt_(cjOut) LPSTR pjOut)
_In_ ULONG _In_ ULONG _In_ ULONG cjOut
Definition: winddi.h:3583
_In_ ULONG iEsc
Definition: winddi.h:3529
_In_ ULONG _In_ CLIPOBJ _In_ RECTL _In_ ULONG cjIn
Definition: winddi.h:3532

Referenced by PlayEnhMetaFileRecord().

◆ NtGdiCreateMetafileDC()

HDC APIENTRY NtGdiCreateMetafileDC ( _In_ HDC  hdc)

◆ NtGdiGetTransform()

◆ NtGdiPathToRegion()

HRGN APIENTRY NtGdiPathToRegion ( _In_ HDC  hdc)

◆ release_dc_ptr()

◆ SetBoundsRectAlt()

BOOL WINAPI SetBoundsRectAlt ( HDC  hdc,
LPRECT  prc,
UINT  flags 
)

Definition at line 1075 of file misc.c.

1076{
1077 return NtGdiSetBoundsRect(hdc, prc, flags );
1078}
__kernel_entry W32KAPI DWORD APIENTRY NtGdiSetBoundsRect(_In_ HDC hdc, _In_ LPRECT prc, _In_ DWORD f)

◆ SetVirtualResolution()

BOOL WINAPI SetVirtualResolution ( HDC  hdc,
DWORD  horz_res,
DWORD  vert_res,
DWORD  horz_size,
DWORD  vert_size 
)

Definition at line 278 of file rosglue.c.

284{
286 cxVirtualDevicePixel,
287 cyVirtualDevicePixel,
288 cxVirtualDeviceMm,
289 cyVirtualDeviceMm);
290}
__kernel_entry W32KAPI BOOL APIENTRY NtGdiSetVirtualResolution(_In_ HDC hdc, _In_ INT cxVirtualDevicePixel, _In_ INT cyVirtualDevicePixel, _In_ INT cxVirtualDeviceMm, _In_ INT cyVirtualDeviceMm)

Referenced by CreateEnhMetaFileW(), CreateMetaFileW(), and MFDRV_AllocMetaFile().