ReactOS  0.4.14-dev-583-g2a1ba2c
init.c
Go to the documentation of this file.
1 /*
2  * Enhanced MetaFile driver initialisation functions
3  *
4  * Copyright 1999 Huw D M Davies
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 #include <assert.h>
22 #include <stdarg.h>
23 #include <string.h>
24 
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "winnls.h"
29 #include "gdi_private.h"
31 #include "wine/debug.h"
32 
34 
36 
37 static const struct gdi_dc_funcs emfdrv_driver =
38 {
39  NULL, /* pAbortDoc */
40  EMFDRV_AbortPath, /* pAbortPath */
41  NULL, /* pAlphaBlend */
42  EMFDRV_AngleArc, /* pAngleArc */
43  EMFDRV_Arc, /* pArc */
44  EMFDRV_ArcTo, /* pArcTo */
45  EMFDRV_BeginPath, /* pBeginPath */
46  NULL, /* pBlendImage */
47  EMFDRV_Chord, /* pChord */
48  EMFDRV_CloseFigure, /* pCloseFigure */
49  NULL, /* pCreateCompatibleDC */
50  NULL, /* pCreateDC */
51  EMFDRV_DeleteDC, /* pDeleteDC */
52  EMFDRV_DeleteObject, /* pDeleteObject */
53  NULL, /* pDeviceCapabilities */
54  EMFDRV_Ellipse, /* pEllipse */
55  NULL, /* pEndDoc */
56  NULL, /* pEndPage */
57  EMFDRV_EndPath, /* pEndPath */
58  NULL, /* pEnumFonts */
59  NULL, /* pEnumICMProfiles */
60  EMFDRV_ExcludeClipRect, /* pExcludeClipRect */
61  NULL, /* pExtDeviceMode */
62  NULL, /* pExtEscape */
63  EMFDRV_ExtFloodFill, /* pExtFloodFill */
64  EMFDRV_ExtSelectClipRgn, /* pExtSelectClipRgn */
65  EMFDRV_ExtTextOut, /* pExtTextOut */
66  EMFDRV_FillPath, /* pFillPath */
67  EMFDRV_FillRgn, /* pFillRgn */
68  EMFDRV_FlattenPath, /* pFlattenPath */
69  NULL, /* pFontIsLinked */
70  EMFDRV_FrameRgn, /* pFrameRgn */
71  EMFDRV_GdiComment, /* pGdiComment */
72  NULL, /* pGetBoundsRect */
73  NULL, /* pGetCharABCWidths */
74  NULL, /* pGetCharABCWidthsI */
75  NULL, /* pGetCharWidth */
76  NULL, /* pGetCharWidthInfo */
77  EMFDRV_GetDeviceCaps, /* pGetDeviceCaps */
78  NULL, /* pGetDeviceGammaRamp */
79  NULL, /* pGetFontData */
80  NULL, /* pGetFontRealizationInfo */
81  NULL, /* pGetFontUnicodeRanges */
82  NULL, /* pGetGlyphIndices */
83  NULL, /* pGetGlyphOutline */
84  NULL, /* pGetICMProfile */
85  NULL, /* pGetImage */
86  NULL, /* pGetKerningPairs */
87  NULL, /* pGetNearestColor */
88  NULL, /* pGetOutlineTextMetrics */
89  NULL, /* pGetPixel */
90  NULL, /* pGetSystemPaletteEntries */
91  NULL, /* pGetTextCharsetInfo */
92  NULL, /* pGetTextExtentExPoint */
93  NULL, /* pGetTextExtentExPointI */
94  NULL, /* pGetTextFace */
95  NULL, /* pGetTextMetrics */
96  EMFDRV_GradientFill, /* pGradientFill */
97  EMFDRV_IntersectClipRect, /* pIntersectClipRect */
98  EMFDRV_InvertRgn, /* pInvertRgn */
99  EMFDRV_LineTo, /* pLineTo */
100  EMFDRV_ModifyWorldTransform, /* pModifyWorldTransform */
101  EMFDRV_MoveTo, /* pMoveTo */
102  EMFDRV_OffsetClipRgn, /* pOffsetClipRgn */
103  EMFDRV_OffsetViewportOrgEx, /* pOffsetViewportOrgEx */
104  EMFDRV_OffsetWindowOrgEx, /* pOffsetWindowOrgEx */
105  EMFDRV_PaintRgn, /* pPaintRgn */
106  EMFDRV_PatBlt, /* pPatBlt */
107  EMFDRV_Pie, /* pPie */
108  EMFDRV_PolyBezier, /* pPolyBezier */
109  EMFDRV_PolyBezierTo, /* pPolyBezierTo */
110  EMFDRV_PolyDraw, /* pPolyDraw */
111  EMFDRV_PolyPolygon, /* pPolyPolygon */
112  EMFDRV_PolyPolyline, /* pPolyPolyline */
113  EMFDRV_Polygon, /* pPolygon */
114  EMFDRV_Polyline, /* pPolyline */
115  EMFDRV_PolylineTo, /* pPolylineTo */
116  NULL, /* pPutImage */
117  NULL, /* pRealizeDefaultPalette */
118  NULL, /* pRealizePalette */
119  EMFDRV_Rectangle, /* pRectangle */
120  NULL, /* pResetDC */
121  EMFDRV_RestoreDC, /* pRestoreDC */
122  EMFDRV_RoundRect, /* pRoundRect */
123  EMFDRV_SaveDC, /* pSaveDC */
124  EMFDRV_ScaleViewportExtEx, /* pScaleViewportExtEx */
125  EMFDRV_ScaleWindowExtEx, /* pScaleWindowExtEx */
126  EMFDRV_SelectBitmap, /* pSelectBitmap */
127  EMFDRV_SelectBrush, /* pSelectBrush */
128  EMFDRV_SelectClipPath, /* pSelectClipPath */
129  EMFDRV_SelectFont, /* pSelectFont */
130  EMFDRV_SelectPalette, /* pSelectPalette */
131  EMFDRV_SelectPen, /* pSelectPen */
132  EMFDRV_SetArcDirection, /* pSetArcDirection */
133  EMFDRV_SetBkColor, /* pSetBkColor */
134  EMFDRV_SetBkMode, /* pSetBkMode */
135  NULL, /* pSetBoundsRect */
136  EMFDRV_SetDCBrushColor, /* pSetDCBrushColor*/
137  EMFDRV_SetDCPenColor, /* pSetDCPenColor*/
138  EMFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
139  NULL, /* pSetDeviceClipping */
140  NULL, /* pSetDeviceGammaRamp */
141  EMFDRV_SetLayout, /* pSetLayout */
142  EMFDRV_SetMapMode, /* pSetMapMode */
143  EMFDRV_SetMapperFlags, /* pSetMapperFlags */
144  EMFDRV_SetPixel, /* pSetPixel */
145  EMFDRV_SetPolyFillMode, /* pSetPolyFillMode */
146  EMFDRV_SetROP2, /* pSetROP2 */
147  NULL, /* pSetRelAbs */
148  EMFDRV_SetStretchBltMode, /* pSetStretchBltMode */
149  EMFDRV_SetTextAlign, /* pSetTextAlign */
150  NULL, /* pSetTextCharacterExtra */
151  EMFDRV_SetTextColor, /* pSetTextColor */
152  EMFDRV_SetTextJustification, /* pSetTextJustification */
153  EMFDRV_SetViewportExtEx, /* pSetViewportExtEx */
154  EMFDRV_SetViewportOrgEx, /* pSetViewportOrgEx */
155  EMFDRV_SetWindowExtEx, /* pSetWindowExtEx */
156  EMFDRV_SetWindowOrgEx, /* pSetWindowOrgEx */
157  EMFDRV_SetWorldTransform, /* pSetWorldTransform */
158  NULL, /* pStartDoc */
159  NULL, /* pStartPage */
160  EMFDRV_StretchBlt, /* pStretchBlt */
161  EMFDRV_StretchDIBits, /* pStretchDIBits */
162  EMFDRV_StrokeAndFillPath, /* pStrokeAndFillPath */
163  EMFDRV_StrokePath, /* pStrokePath */
164  NULL, /* pUnrealizePalette */
165  EMFDRV_WidenPath, /* pWidenPath */
166  NULL, /* wine_get_wgl_driver */
167  GDI_PRIORITY_GRAPHICS_DRV /* priority */
168 };
169 
170 
171 /**********************************************************************
172  * EMFDRV_DeleteDC
173  */
175 {
176  EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
177  UINT index;
178 
179  HeapFree( GetProcessHeap(), 0, physDev->emh );
180  for(index = 0; index < physDev->handles_size; index++)
181  if(physDev->handles[index])
182  GDI_hdc_not_using_object(physDev->handles[index], dev->hdc);
183  HeapFree( GetProcessHeap(), 0, physDev->handles );
184  HeapFree( GetProcessHeap(), 0, physDev );
185  return TRUE;
186 }
187 
188 
189 /******************************************************************
190  * EMFDRV_WriteRecord
191  *
192  * Warning: this function can change the pointer to the metafile header.
193  */
195 {
196  DWORD len;
197  DWORD bytes_written;
198  ENHMETAHEADER *emh;
199  EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
200 
201  TRACE("record %d, size %d %s\n",
202  emr->iType, emr->nSize, physDev->hFile ? "(to disk)" : "");
203 
204  assert( !(emr->nSize & 3) );
205 
206  physDev->emh->nBytes += emr->nSize;
207  physDev->emh->nRecords++;
208 
209  if(physDev->hFile) {
210  if (!WriteFile(physDev->hFile, emr, emr->nSize, &bytes_written, NULL))
211  return FALSE;
212  } else {
213  DWORD nEmfSize = HeapSize(GetProcessHeap(), 0, physDev->emh);
214  len = physDev->emh->nBytes;
215  if (len > nEmfSize) {
216  nEmfSize += (nEmfSize / 2) + emr->nSize;
217  emh = HeapReAlloc(GetProcessHeap(), 0, physDev->emh, nEmfSize);
218  if (!emh) return FALSE;
219  physDev->emh = emh;
220  }
221  memcpy((CHAR *)physDev->emh + physDev->emh->nBytes - emr->nSize, emr,
222  emr->nSize);
223  }
224  return TRUE;
225 }
226 
227 
228 /******************************************************************
229  * EMFDRV_UpdateBBox
230  */
232 {
233  EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
234  RECTL *bounds = &physDev->emh->rclBounds;
235  RECTL vportRect = *rect;
236 
237  LPtoDP( dev->hdc, (LPPOINT)&vportRect, 2 );
238 
239  /* The coordinate systems may be mirrored
240  (LPtoDP handles points, not rectangles) */
241  if (vportRect.left > vportRect.right)
242  {
243  LONG temp = vportRect.right;
244  vportRect.right = vportRect.left;
245  vportRect.left = temp;
246  }
247  if (vportRect.top > vportRect.bottom)
248  {
249  LONG temp = vportRect.bottom;
250  vportRect.bottom = vportRect.top;
251  vportRect.top = temp;
252  }
253 
254  if (bounds->left > bounds->right)
255  {
256  /* first bounding rectangle */
257  *bounds = vportRect;
258  }
259  else
260  {
261  bounds->left = min(bounds->left, vportRect.left);
262  bounds->top = min(bounds->top, vportRect.top);
263  bounds->right = max(bounds->right, vportRect.right);
264  bounds->bottom = max(bounds->bottom, vportRect.bottom);
265  }
266 }
267 
268 /**********************************************************************
269  * CreateEnhMetaFileA (GDI32.@)
270  */
272  HDC hdc, /* [in] optional reference DC */
273  LPCSTR filename, /* [in] optional filename for disk metafiles */
274  const RECT *rect, /* [in] optional bounding rectangle */
275  LPCSTR description /* [in] optional description */
276  )
277 {
280  HDC hReturnDC;
281  DWORD len1, len2, total;
282 
283  if(filename)
284  {
285  total = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
286  filenameW = HeapAlloc( GetProcessHeap(), 0, total * sizeof(WCHAR) );
287  MultiByteToWideChar( CP_ACP, 0, filename, -1, filenameW, total );
288  }
289  if(description) {
290  len1 = strlen(description);
291  len2 = strlen(description + len1 + 1);
292  total = MultiByteToWideChar( CP_ACP, 0, description, len1 + len2 + 3, NULL, 0 );
293  descriptionW = HeapAlloc( GetProcessHeap(), 0, total * sizeof(WCHAR) );
294  MultiByteToWideChar( CP_ACP, 0, description, len1 + len2 + 3, descriptionW, total );
295  }
296 
298 
301 
302  return hReturnDC;
303 }
304 
305 /**********************************************************************
306  * CreateEnhMetaFileW (GDI32.@)
307  */
309  HDC hdc, /* [in] optional reference DC */
310  LPCWSTR filename, /* [in] optional filename for disk metafiles */
311  const RECT* rect, /* [in] optional bounding rectangle */
312  LPCWSTR description /* [in] optional description */
313  )
314 {
315  static const WCHAR displayW[] = {'D','I','S','P','L','A','Y',0};
316  HDC ret;
317  DC *dc;
318  EMFDRV_PDEVICE *physDev;
319  HANDLE hFile;
320  DWORD size = 0, length = 0;
321  DWORD bytes_written;
322 
324 
325  if (!(dc = alloc_dc_ptr( OBJ_ENHMETADC ))) return 0;
326 
327  physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev));
328  if (!physDev) {
329  free_dc_ptr( dc );
330  return 0;
331  }
332  if(description) { /* App name\0Title\0\0 */
334  length += lstrlenW(description + length + 1);
335  length += 3;
336  length *= 2;
337  }
338  size = sizeof(ENHMETAHEADER) + (length + 3) / 4 * 4;
339 
340  if (!(physDev->emh = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size))) {
341  HeapFree( GetProcessHeap(), 0, physDev );
342  free_dc_ptr( dc );
343  return 0;
344  }
345 
346  push_dc_driver( &dc->physDev, &physDev->dev, &emfdrv_driver );
347 
348  physDev->handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, HANDLE_LIST_INC * sizeof(physDev->handles[0]));
349  physDev->handles_size = HANDLE_LIST_INC;
350  physDev->cur_handles = 1;
351  physDev->hFile = 0;
352  physDev->dc_brush = 0;
353  physDev->dc_pen = 0;
354  physDev->screen_dc = 0;
355  physDev->restoring = 0;
356  physDev->path = FALSE;
357  if (hdc) /* if no ref, use current display */
358  physDev->ref_dc = hdc;
359  else
360  physDev->ref_dc = physDev->screen_dc = CreateDCW( displayW, NULL, NULL, NULL );
361 
362  SetVirtualResolution(physDev->dev.hdc, 0, 0, 0, 0);
363 
364  physDev->emh->iType = EMR_HEADER;
365  physDev->emh->nSize = size;
366 
367  physDev->emh->rclBounds.left = physDev->emh->rclBounds.top = 0;
368  physDev->emh->rclBounds.right = physDev->emh->rclBounds.bottom = -1;
369 
370  if(rect) {
371  physDev->emh->rclFrame.left = rect->left;
372  physDev->emh->rclFrame.top = rect->top;
373  physDev->emh->rclFrame.right = rect->right;
374  physDev->emh->rclFrame.bottom = rect->bottom;
375  } else { /* Set this to {0,0 - -1,-1} and update it at the end */
376  physDev->emh->rclFrame.left = physDev->emh->rclFrame.top = 0;
377  physDev->emh->rclFrame.right = physDev->emh->rclFrame.bottom = -1;
378  }
379 
380  physDev->emh->dSignature = ENHMETA_SIGNATURE;
381  physDev->emh->nVersion = 0x10000;
382  physDev->emh->nBytes = physDev->emh->nSize;
383  physDev->emh->nRecords = 1;
384  physDev->emh->nHandles = 1;
385 
386  physDev->emh->sReserved = 0; /* According to docs, this is reserved and must be 0 */
387  physDev->emh->nDescription = length / 2;
388 
389  physDev->emh->offDescription = length ? sizeof(ENHMETAHEADER) : 0;
390 
391  physDev->emh->nPalEntries = 0; /* I guess this should start at 0 */
392 
393  /* Size in pixels */
394  physDev->emh->szlDevice.cx = GetDeviceCaps( physDev->ref_dc, HORZRES );
395  physDev->emh->szlDevice.cy = GetDeviceCaps( physDev->ref_dc, VERTRES );
396 
397  /* Size in millimeters */
398  physDev->emh->szlMillimeters.cx = GetDeviceCaps( physDev->ref_dc, HORZSIZE );
399  physDev->emh->szlMillimeters.cy = GetDeviceCaps( physDev->ref_dc, VERTSIZE );
400 
401  /* Size in micrometers */
402  physDev->emh->szlMicrometers.cx = physDev->emh->szlMillimeters.cx * 1000;
403  physDev->emh->szlMicrometers.cy = physDev->emh->szlMillimeters.cy * 1000;
404 
405  memcpy((char *)physDev->emh + sizeof(ENHMETAHEADER), description, length);
406 
407  if (filename) /* disk based metafile */
408  {
411  free_dc_ptr( dc );
412  return 0;
413  }
414  if (!WriteFile( hFile, physDev->emh, size, &bytes_written, NULL )) {
415  free_dc_ptr( dc );
416  CloseHandle( hFile );
417  return 0;
418  }
419  physDev->hFile = hFile;
420  }
421 
422  TRACE("returning %p\n", physDev->dev.hdc);
423  ret = physDev->dev.hdc;
424  release_dc_ptr( dc );
425 
426  return ret;
427 }
428 
429 /******************************************************************
430  * CloseEnhMetaFile (GDI32.@)
431  */
432 HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */
433 {
434  HENHMETAFILE hmf;
435  EMFDRV_PDEVICE *physDev;
436  DC *dc;
437  EMREOF emr;
438  HANDLE hMapping = 0;
439 
440  TRACE("(%p)\n", hdc );
441 
442  if (!(dc = get_dc_ptr( hdc ))) return NULL;
443  if (GetObjectType( hdc ) != OBJ_ENHMETADC)
444  {
445  release_dc_ptr( dc );
446  return NULL;
447  }
448  if (dc->refcount != 1)
449  {
450  FIXME( "not deleting busy DC %p refcount %u\n", hdc, dc->refcount );
451  release_dc_ptr( dc );
452  return NULL;
453  }
455 
456  if(dc->saveLevel)
457  RestoreDC(hdc, 1);
458 
459  if (physDev->dc_brush) DeleteObject( physDev->dc_brush );
460  if (physDev->dc_pen) DeleteObject( physDev->dc_pen );
461  if (physDev->screen_dc) DeleteDC( physDev->screen_dc );
462 
463  emr.emr.iType = EMR_EOF;
464  emr.emr.nSize = sizeof(emr);
465  emr.nPalEntries = 0;
466  emr.offPalEntries = FIELD_OFFSET(EMREOF, nSizeLast);
467  emr.nSizeLast = emr.emr.nSize;
468  EMFDRV_WriteRecord( &physDev->dev, &emr.emr );
469 
470  /* Update rclFrame if not initialized in CreateEnhMetaFile */
471  if(physDev->emh->rclFrame.left > physDev->emh->rclFrame.right) {
472  physDev->emh->rclFrame.left = physDev->emh->rclBounds.left *
473  physDev->emh->szlMillimeters.cx * 100 / physDev->emh->szlDevice.cx;
474  physDev->emh->rclFrame.top = physDev->emh->rclBounds.top *
475  physDev->emh->szlMillimeters.cy * 100 / physDev->emh->szlDevice.cy;
476  physDev->emh->rclFrame.right = physDev->emh->rclBounds.right *
477  physDev->emh->szlMillimeters.cx * 100 / physDev->emh->szlDevice.cx;
478  physDev->emh->rclFrame.bottom = physDev->emh->rclBounds.bottom *
479  physDev->emh->szlMillimeters.cy * 100 / physDev->emh->szlDevice.cy;
480  }
481 
482  if (physDev->hFile) /* disk based metafile */
483  {
484  if (SetFilePointer(physDev->hFile, 0, NULL, FILE_BEGIN) != 0)
485  {
486  CloseHandle( physDev->hFile );
487  free_dc_ptr( dc );
488  return 0;
489  }
490 
491  if (!WriteFile(physDev->hFile, physDev->emh, sizeof(*physDev->emh),
492  NULL, NULL))
493  {
494  CloseHandle( physDev->hFile );
495  free_dc_ptr( dc );
496  return 0;
497  }
498  HeapFree( GetProcessHeap(), 0, physDev->emh );
499  hMapping = CreateFileMappingA(physDev->hFile, NULL, PAGE_READONLY, 0,
500  0, NULL);
501  TRACE("hMapping = %p\n", hMapping );
502  physDev->emh = MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0);
503  TRACE("view = %p\n", physDev->emh );
504  CloseHandle( hMapping );
505  CloseHandle( physDev->hFile );
506  }
507 
508  hmf = EMF_Create_HENHMETAFILE( physDev->emh, (physDev->hFile != 0) );
509  physDev->emh = NULL; /* So it won't be deleted */
510  free_dc_ptr( dc );
511  return hmf;
512 }
COLORREF EMFDRV_SetTextColor(PHYSDEV dev, COLORREF color)
Definition: dc.c:114
HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk)
Definition: enhmetafile.c:249
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
HPEN EMFDRV_SelectPen(PHYSDEV dev, HPEN handle, const struct brush_pattern *pattern) DECLSPEC_HIDDEN
Definition: objects.c:369
DWORD offPalEntries
Definition: wingdi.h:1860
#define HORZRES
Definition: wingdi.h:715
#define max(a, b)
Definition: svc.c:63
#define push_dc_driver
Definition: gdi_private.h:200
struct tagENHMETAHEADER ENHMETAHEADER
#define TRUE
Definition: types.h:120
BOOL EMFDRV_ModifyWorldTransform(PHYSDEV dev, const XFORM *xform, DWORD mode)
Definition: dc.c:358
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr)
Definition: init.c:194
#define CloseHandle
Definition: compat.h:406
static PHYSDEV find_dc_driver(DC *dc, const struct gdi_dc_funcs *funcs)
Definition: gdi_private.h:155
SIZEL szlDevice
Definition: wingdi.h:2332
#define MapViewOfFile
Definition: compat.h:410
BOOL EMFDRV_RoundRect(PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height) DECLSPEC_HIDDEN
Definition: graphics.c:486
BOOL EMFDRV_PolyPolygon(PHYSDEV dev, const POINT *pt, const INT *counts, UINT polys) DECLSPEC_HIDDEN
Definition: graphics.c:701
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL EMFDRV_SetWorldTransform(PHYSDEV dev, const XFORM *xform)
Definition: dc.c:345
BOOL WINAPI LPtoDP(_In_ HDC hdc, _Inout_updates_(c) LPPOINT lppt, _In_ int c)
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
SIZEL szlMillimeters
Definition: wingdi.h:2333
BOOL EMFDRV_Polyline(PHYSDEV dev, const POINT *pt, INT count) DECLSPEC_HIDDEN
Definition: graphics.c:592
HFONT EMFDRV_SelectFont(PHYSDEV dev, HFONT handle, UINT *aa_flags) DECLSPEC_HIDDEN
Definition: objects.c:284
#define CP_ACP
Definition: compat.h:99
char CHAR
Definition: xmlstorage.h:175
INT EMFDRV_IntersectClipRect(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
Definition: dc.c:179
static HDC
Definition: imagelist.c:92
static EMFDRV_PDEVICE * get_emf_physdev(PHYSDEV dev)
BOOL EMFDRV_StretchBlt(PHYSDEV devDst, struct bitblt_coords *dst, PHYSDEV devSrc, struct bitblt_coords *src, DWORD rop)
Definition: bitblt.c:67
long bottom
Definition: polytest.cpp:53
BOOL EMFDRV_PolyDraw(PHYSDEV dev, const POINT *pts, const BYTE *types, DWORD count) DECLSPEC_HIDDEN
Definition: graphics.c:710
BOOL EMFDRV_CloseFigure(PHYSDEV dev)
Definition: dc.c:446
BOOL EMFDRV_PolyPolyline(PHYSDEV dev, const POINT *pt, const DWORD *counts, DWORD polys) DECLSPEC_HIDDEN
Definition: graphics.c:692
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define assert(x)
Definition: debug.h:53
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL EMFDRV_AbortPath(PHYSDEV dev)
Definition: dc.c:417
INT EMFDRV_ExtSelectClipRgn(PHYSDEV dev, HRGN hrgn, INT mode)
Definition: dc.c:207
BOOL EMFDRV_SetTextJustification(PHYSDEV dev, INT nBreakExtra, INT nBreakCount)
Definition: dc.c:81
INT EMFDRV_SetMapMode(PHYSDEV dev, INT mode)
Definition: dc.c:235
BOOL EMFDRV_StrokeAndFillPath(PHYSDEV dev) DECLSPEC_HIDDEN
Definition: graphics.c:1095
const char * description
Definition: directx.c:2497
BOOL EMFDRV_PolyBezier(PHYSDEV dev, const POINT *pts, DWORD count) DECLSPEC_HIDDEN
Definition: graphics.c:617
DWORD offDescription
Definition: wingdi.h:2330
const char * filename
Definition: ioapi.h:135
#define lstrlenW
Definition: compat.h:415
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)
BOOL EMFDRV_MoveTo(PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN
Definition: graphics.c:173
void release_dc_ptr(DC *dc) DECLSPEC_HIDDEN
& rect
Definition: startmenu.cpp:1413
BOOL EMFDRV_InvertRgn(PHYSDEV dev, HRGN hrgn) DECLSPEC_HIDDEN
Definition: graphics.c:875
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
BOOL EMFDRV_RestoreDC(PHYSDEV dev, INT level)
Definition: dc.c:48
static const WCHAR filenameW[]
Definition: amstream.c:41
long right
Definition: polytest.cpp:53
WINE_DEFAULT_DEBUG_CHANNEL(wldap32)
INT EMFDRV_GetDeviceCaps(PHYSDEV dev, INT cap)
Definition: dc.c:510
BOOL EMFDRV_GdiComment(PHYSDEV dev, UINT bytes, const BYTE *buffer) DECLSPEC_HIDDEN
Definition: objects.c:520
BOOL EMFDRV_ScaleViewportExtEx(PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size)
Definition: dc.c:303
DWORD EMFDRV_SetMapperFlags(PHYSDEV dev, DWORD flags)
Definition: dc.c:406
#define EMR_EOF
Definition: wingdi.h:88
COLORREF EMFDRV_SetBkColor(PHYSDEV dev, COLORREF color)
Definition: dc.c:100
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect)
Definition: init.c:231
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
BOOL EMFDRV_SetViewportOrgEx(PHYSDEV dev, INT x, INT y, POINT *pt)
Definition: dc.c:275
#define GENERIC_WRITE
Definition: nt_native.h:90
long top
Definition: polytest.cpp:53
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
EMR emr
Definition: wingdi.h:1858
HBITMAP EMFDRV_SelectBitmap(PHYSDEV dev, HBITMAP handle) DECLSPEC_HIDDEN
Definition: objects.c:102
INT EMFDRV_SetBkMode(PHYSDEV dev, INT mode)
Definition: dc.c:91
smooth NULL
Definition: ftsmooth.c:416
INT EMFDRV_SetStretchBltMode(PHYSDEV dev, INT mode)
Definition: dc.c:145
LONG cx
Definition: windef.h:334
#define FILE_MAP_READ
Definition: compat.h:435
GLuint index
Definition: glext.h:6031
const char * LPCSTR
Definition: xmlstorage.h:183
BOOL EMFDRV_SelectClipPath(PHYSDEV dev, INT iMode)
Definition: dc.c:478
BOOL EMFDRV_DeleteObject(PHYSDEV dev, HGDIOBJ obj) DECLSPEC_HIDDEN
Definition: objects.c:77
long left
Definition: polytest.cpp:53
DWORD nPalEntries
Definition: wingdi.h:1859
DC * alloc_dc_ptr(WORD magic) DECLSPEC_HIDDEN
Definition: rosglue.c:295
DWORD dSignature
Definition: wingdi.h:2323
BOOL EMFDRV_FillRgn(PHYSDEV dev, HRGN hrgn, HBRUSH hbrush) DECLSPEC_HIDDEN
Definition: graphics.c:765
struct gdi_physdev dev
INT EMFDRV_SaveDC(PHYSDEV dev)
Definition: dc.c:33
BOOL EMFDRV_GradientFill(PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, void *grad_array, ULONG ngrad, ULONG mode) DECLSPEC_HIDDEN
Definition: graphics.c:1033
#define TRACE(s)
Definition: solgame.cpp:4
Definition: polytest.cpp:40
GLsizeiptr size
Definition: glext.h:5919
RECTL rclFrame
Definition: wingdi.h:2322
#define GetProcessHeap()
Definition: compat.h:403
BOOL EMFDRV_PaintRgn(PHYSDEV dev, HRGN hrgn) DECLSPEC_HIDDEN
Definition: graphics.c:867
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL EMFDRV_OffsetWindowOrgEx(PHYSDEV dev, INT x, INT y, POINT *pt)
Definition: dc.c:389
#define GDI_PRIORITY_GRAPHICS_DRV
Definition: gdi_driver.h:205
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR displayW[]
Definition: icm.c:30
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
BOOL EMFDRV_Chord(PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend) DECLSPEC_HIDDEN
Definition: graphics.c:380
#define OBJ_ENHMETADC
Definition: objidl.idl:1420
HBRUSH EMFDRV_SelectBrush(PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern) DECLSPEC_HIDDEN
Definition: objects.c:205
ENHMETAHEADER * emh
#define WINAPI
Definition: msvc.h:6
const char * wine_dbgstr_rect(const RECT *rect)
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL EMFDRV_OffsetViewportOrgEx(PHYSDEV dev, INT x, INT y, POINT *pt)
Definition: dc.c:372
HDC WINAPI CreateEnhMetaFileW(HDC hdc, LPCWSTR filename, const RECT *rect, LPCWSTR description)
Definition: init.c:308
BOOL EMFDRV_Arc(PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend) DECLSPEC_HIDDEN
Definition: graphics.c:349
int ret
static const unsigned char enhmetafile[]
Definition: olepicture.c:149
DWORD nSize
Definition: wingdi.h:1690
#define index(s, c)
Definition: various.h:29
BOOL EMFDRV_LineTo(PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN
Definition: graphics.c:188
void free_dc_ptr(DC *dc) DECLSPEC_HIDDEN
HDC hdc
Definition: main.c:9
BOOL EMFDRV_ArcTo(PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend) DECLSPEC_HIDDEN
Definition: graphics.c:359
BOOL EMFDRV_FlattenPath(PHYSDEV dev)
Definition: dc.c:468
#define EMR_HEADER
Definition: wingdi.h:75
DWORD nRecords
Definition: wingdi.h:2326
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
BOOL WINAPI SetVirtualResolution(HDC hdc, DWORD horz_res, DWORD vert_res, DWORD horz_size, DWORD vert_size)
Definition: rosglue.c:523
#define GENERIC_READ
Definition: compat.h:124
INT EMFDRV_SetArcDirection(PHYSDEV dev, INT arcDirection)
Definition: dc.c:154
_In_ HANDLE hFile
Definition: mswsock.h:90
#define ENHMETA_SIGNATURE
Definition: wingdi.h:204
BOOL EMFDRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom) DECLSPEC_HIDDEN
Definition: graphics.c:447
#define HORZSIZE
Definition: wingdi.h:713
INT EMFDRV_SetROP2(PHYSDEV dev, INT rop)
Definition: dc.c:127
HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc)
Definition: init.c:432
COLORREF EMFDRV_SetPixel(PHYSDEV dev, INT x, INT y, COLORREF color) DECLSPEC_HIDDEN
Definition: graphics.c:526
RECTL rclBounds
Definition: wingdi.h:2321
DWORD iType
Definition: wingdi.h:1689
BOOL EMFDRV_PolyBezierTo(PHYSDEV dev, const POINT *pts, DWORD count) DECLSPEC_HIDDEN
Definition: graphics.c:625
#define CREATE_ALWAYS
Definition: disk.h:72
#define FILE_BEGIN
Definition: winbase.h:112
#define VERTSIZE
Definition: wingdi.h:714
INT EMFDRV_StretchDIBits(PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT heightDst, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, const void *bits, BITMAPINFO *info, UINT wUsage, DWORD dwRop)
Definition: bitblt.c:176
HPALETTE EMFDRV_SelectPalette(PHYSDEV dev, HPALETTE hPal, BOOL force) DECLSPEC_HIDDEN
Definition: objects.c:437
BOOL EMFDRV_FillPath(PHYSDEV dev) DECLSPEC_HIDDEN
Definition: graphics.c:1087
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL EMFDRV_ExtTextOut(PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx) DECLSPEC_HIDDEN
Definition: graphics.c:883
static calc_node_t temp
Definition: rpn_ieee.c:38
COLORREF EMFDRV_SetDCPenColor(PHYSDEV dev, COLORREF color) DECLSPEC_HIDDEN
Definition: objects.c:493
#define HeapReAlloc
Definition: compat.h:401
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
INT EMFDRV_SetPolyFillMode(PHYSDEV dev, INT mode)
Definition: dc.c:136
BOOL EMFDRV_PatBlt(PHYSDEV dev, struct bitblt_coords *dst, DWORD rop)
Definition: bitblt.c:30
HDC WINAPI CreateEnhMetaFileA(HDC hdc, LPCSTR filename, const RECT *rect, LPCSTR description)
Definition: init.c:271
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
BOOL EMFDRV_StrokePath(PHYSDEV dev) DECLSPEC_HIDDEN
Definition: graphics.c:1103
#define PAGE_READONLY
Definition: compat.h:127
#define VERTRES
Definition: wingdi.h:716
INT EMFDRV_SetDIBitsToDevice(PHYSDEV dev, INT xDst, INT yDst, DWORD width, DWORD height, INT xSrc, INT ySrc, UINT startscan, UINT lines, LPCVOID bits, BITMAPINFO *info, UINT wUsage)
Definition: bitblt.c:233
DC * get_dc_ptr(HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:378
static POBJECT_TYPE GetObjectType(IN PCWSTR TypeName)
Definition: ObTypes.c:15
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
COLORREF EMFDRV_SetDCBrushColor(PHYSDEV dev, COLORREF color) DECLSPEC_HIDDEN
Definition: objects.c:467
#define MultiByteToWideChar
Definition: compat.h:100
BOOL EMFDRV_SetWindowExtEx(PHYSDEV dev, INT cx, INT cy, SIZE *size)
Definition: dc.c:261
HDC WINAPI CreateDCW(_In_opt_ LPCWSTR pszDriver, _In_opt_ LPCWSTR pszDevice, _In_opt_ LPCWSTR psz, _In_opt_ const DEVMODEW *pdmInit)
#define CreateFileW
Definition: compat.h:408
DWORD nVersion
Definition: wingdi.h:2324
static const struct gdi_dc_funcs emfdrv_driver
Definition: init.c:37
static const WCHAR descriptionW[]
Definition: error.c:32
void GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:432
DWORD nSizeLast
Definition: wingdi.h:1861
BOOL EMFDRV_BeginPath(PHYSDEV dev)
Definition: dc.c:427
BOOL EMFDRV_WidenPath(PHYSDEV dev)
Definition: dc.c:500
DWORD nDescription
Definition: wingdi.h:2329
BOOL EMFDRV_PolylineTo(PHYSDEV dev, const POINT *pt, INT count) DECLSPEC_HIDDEN
Definition: graphics.c:600
BOOL EMFDRV_Polygon(PHYSDEV dev, const POINT *pt, INT count) DECLSPEC_HIDDEN
Definition: graphics.c:608
HGDIOBJ * handles
BOOL EMFDRV_SetWindowOrgEx(PHYSDEV dev, INT x, INT y, POINT *pt)
Definition: dc.c:289
static const WCHAR dc[]
#define HANDLE_LIST_INC
Definition: gdi32p.h:74
BOOL EMFDRV_ExtFloodFill(PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType) DECLSPEC_HIDDEN
Definition: graphics.c:747
WCHAR * LPWSTR
Definition: xmlstorage.h:184
DWORD nPalEntries
Definition: wingdi.h:2331
UINT EMFDRV_SetTextAlign(PHYSDEV dev, UINT align)
Definition: dc.c:72
BOOL EMFDRV_Pie(PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend) DECLSPEC_HIDDEN
Definition: graphics.c:369
INT EMFDRV_ExcludeClipRect(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
Definition: dc.c:164
BOOL WINAPI RestoreDC(_In_ HDC, _In_ int)
BOOL EMFDRV_EndPath(PHYSDEV dev)
Definition: dc.c:457
LONG cy
Definition: windef.h:335
INT EMFDRV_OffsetClipRgn(PHYSDEV dev, INT x, INT y)
Definition: dc.c:194
BOOL EMFDRV_Ellipse(PHYSDEV dev, INT left, INT top, INT right, INT bottom) DECLSPEC_HIDDEN
Definition: graphics.c:408
BOOL EMFDRV_ScaleWindowExtEx(PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size)
Definition: dc.c:319
#define HeapFree(x, y, z)
Definition: compat.h:402
BOOL EMFDRV_SetViewportExtEx(PHYSDEV dev, INT cx, INT cy, SIZE *size)
Definition: dc.c:247
HANDLE NTAPI CreateFileMappingA(IN HANDLE hFile, IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes, IN DWORD flProtect, IN DWORD dwMaximumSizeHigh, IN DWORD dwMaximumSizeLow, IN LPCSTR lpName)
Definition: filemap.c:23
BOOL EMFDRV_AngleArc(PHYSDEV dev, INT x, INT y, DWORD radius, FLOAT start, FLOAT sweep) DECLSPEC_HIDDEN
Definition: graphics.c:390
DWORD EMFDRV_SetLayout(PHYSDEV dev, DWORD layout)
Definition: dc.c:335
BOOL EMFDRV_FrameRgn(PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT width, INT height) DECLSPEC_HIDDEN
Definition: graphics.c:798
static BOOL EMFDRV_DeleteDC(PHYSDEV dev)
Definition: init.c:174