ReactOS  0.4.15-dev-3308-g9455def
rosglue.c File Reference
#include <precomp.h>
#include "gdi_private.h"
#include <debug.h>
Include dependency graph for rosglue.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static GDILOOBJTYPE ConvertObjectType (WORD wType)
 
HGDIOBJ alloc_gdi_handle (PVOID pvObject, WORD wType, const struct gdi_obj_funcs *funcs)
 
PVOID free_gdi_handle (HGDIOBJ hobj)
 
PVOID GDI_GetObjPtr (HGDIOBJ hobj, WORD wType)
 
VOID GDI_ReleaseObj (HGDIOBJ hobj)
 
WINEDCalloc_dc_ptr (WORD magic)
 
WINEDCget_dc_ptr (HDC hdc)
 
VOID GDI_hdc_using_object (HGDIOBJ hobj, HDC hdc)
 
VOID GDI_hdc_not_using_object (HGDIOBJ hobj, HDC hdc)
 
int bitmap_info_size (const BITMAPINFO *info, WORD coloruse)
 
BOOL get_brush_bitmap_info (HBRUSH hbr, PBITMAPINFO pbmi, PVOID pvBits, PUINT puUsage)
 
BOOL WINAPI SetVirtualResolution (HDC hdc, DWORD cxVirtualDevicePixel, DWORD cyVirtualDevicePixel, DWORD cxVirtualDeviceMm, DWORD cyVirtualDeviceMm)
 
BOOL WINAPI DeleteColorSpace (HCOLORSPACE hcs)
 
void __cdecl _assert (const char *exp, const char *file, unsigned line)
 
BOOL WINAPI METADC_SetD (_In_ HDC hdc, _In_ DWORD dwIn, _In_ USHORT usMF16Id)
 
BOOL WINAPI EMFDC_SetD (_In_ PLDC pldc, _In_ DWORD dwIn, _In_ ULONG ulMFId)
 
void METADC_DeleteObject (HDC hdc, HGDIOBJ obj)
 
void emfdc_delete_object (HDC hdc, HGDIOBJ obj)
 
VOID WINAPI METADC_RosGlueDeleteObject (HGDIOBJ hobj)
 
BOOL WINAPI METADC_RosGlueDeleteDC (_In_ HDC hdc)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 6 of file rosglue.c.

Function Documentation

◆ _assert()

void __cdecl _assert ( const char exp,
const char file,
unsigned  line 
)

Definition at line 301 of file rosglue.c.

305 {
307 }
#define DbgRaiseAssertionFailure
Definition: ke.h:173

◆ alloc_dc_ptr()

WINEDC* 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));
118  pWineDc->hBrush = GetStockObject(WHITE_BRUSH);
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 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
BOOL FASTCALL GdiSetLDC(HDC hdc, PVOID pvLDC)
Definition: misc.c:802
u32_t magic(void)
#define ZeroMemory
Definition: winbase.h:1664
#define WHITE_BRUSH
Definition: wingdi.h:902
#define FALSE
Definition: types.h:117
HBRUSH hBrush
Definition: gdi_private.h:128
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define ASSERT(a)
Definition: mode.c:44
#define OBJ_ENHMETADC
Definition: objidl.idl:1420
__kernel_entry W32KAPI HDC APIENTRY NtGdiCreateMetafileDC(_In_ HDC hdc)
#define BLACK_PEN
Definition: wingdi.h:903
#define NULL
Definition: types.h:112
#define HeapFree(x, y, z)
Definition: compat.h:594
#define LDC_EMFLDC
Definition: gdi_private.h:105

Referenced by CreateEnhMetaFileW(), and MFDRV_AllocMetaFile().

◆ alloc_gdi_handle()

HGDIOBJ alloc_gdi_handle ( PVOID  pvObject,
WORD  wType,
const struct gdi_obj_funcs funcs 
)

Definition at line 36 of file rosglue.c.

40 {
41  GDILOOBJTYPE eObjType;
42 
43  /* Get the GDI object type */
44  eObjType = ConvertObjectType(wType);
45  if ((eObjType != GDILoObjType_LO_METAFILE_TYPE) &&
46  (eObjType != GDILoObjType_LO_METAFILE16_TYPE) &&
47  (eObjType != GDILoObjType_LO_METADC16_TYPE))
48  {
49  /* This is not supported! */
50  ASSERT(FALSE);
51  return NULL;
52  }
53 
54  /* Insert the client object */
55  return GdiCreateClientObj(pvObject, eObjType);
56 }
enum GDILoObjType GDILOOBJTYPE
HGDIOBJ WINAPI GdiCreateClientObj(_In_ PVOID pvObject, _In_ GDILOOBJTYPE eObjType)
Definition: clientobj.c:148
#define FALSE
Definition: types.h:117
static GDILOOBJTYPE ConvertObjectType(WORD wType)
Definition: rosglue.c:11
#define ASSERT(a)
Definition: mode.c:44
#define NULL
Definition: types.h:112

◆ 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 }
#define max(a, b)
Definition: svc.c:63
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define BI_BITFIELDS
Definition: mmreg.h:507
GLsizeiptr size
Definition: glext.h:5919
ULONG RGBQUAD
Definition: precomp.h:50
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define min(a, b)
Definition: monoChain.cc:55
#define DIB_RGB_COLORS
Definition: wingdi.h:367
static const BYTE masks[8]
Definition: dib.c:2760

◆ ConvertObjectType()

static GDILOOBJTYPE ConvertObjectType ( WORD  wType)
static

Definition at line 11 of file rosglue.c.

13 {
14  /* Get the GDI object type */
15  switch (wType)
16  {
17  case OBJ_PEN: return GDILoObjType_LO_PEN_TYPE;
19  case OBJ_DC: return GDILoObjType_LO_DC_TYPE;
31  default: return 0;
32  }
33 }
#define OBJ_MEMDC
Definition: objidl.idl:1418
#define OBJ_PEN
Definition: objidl.idl:1409
#define OBJ_ENHMETAFILE
Definition: objidl.idl:1421
#define OBJ_COLORSPACE
Definition: wingdi.h:704
#define OBJ_REGION
Definition: objidl.idl:1416
#define OBJ_METAFILE
Definition: objidl.idl:1417
#define OBJ_ENHMETADC
Definition: objidl.idl:1420
#define OBJ_DC
Definition: objidl.idl:1411
#define OBJ_PAL
Definition: objidl.idl:1413
#define OBJ_FONT
Definition: objidl.idl:1414
#define OBJ_EXTPEN
Definition: objidl.idl:1419
#define OBJ_BRUSH
Definition: objidl.idl:1410
#define OBJ_METADC
Definition: objidl.idl:1412
#define OBJ_BITMAP
Definition: objidl.idl:1415

Referenced by alloc_gdi_handle(), and GDI_GetObjPtr().

◆ DeleteColorSpace()

BOOL WINAPI DeleteColorSpace ( HCOLORSPACE  hcs)

Definition at line 294 of file rosglue.c.

296 {
297  return NtGdiDeleteColorSpace(hcs);
298 }
__kernel_entry W32KAPI BOOL APIENTRY NtGdiDeleteColorSpace(_In_ HANDLE hColorSpace)

◆ emfdc_delete_object()

void emfdc_delete_object ( HDC  hdc,
HGDIOBJ  obj 
)

Definition at line 232 of file emfdc.c.

233 {
234  WINEDC *dc_attr = get_dc_ptr( hdc );
235  struct emf *emf = dc_attr->emf;
236  EMRDELETEOBJECT emr;
237  UINT index;
238 
239  if(!(index = emfdc_find_object( emf, obj ))) return;
240 
241  emr.emr.iType = EMR_DELETEOBJECT;
242  emr.emr.nSize = sizeof(emr);
243  emr.ihObject = index;
244 
245  emfdc_record( emf, &emr.emr );
246 
247  emf->handles[index - 1] = 0;
248  emf->cur_handles--;
249 }
HGDIOBJ * handles
Definition: emfdc.c:49
GLuint index
Definition: glext.h:6031
WINEDC * dc_attr
Definition: emfdc.c:47
static UINT emfdc_find_object(struct emf *emf, HGDIOBJ obj)
Definition: emfdc.c:222
DWORD nSize
Definition: wingdi.h:1691
#define EMR_DELETEOBJECT
Definition: wingdi.h:114
#define index(s, c)
Definition: various.h:29
HDC hdc
Definition: main.c:9
Definition: emfdc.c:44
UINT cur_handles
Definition: emfdc.c:48
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
unsigned int UINT
Definition: ndis.h:50
DC * get_dc_ptr(HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:147

Referenced by METADC_RosGlueDeleteObject().

◆ EMFDC_SetD()

BOOL WINAPI EMFDC_SetD ( _In_ PLDC  pldc,
_In_ DWORD  dwIn,
_In_ ULONG  ulMFId 
)

Definition at line 331 of file rosglue.c.

335 {
336  switch(ulMFId)
337  {
338  case EMR_SETMAPMODE:
339  return EMFDC_SetMapMode( pldc, dwIn);
340  case EMR_SETARCDIRECTION:
341  return EMFDC_SetArcDirection( pldc, dwIn);
342  default:
343  return FALSE;
344  }
345 }
#define EMR_SETMAPMODE
Definition: wingdi.h:91
#define EMR_SETARCDIRECTION
Definition: wingdi.h:131
BOOL EMFDC_SetArcDirection(LDC *dc_attr, INT dir) DECLSPEC_HIDDEN
#define FALSE
Definition: types.h:117
BOOL EMFDC_SetMapMode(LDC *dc_attr, INT mode) DECLSPEC_HIDDEN
_In_ UINT _In_ DWORD dwIn
Definition: ntgdi.h:248

Referenced by GetAndSetDCDWord().

◆ free_gdi_handle()

PVOID free_gdi_handle ( HGDIOBJ  hobj)

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()

PVOID 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) ||
89  (eObjType == GDILoObjType_LO_METADC16_TYPE))
90  {
91  return GdiGetClientObjLink(hobj);
92  }
93 
94  /* This should never happen! */
95  ASSERT(FALSE);
96  return NULL;
97 }
enum GDILoObjType GDILOOBJTYPE
PVOID WINAPI GdiGetClientObjLink(_In_ HGDIOBJ hobj)
Definition: clientobj.c:61
#define FALSE
Definition: types.h:117
static GDILOOBJTYPE ConvertObjectType(WORD wType)
Definition: rosglue.c:11
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
PLDC FASTCALL GdiGetLDC(HDC hDC)
Definition: misc.c:785
#define ASSERT(a)
Definition: mode.c:44
#define NULL
Definition: types.h:112

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

◆ GDI_hdc_not_using_object()

VOID GDI_hdc_not_using_object ( HGDIOBJ  hobj,
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
static HDC
Definition: imagelist.c:92
#define ASSERT(a)
Definition: mode.c:44
HDC hdc
Definition: main.c:9

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

◆ GDI_hdc_using_object()

VOID GDI_hdc_using_object ( HGDIOBJ  hobj,
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 }
BOOL WINAPI GdiCreateClientObjLink(_In_ HGDIOBJ hobj, _In_ PVOID pvObject)
Definition: clientobj.c:24
HDC hdc
Definition: main.c:9
#define DPRINT1
Definition: precomp.h:8

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().

◆ get_brush_bitmap_info()

BOOL get_brush_bitmap_info ( HBRUSH  hbr,
PBITMAPINFO  pbmi,
PVOID  pvBits,
PUINT  puUsage 
)

Definition at line 223 of file rosglue.c.

228 {
229  HBITMAP hbmp;
230  HDC hdc;
231  PVOID Bits;
232 
233  /* Call win32k to get the bitmap handle and color usage */
234  hbmp = NtGdiGetObjectBitmapHandle(hbr, puUsage);
235  if (hbmp == NULL)
236  return FALSE;
237 
238  hdc = GetDC(NULL);
239  if (hdc == NULL)
240  return FALSE;
241 
242  /* Initialize the BITMAPINFO */
243  ZeroMemory(pbmi, sizeof(*pbmi));
245 
246  /* Retrieve information about the bitmap */
247  if (!GetDIBits(hdc, hbmp, 0, 0, NULL, pbmi, *puUsage))
248  return FALSE;
249 
250  if (pvBits)
251  {
252  /* Now allocate a buffer for the bits */
254  if (Bits == NULL)
255  return FALSE;
256 
257  /* Retrieve the bitmap bits */
258  if (!GetDIBits(hdc, hbmp, 0, pbmi->bmiHeader.biHeight, Bits, pbmi, *puUsage))
259  {
260  HeapFree(GetProcessHeap(), 0, Bits);
261  return FALSE;
262  }
263 
264  CopyMemory( pvBits, Bits, pbmi->bmiHeader.biSizeImage );
265 
266  }
267 
268  /* GetDIBits doesn't set biClrUsed, but wine code needs it, so we set it */
269  if (pbmi->bmiHeader.biBitCount <= 8)
270  {
272  }
273  return TRUE;
274 }
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
HDC WINAPI GetDC(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
_In_ HBITMAP _In_ UINT _In_ UINT _Inout_ LPBITMAPINFO pbmi
Definition: ntgdi.h:2780
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
static HDC
Definition: imagelist.c:92
#define ZeroMemory
Definition: winbase.h:1664
#define FALSE
Definition: types.h:117
HBITMAP hbmp
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__kernel_entry W32KAPI HBITMAP APIENTRY NtGdiGetObjectBitmapHandle(_In_ HBRUSH hbr, _Out_ UINT *piUsage)
Definition: brush.cpp:513
#define CopyMemory
Definition: winbase.h:1662
DWORD biSizeImage
Definition: amvideo.idl:36
HDC hdc
Definition: main.c:9
#define NULL
Definition: types.h:112
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
static HBITMAP
Definition: button.c:44
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ get_dc_ptr()

WINEDC* 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 }
PVOID WINAPI GdiGetClientObjLink(_In_ HGDIOBJ hobj)
Definition: clientobj.c:61
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
PLDC FASTCALL GdiGetLDC(HDC hDC)
Definition: misc.c:785
HDC hdc
Definition: main.c:9
#define NULL
Definition: types.h:112

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

◆ METADC_DeleteObject()

void METADC_DeleteObject ( HDC  hdc,
HGDIOBJ  obj 
)

Definition at line 1015 of file metadc.c.

1016 {
1017  struct metadc *metadc = get_metadc_ptr( hdc );
1018  METARECORD mr;
1019  INT16 index;
1020 
1021  if ((index = metadc_find_object( metadc, obj )) < 0) return;
1022  if (obj == metadc->pen || obj == metadc->brush || obj == metadc->font)
1023  {
1024  WARN( "deleting selected object %p\n", obj );
1025  return;
1026  }
1027 
1028  mr.rdSize = sizeof(mr) / sizeof(WORD);
1030  mr.rdParm[0] = index;
1031 
1032  metadc_write_record( metadc, &mr, mr.rdSize * sizeof(WORD) );
1033 
1034  metadc->handles[index] = 0;
1035  metadc->cur_handles--;
1036 }
HBRUSH brush
Definition: metadc.c:53
HGDIOBJ * handles
Definition: metadc.c:50
#define WARN(fmt,...)
Definition: debug.h:112
static INT16 metadc_find_object(struct metadc *metadc, HGDIOBJ obj)
Definition: metadc.c:1005
WORD rdFunction
Definition: wingdi.h:2346
DWORD rdSize
Definition: wingdi.h:2345
HPEN pen
Definition: metadc.c:52
GLuint index
Definition: glext.h:6031
UINT cur_handles
Definition: metadc.c:49
unsigned short WORD
Definition: ntddk_ex.h:93
#define index(s, c)
Definition: various.h:29
Definition: metadc.c:45
HDC hdc
Definition: main.c:9
WORD rdParm[1]
Definition: wingdi.h:2347
HFONT font
Definition: metadc.c:54
#define META_DELETEOBJECT
Definition: wingdi.h:272
struct metadc * get_metadc_ptr(HDC hdc)
Definition: metadc.c:60
static BOOL metadc_write_record(struct metadc *metadc, METARECORD *mr, unsigned int rlen)
Definition: metadc.c:67
signed short INT16

Referenced by METADC_RosGlueDeleteObject().

◆ METADC_RosGlueDeleteDC()

BOOL WINAPI METADC_RosGlueDeleteDC ( _In_ HDC  hdc)

Definition at line 392 of file rosglue.c.

394 {
395  LDC* pWineDc = NULL;
396 
398  {
399  return METADC_DeleteDC(hdc);
400  }
401 
403  {
404  pWineDc = GdiGetLDC(hdc);
405 
406  if ( pWineDc )
407  {
408  // Handle Printer LDC
409  if (pWineDc->iType != LDC_EMFLDC)
410  {
411  //return IntDeleteDC(hdc);
412  }
413 
414  EMFDC_DeleteDC( pWineDc );
415 
416  /* Get rid of the LDC */
417  ASSERT(GdiGetLDC(pWineDc->hDC) == pWineDc);
418  GdiSetLDC(pWineDc->hDC, NULL);
419 
420  /* Free the Wine DC */
421  HeapFree(GetProcessHeap(), 0, pWineDc);
422  }
423  }
424 
425  return NtGdiDeleteObjectApp(hdc);
426 }
BOOL FASTCALL GdiSetLDC(HDC hdc, PVOID pvLDC)
Definition: misc.c:802
BOOL EMFDC_DeleteDC(LDC *dc_attr) DECLSPEC_HIDDEN
BOOL METADC_DeleteDC(HDC hdc)
Definition: metadc.c:1318
HDC hDC
Definition: ntgdihdl.h:286
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
PLDC FASTCALL GdiGetLDC(HDC hDC)
Definition: misc.c:785
#define GetProcessHeap()
Definition: compat.h:595
#define ASSERT(a)
Definition: mode.c:44
Definition: ntgdihdl.h:284
INT iType
Definition: ntgdihdl.h:288
HDC hdc
Definition: main.c:9
__kernel_entry W32KAPI BOOL APIENTRY NtGdiDeleteObjectApp(_In_ HANDLE hobj)
#define NULL
Definition: types.h:112
#define HeapFree(x, y, z)
Definition: compat.h:594
#define LDC_EMFLDC
Definition: gdi_private.h:105

Referenced by DeleteDC().

◆ METADC_RosGlueDeleteObject()

VOID WINAPI METADC_RosGlueDeleteObject ( HGDIOBJ  hobj)

Definition at line 352 of file rosglue.c.

353 {
354  GDILOOBJTYPE eObjectType;
355  HDC hdc;
356 
357  /* Check for one of the types we actually handle here */
358  eObjectType = GDI_HANDLE_GET_TYPE(hobj);
359  if ((eObjectType != GDILoObjType_LO_BRUSH_TYPE) &&
360  (eObjectType != GDILoObjType_LO_PEN_TYPE) &&
361  (eObjectType != GDILoObjType_LO_EXTPEN_TYPE) &&
362  (eObjectType != GDILoObjType_LO_PALETTE_TYPE) &&
363  (eObjectType != GDILoObjType_LO_FONT_TYPE))
364  {
365  return;
366  }
367 
368  /* Check if we have a client object link and remove it if it was found.
369  The link is the HDC that the object was selected into. */
370  hdc = GdiRemoveClientObjLink(hobj);
371  if (hdc == NULL)
372  {
373  DPRINT1("the link was not found\n");
374  /* The link was not found, so we are not handling this object here */
375  return;
376  }
377 
379 
381  {
382  LDC* pWineDc = GdiGetLDC(hdc);
383  if ( pWineDc )
384  {
385  emfdc_delete_object( hdc, hobj );
386  }
387  }
388 }
enum GDILoObjType GDILOOBJTYPE
PVOID WINAPI GdiRemoveClientObjLink(_In_ HGDIOBJ hobj)
Definition: clientobj.c:98
static HDC
Definition: imagelist.c:92
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
PLDC FASTCALL GdiGetLDC(HDC hDC)
Definition: misc.c:785
Definition: ntgdihdl.h:284
HDC hdc
Definition: main.c:9
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
void METADC_DeleteObject(HDC hdc, HGDIOBJ obj)
Definition: metadc.c:1015
void emfdc_delete_object(HDC hdc, HGDIOBJ obj)
Definition: emfdc.c:232

Referenced by DeleteObject().

◆ METADC_SetD()

BOOL WINAPI METADC_SetD ( _In_ HDC  hdc,
_In_ DWORD  dwIn,
_In_ USHORT  usMF16Id 
)

Definition at line 312 of file rosglue.c.

317 {
318  switch(usMF16Id)
319  {
320  case META_SETMAPMODE:
321  return METADC_SetMapMode(hdc, dwIn);
322  case META_SETRELABS:
323  return METADC_SetRelAbs(hdc, dwIn);
324  default:
325  return FALSE;
326  }
327 }
BOOL METADC_SetMapMode(HDC hdc, INT mode) DECLSPEC_HIDDEN
Definition: metadc.c:271
#define FALSE
Definition: types.h:117
BOOL METADC_SetRelAbs(HDC hdc, INT mode) DECLSPEC_HIDDEN
Definition: metadc.c:236
HDC hdc
Definition: main.c:9
#define META_SETRELABS
Definition: wingdi.h:214
#define META_SETMAPMODE
Definition: wingdi.h:212
_In_ UINT _In_ DWORD dwIn
Definition: ntgdi.h:248

Referenced by GetAndSetDCDWord().

◆ SetVirtualResolution()

BOOL WINAPI SetVirtualResolution ( HDC  hdc,
DWORD  cxVirtualDevicePixel,
DWORD  cyVirtualDevicePixel,
DWORD  cxVirtualDeviceMm,
DWORD  cyVirtualDeviceMm 
)

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)
HDC hdc
Definition: main.c:9

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