ReactOS  0.4.15-dev-5461-g062a8f2
emfdc.c File Reference
#include "config.h"
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winnls.h"
#include "winerror.h"
#include "gdi_private.h"
#include "wine/wingdi16.h"
#include "wine/debug.h"
#include "winternl.h"
Include dependency graph for emfdc.c:

Go to the source code of this file.

Classes

struct  emf
 

Macros

#define HANDLE_LIST_INC   20
 
#define GdiGetEMFRestorDc   5
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (enhmetafile)
 
static BOOL emfdc_record (struct emf *emf, EMR *emr)
 
static void emfdc_update_bounds (struct emf *emf, RECTL *rect)
 
static UINT get_bitmap_info (HDC *hdc, HBITMAP *bitmap, BITMAPINFO *info)
 
static UINT emfdc_add_handle (struct emf *emf, HGDIOBJ obj)
 
static UINT emfdc_find_object (struct emf *emf, HGDIOBJ obj)
 
void emfdc_delete_object (HDC hdc, HGDIOBJ obj)
 
static DWORD emfdc_create_brush (struct emf *emf, HBRUSH brush)
 
static BOOL emfdc_select_brush (WINEDC *dc_attr, HBRUSH brush)
 
static BOOL emfdc_create_font (struct emf *emf, HFONT font)
 
static BOOL emfdc_select_font (WINEDC *dc_attr, HFONT font)
 
static DWORD emfdc_create_pen (struct emf *emf, HPEN hPen)
 
static BOOL emfdc_select_pen (WINEDC *dc_attr, HPEN pen)
 
static DWORD emfdc_create_palette (struct emf *emf, HPALETTE hPal)
 
BOOL EMFDC_SelectPalette (WINEDC *dc_attr, HPALETTE palette)
 
BOOL EMFDC_SelectObject (WINEDC *dc_attr, HGDIOBJ obj)
 
static BOOL can_use_short_points (const POINT *pts, UINT count)
 
static voidstore_points (POINTL *dest, const POINT *pts, UINT count, BOOL short_points)
 
static void get_points_bounds (RECTL *bounds, const POINT *pts, UINT count, WINEDC *dc_attr)
 
static BOOL emfdrv_stroke_and_fill_path (struct emf *emf, INT type)
 
BOOL EMFDC_MoveTo (WINEDC *dc_attr, INT x, INT y)
 
BOOL EMFDC_LineTo (WINEDC *dc_attr, INT x, INT y)
 
BOOL EMFDC_ArcChordPie (WINEDC *dc_attr, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend, DWORD type)
 
BOOL EMFDC_AngleArc (WINEDC *dc_attr, INT x, INT y, DWORD radius, FLOAT start, FLOAT sweep)
 
BOOL EMFDC_Ellipse (WINEDC *dc_attr, INT left, INT top, INT right, INT bottom)
 
BOOL EMFDC_Rectangle (WINEDC *dc_attr, INT left, INT top, INT right, INT bottom)
 
BOOL EMFDC_RoundRect (WINEDC *dc_attr, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height)
 
BOOL EMFDC_SetPixel (WINEDC *dc_attr, INT x, INT y, COLORREF color)
 
static BOOL emfdc_polylinegon (WINEDC *dc_attr, const POINT *points, INT count, DWORD type)
 
BOOL EMFDC_Polyline (WINEDC *dc_attr, const POINT *points, INT count)
 
BOOL EMFDC_PolylineTo (WINEDC *dc_attr, const POINT *points, INT count)
 
BOOL EMFDC_Polygon (WINEDC *dc_attr, const POINT *pt, INT count)
 
BOOL EMFDC_PolyBezier (WINEDC *dc_attr, const POINT *pts, DWORD count)
 
BOOL EMFDC_PolyBezierTo (WINEDC *dc_attr, const POINT *pts, DWORD count)
 
static BOOL emfdc_poly_polylinegon (struct emf *emf, const POINT *pt, const INT *counts, UINT polys, DWORD type)
 
BOOL EMFDC_PolyPolyline (WINEDC *dc_attr, const POINT *pt, const DWORD *counts, DWORD polys)
 
BOOL EMFDC_PolyPolygon (WINEDC *dc_attr, const POINT *pt, const INT *counts, UINT polys)
 
BOOL EMFDC_PolyDraw (WINEDC *dc_attr, const POINT *pts, const BYTE *types, DWORD count)
 
BOOL EMFDC_ExtFloodFill (WINEDC *dc_attr, INT x, INT y, COLORREF color, UINT fill_type)
 
BOOL EMFDC_FillRgn (WINEDC *dc_attr, HRGN hrgn, HBRUSH hbrush)
 
BOOL EMFDC_FrameRgn (WINEDC *dc_attr, HRGN hrgn, HBRUSH hbrush, INT width, INT height)
 
static BOOL emfdc_paint_invert_region (struct emf *emf, HRGN hrgn, DWORD iType)
 
BOOL EMFDC_PaintRgn (WINEDC *dc_attr, HRGN hrgn)
 
BOOL EMFDC_InvertRgn (WINEDC *dc_attr, HRGN hrgn)
 
BOOL EMFDC_ExtTextOut (WINEDC *dc_attr, INT x, INT y, UINT flags, const RECT *rect, const WCHAR *str, UINT count, const INT *dx)
 
BOOL EMFDC_GradientFill (WINEDC *dc_attr, TRIVERTEX *vert_array, ULONG nvert, void *grad_array, ULONG ngrad, ULONG mode)
 
BOOL EMFDC_FillPath (WINEDC *dc_attr)
 
BOOL EMFDC_StrokeAndFillPath (WINEDC *dc_attr)
 
BOOL EMFDC_StrokePath (WINEDC *dc_attr)
 
static BOOL emfdrv_stretchblt (struct emf *emf, INT x_dst, INT y_dst, INT width_dst, INT height_dst, HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src, DWORD rop, DWORD type)
 
BOOL EMFDC_AlphaBlend (WINEDC *dc_attr, INT x_dst, INT y_dst, INT width_dst, INT height_dst, HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src, BLENDFUNCTION blend_function)
 
BOOL EMFDC_PatBlt (WINEDC *dc_attr, INT left, INT top, INT width, INT height, DWORD rop)
 
static BOOL rop_uses_src (DWORD rop)
 
BOOL EMFDC_BitBlt (WINEDC *dc_attr, INT x_dst, INT y_dst, INT width, INT height, HDC hdc_src, INT x_src, INT y_src, DWORD rop)
 
BOOL EMFDC_StretchBlt (WINEDC *dc_attr, INT x_dst, INT y_dst, INT width_dst, INT height_dst, HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src, DWORD rop)
 
BOOL EMFDC_TransparentBlt (WINEDC *dc_attr, int x_dst, int y_dst, int width_dst, int height_dst, HDC hdc_src, int x_src, int y_src, int width_src, int height_src, UINT color)
 
BOOL EMFDC_MaskBlt (WINEDC *dc_attr, INT x_dst, INT y_dst, INT width_dst, INT height_dst, HDC hdc_src, INT x_src, INT y_src, HBITMAP mask, INT x_mask, INT y_mask, DWORD rop)
 
BOOL EMFDC_PlgBlt (WINEDC *dc_attr, const POINT *points, HDC hdc_src, INT x_src, INT y_src, INT width, INT height, HBITMAP mask, INT x_mask, INT y_mask)
 
BOOL EMFDC_StretchDIBits (WINEDC *dc_attr, 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, const BITMAPINFO *info, UINT usage, DWORD rop)
 
BOOL EMFDC_SetDIBitsToDevice (WINEDC *dc_attr, INT x_dst, INT y_dst, DWORD width, DWORD height, INT x_src, INT y_src, UINT startscan, UINT lines, const void *bits, const BITMAPINFO *info, UINT usage)
 
BOOL EMFDC_SetDCBrushColor (WINEDC *dc_attr, COLORREF color)
 
BOOL EMFDC_SetDCPenColor (WINEDC *dc_attr, COLORREF color)
 
BOOL EMFDC_SaveDC (WINEDC *dc_attr)
 
BOOL EMFDC_RestoreDC (WINEDC *dc_attr, INT level)
 
BOOL EMFDC_SetTextAlign (WINEDC *dc_attr, UINT align)
 
BOOL EMFDC_SetTextJustification (WINEDC *dc_attr, INT extra, INT breaks)
 
BOOL EMFDC_SetBkMode (WINEDC *dc_attr, INT mode)
 
BOOL EMFDC_SetBkColor (WINEDC *dc_attr, COLORREF color)
 
BOOL EMFDC_SetTextColor (WINEDC *dc_attr, COLORREF color)
 
BOOL EMFDC_SetROP2 (WINEDC *dc_attr, INT rop)
 
BOOL EMFDC_SetPolyFillMode (WINEDC *dc_attr, INT mode)
 
BOOL EMFDC_SetStretchBltMode (WINEDC *dc_attr, INT mode)
 
BOOL EMFDC_SetArcDirection (WINEDC *dc_attr, INT dir)
 
BOOL EMFDC_ExcludeClipRect (WINEDC *dc_attr, INT left, INT top, INT right, INT bottom)
 
BOOL EMFDC_IntersectClipRect (WINEDC *dc_attr, INT left, INT top, INT right, INT bottom)
 
BOOL EMFDC_OffsetClipRgn (WINEDC *dc_attr, INT x, INT y)
 
BOOL EMFDC_ExtSelectClipRgn (WINEDC *dc_attr, HRGN hrgn, INT mode)
 
BOOL EMFDC_SetMapMode (WINEDC *dc_attr, INT mode)
 
BOOL EMFDC_SetViewportExtEx (WINEDC *dc_attr, INT cx, INT cy)
 
BOOL EMFDC_SetWindowExtEx (WINEDC *dc_attr, INT cx, INT cy)
 
BOOL EMFDC_SetViewportOrgEx (WINEDC *dc_attr, INT x, INT y)
 
BOOL EMFDC_SetWindowOrgEx (WINEDC *dc_attr, INT x, INT y)
 
BOOL EMFDC_ScaleViewportExtEx (WINEDC *dc_attr, INT x_num, INT x_denom, INT y_num, INT y_denom)
 
BOOL EMFDC_ScaleWindowExtEx (WINEDC *dc_attr, INT x_num, INT x_denom, INT y_num, INT y_denom)
 
BOOL EMFDC_SetLayout (WINEDC *dc_attr, DWORD layout)
 
BOOL EMFDC_SetWorldTransform (WINEDC *dc_attr, const XFORM *xform)
 
BOOL EMFDC_ModifyWorldTransform (WINEDC *dc_attr, const XFORM *xform, DWORD mode)
 
BOOL EMFDC_SetMapperFlags (WINEDC *dc_attr, DWORD flags)
 
BOOL EMFDC_AbortPath (WINEDC *dc_attr)
 
BOOL EMFDC_BeginPath (WINEDC *dc_attr)
 
BOOL EMFDC_CloseFigure (WINEDC *dc_attr)
 
BOOL EMFDC_EndPath (WINEDC *dc_attr)
 
BOOL EMFDC_FlattenPath (WINEDC *dc_attr)
 
BOOL EMFDC_SelectClipPath (WINEDC *dc_attr, INT mode)
 
BOOL EMFDC_WidenPath (WINEDC *dc_attr)
 
BOOL EMFDC_DeleteDC (WINEDC *dc_attr)
 
BOOL EMFDC_WriteEscape (WINEDC *dc_attr, INT nEscape, INT cbInput, LPSTR lpszInData, DWORD emrType)
 
BOOL EMFDC_WriteNamedEscape (WINEDC *dc_attr, PWCHAR pDriver, INT nEscape, INT cbInput, LPCSTR lpszInData)
 
BOOL EMFDC_SetMetaRgn (WINEDC *dc_attr)
 
BOOL EMFDC_SetBrushOrg (WINEDC *dc_attr, INT x, INT y)
 
BOOL WINAPI EMFDC_GdiComment (HDC hdc, UINT bytes, const BYTE *buffer)
 
HDC WINAPI CreateEnhMetaFileA (HDC hdc, const char *filename, const RECT *rect, const char *description)
 
HDC WINAPI CreateEnhMetaFileW (HDC hdc, const WCHAR *filename, const RECT *rect, const WCHAR *description)
 
HENHMETAFILE WINAPI CloseEnhMetaFile (HDC hdc)
 

Variables

static const RECTL empty_bounds = { 0, 0, -1, -1 }
 

Macro Definition Documentation

◆ GdiGetEMFRestorDc

#define GdiGetEMFRestorDc   5

Definition at line 1836 of file emfdc.c.

◆ HANDLE_LIST_INC

#define HANDLE_LIST_INC   20

Definition at line 56 of file emfdc.c.

Function Documentation

◆ can_use_short_points()

static BOOL can_use_short_points ( const POINT pts,
UINT  count 
)
static

Definition at line 571 of file emfdc.c.

572 {
573  UINT i;
574 
575  for (i = 0; i < count; i++)
576  if (((pts[i].x + 0x8000) & ~0xffff) || ((pts[i].y + 0x8000) & ~0xffff))
577  return FALSE;
578  return TRUE;
579 }
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define FALSE
Definition: types.h:117
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
unsigned int UINT
Definition: ndis.h:50
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by emfdc_poly_polylinegon(), EMFDC_PolyDraw(), and emfdc_polylinegon().

◆ CloseEnhMetaFile()

HENHMETAFILE WINAPI CloseEnhMetaFile ( HDC  hdc)

Definition at line 2509 of file emfdc.c.

2510 {
2511  HENHMETAFILE hmf;
2512  struct emf *emf;
2513  WINEDC *dc_attr;
2514  EMREOF emr;
2515  HANDLE mapping = 0;
2516 
2517  if (!(dc_attr = get_dc_ptr( hdc )) || !dc_attr->emf) return 0;
2518  emf = dc_attr->emf;
2519 
2520  if (dc_attr->save_level)
2521  RestoreDC( hdc, 1 );
2522 
2523  if (emf->dc_brush) DeleteObject( emf->dc_brush );
2524  if (emf->dc_pen) DeleteObject( emf->dc_pen );
2525 
2526  emr.emr.iType = EMR_EOF;
2527  emr.emr.nSize = sizeof(emr);
2528  emr.nPalEntries = 0;
2529  emr.offPalEntries = FIELD_OFFSET(EMREOF, nSizeLast);
2530  emr.nSizeLast = emr.emr.nSize;
2531  emfdc_record( emf, &emr.emr );
2532 
2534 
2535  /* Update rclFrame if not initialized in CreateEnhMetaFile */
2536  if (emf->emh->rclFrame.left > emf->emh->rclFrame.right)
2537  {
2539  emf->emh->szlMillimeters.cx * 100 / emf->emh->szlDevice.cx;
2541  emf->emh->szlMillimeters.cy * 100 / emf->emh->szlDevice.cy;
2543  emf->emh->szlMillimeters.cx * 100 / emf->emh->szlDevice.cx;
2545  emf->emh->szlMillimeters.cy * 100 / emf->emh->szlDevice.cy;
2546  }
2547 
2548  if (emf->file) /* disk based metafile */
2549  {
2550  DWORD bytes_written;
2551 
2552  if (!WriteFile( emf->file, emf->emh, emf->emh->nBytes, &bytes_written, NULL ))
2553  {
2554  CloseHandle( emf->file );
2555  return 0;
2556  }
2557  HeapFree( GetProcessHeap(), 0, emf->emh );
2559  TRACE( "mapping = %p\n", mapping );
2560  emf->emh = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
2561  TRACE( "view = %p\n", emf->emh );
2562  CloseHandle( mapping );
2563  CloseHandle( emf->file );
2564  }
2565 
2566  hmf = EMF_Create_HENHMETAFILE( emf->emh, emf->emh->nBytes, emf->file != 0 );
2567  emf->emh = NULL; /* So it won't be deleted */
2568  DeleteDC( hdc );
2569  return hmf;
2570 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
DWORD offPalEntries
Definition: wingdi.h:1861
#define CloseHandle
Definition: compat.h:739
SIZEL szlDevice
Definition: wingdi.h:2333
#define MapViewOfFile
Definition: compat.h:745
HPEN dc_pen
Definition: emfdc.c:52
INT save_level
Definition: gdi_private.h:131
SIZEL szlMillimeters
Definition: wingdi.h:2334
long bottom
Definition: polytest.cpp:53
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
long right
Definition: polytest.cpp:53
RECTL emf_bounds
Definition: gdi_private.h:132
#define EMR_EOF
Definition: wingdi.h:88
HBRUSH dc_brush
Definition: emfdc.c:51
long top
Definition: polytest.cpp:53
EMR emr
Definition: wingdi.h:1859
LONG cx
Definition: windef.h:334
#define FILE_MAP_READ
Definition: compat.h:776
HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, DWORD filesize, BOOL on_disk)
Definition: enhmetafile.c:259
long left
Definition: polytest.cpp:53
WINEDC * dc_attr
Definition: emfdc.c:47
DWORD nPalEntries
Definition: wingdi.h:1860
#define TRACE(s)
Definition: solgame.cpp:4
RECTL rclFrame
Definition: wingdi.h:2323
#define GetProcessHeap()
Definition: compat.h:736
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
DWORD nSize
Definition: wingdi.h:1691
HDC hdc
Definition: main.c:9
Definition: emfdc.c:44
ENHMETAHEADER * emh
Definition: emfdc.c:46
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
RECTL rclBounds
Definition: wingdi.h:2322
DWORD iType
Definition: wingdi.h:1690
BOOL WINAPI DeleteDC(_In_ HDC)
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NULL
Definition: types.h:112
#define PAGE_READONLY
Definition: compat.h:138
DC * get_dc_ptr(HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:147
DWORD nSizeLast
Definition: wingdi.h:1862
HANDLE file
Definition: emfdc.c:50
BOOL WINAPI RestoreDC(_In_ HDC, _In_ int)
LONG cy
Definition: windef.h:335
#define HeapFree(x, y, z)
Definition: compat.h:735
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

◆ CreateEnhMetaFileA()

HDC WINAPI CreateEnhMetaFileA ( HDC  hdc,
const char filename,
const RECT rect,
const char description 
)

Definition at line 2355 of file emfdc.c.

2357 {
2358  WCHAR *filenameW = NULL;
2359  WCHAR *descriptionW = NULL;
2360  DWORD len1, len2, total;
2361  HDC ret;
2362 
2363  if (filename)
2364  {
2365  total = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
2366  filenameW = HeapAlloc( GetProcessHeap(), 0, total * sizeof(WCHAR) );
2368  }
2369 
2370  if(description)
2371  {
2372  len1 = (DWORD)strlen(description);
2373  len2 = (DWORD)strlen(description + len1 + 1);
2374  total = MultiByteToWideChar( CP_ACP, 0, description, len1 + len2 + 3, NULL, 0 );
2375  descriptionW = HeapAlloc( GetProcessHeap(), 0, total * sizeof(WCHAR) );
2376  MultiByteToWideChar( CP_ACP, 0, description, len1 + len2 + 3, descriptionW, total );
2377  }
2378 
2380 
2383  return ret;
2384 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CP_ACP
Definition: compat.h:109
static HDC
Definition: imagelist.c:92
const char * description
Definition: directx.c:2497
const char * filename
Definition: ioapi.h:137
#define DWORD
Definition: nt_native.h:44
& rect
Definition: startmenu.cpp:1413
static const WCHAR filenameW[]
Definition: amstream.c:41
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
HDC hdc
Definition: main.c:9
HDC WINAPI CreateEnhMetaFileW(HDC hdc, const WCHAR *filename, const RECT *rect, const WCHAR *description)
Definition: emfdc.c:2389
#define NULL
Definition: types.h:112
size_t total
#define MultiByteToWideChar
Definition: compat.h:110
static const WCHAR descriptionW[]
Definition: error.c:32
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ CreateEnhMetaFileW()

HDC WINAPI CreateEnhMetaFileW ( HDC  hdc,
const WCHAR filename,
const RECT rect,
const WCHAR description 
)

(dc_attr = get_dc_ptr( ret )) ||

Definition at line 2389 of file emfdc.c.

2391 {
2392  HDC ret;
2393  struct emf *emf;
2394  WINEDC *dc_attr;
2395  HANDLE file;
2396  DWORD size = 0, length = 0;
2397 
2398  TRACE( "(%p %s %s %s)\n", hdc, debugstr_w(filename), wine_dbgstr_rect(rect),
2400 
2401  //if (!(ret = NtGdiCreateMetafileDC( hdc ))) return 0;
2403  {
2404  if (dc_attr->hdc) DeleteDC( dc_attr->hdc );
2405  return 0;
2406  }
2407 
2408  ret = dc_attr->hdc;
2409 
2410  if ( !(emf = HeapAlloc( GetProcessHeap(), 0, sizeof(*emf) )))
2411  {
2412  DeleteDC( ret );
2413  return 0;
2414  }
2415 
2416  emf->dc_attr = dc_attr;
2417  dc_attr->emf = emf;
2418 
2419  if (description) /* App name\0Title\0\0 */
2420  {
2422  length += lstrlenW( description + length + 1 );
2423  length += 3;
2424  length *= 2;
2425  }
2426  size = sizeof(ENHMETAHEADER) + (length + 3) / 4 * 4;
2427 
2429  {
2430  DeleteDC( ret );
2431  return 0;
2432  }
2433  emf->dc_attr = dc_attr;
2434 
2436  HANDLE_LIST_INC * sizeof(emf->handles[0]) );
2438  emf->cur_handles = 1;
2439  emf->file = 0;
2440  emf->dc_brush = 0;
2441  emf->dc_pen = 0;
2442  emf->path = FALSE;
2443 
2444  emf->emh->iType = EMR_HEADER;
2445  emf->emh->nSize = size;
2446 
2449 
2450  if (rect)
2451  {
2452  emf->emh->rclFrame.left = rect->left;
2453  emf->emh->rclFrame.top = rect->top;
2454  emf->emh->rclFrame.right = rect->right;
2455  emf->emh->rclFrame.bottom = rect->bottom;
2456  }
2457  else
2458  {
2459  /* Set this to {0,0 - -1,-1} and update it at the end */
2460  emf->emh->rclFrame.left = emf->emh->rclFrame.top = 0;
2461  emf->emh->rclFrame.right = emf->emh->rclFrame.bottom = -1;
2462  }
2463 
2465  emf->emh->nVersion = 0x10000;
2466  emf->emh->nBytes = emf->emh->nSize;
2467  emf->emh->nRecords = 1;
2468  emf->emh->nHandles = 1;
2469 
2470  emf->emh->sReserved = 0; /* According to docs, this is reserved and must be 0 */
2471  emf->emh->nDescription = length / 2;
2472 
2473  emf->emh->offDescription = length ? sizeof(ENHMETAHEADER) : 0;
2474 
2475  emf->emh->nPalEntries = 0; /* I guess this should start at 0 */
2476 
2477  /* Size in pixels */
2480 
2481  /* Size in millimeters */
2484 
2485  /* Size in micrometers */
2486  emf->emh->szlMicrometers.cx = emf->emh->szlMillimeters.cx * 1000;
2487  emf->emh->szlMicrometers.cy = emf->emh->szlMillimeters.cy * 1000;
2488 
2489  memcpy( (char *)emf->emh + sizeof(ENHMETAHEADER), description, length );
2490 
2491  if (filename) /* disk based metafile */
2492  {
2495  {
2496  DeleteDC( ret );
2497  return 0;
2498  }
2499  emf->file = file;
2500  }
2501 
2502  TRACE( "returning %p\n", ret );
2503  return ret;
2504 }
#define HORZRES
Definition: wingdi.h:716
struct tagENHMETAHEADER ENHMETAHEADER
SIZEL szlDevice
Definition: wingdi.h:2333
HPEN dc_pen
Definition: emfdc.c:52
HGDIOBJ * handles
Definition: emfdc.c:49
#define HANDLE_LIST_INC
Definition: emfdc.c:56
SIZEL szlMillimeters
Definition: wingdi.h:2334
static HDC
Definition: imagelist.c:92
long bottom
Definition: polytest.cpp:53
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
const char * description
Definition: directx.c:2497
DWORD offDescription
Definition: wingdi.h:2331
const char * filename
Definition: ioapi.h:137
#define lstrlenW
Definition: compat.h:750
& rect
Definition: startmenu.cpp:1413
long right
Definition: polytest.cpp:53
RECTL emf_bounds
Definition: gdi_private.h:132
#define FALSE
Definition: types.h:117
HBRUSH dc_brush
Definition: emfdc.c:51
#define GENERIC_WRITE
Definition: nt_native.h:90
long top
Definition: polytest.cpp:53
#define debugstr_w
Definition: kernel32.h:32
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
LONG cx
Definition: windef.h:334
long left
Definition: polytest.cpp:53
WINEDC * dc_attr
Definition: emfdc.c:47
DC * alloc_dc_ptr(WORD magic) DECLSPEC_HIDDEN
Definition: rosglue.c:106
DWORD dSignature
Definition: wingdi.h:2324
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
RECTL rclFrame
Definition: wingdi.h:2323
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define OBJ_ENHMETADC
Definition: objidl.idl:1420
const char file[]
Definition: icontest.c:11
const char * wine_dbgstr_rect(const RECT *rect)
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
HDC hdc
Definition: main.c:9
BOOL path
Definition: emfdc.c:53
#define EMR_HEADER
Definition: wingdi.h:75
DWORD nRecords
Definition: wingdi.h:2327
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define GENERIC_READ
Definition: compat.h:135
Definition: emfdc.c:44
#define ENHMETA_SIGNATURE
Definition: wingdi.h:204
UINT cur_handles
Definition: emfdc.c:48
ENHMETAHEADER * emh
Definition: emfdc.c:46
#define HORZSIZE
Definition: wingdi.h:714
#define CREATE_ALWAYS
Definition: disk.h:72
#define VERTSIZE
Definition: wingdi.h:715
BOOL WINAPI DeleteDC(_In_ HDC)
#define NULL
Definition: types.h:112
#define VERTRES
Definition: wingdi.h:717
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define CreateFileW
Definition: compat.h:741
DWORD nVersion
Definition: wingdi.h:2325
DWORD nDescription
Definition: wingdi.h:2330
HANDLE file
Definition: emfdc.c:50
DWORD nPalEntries
Definition: wingdi.h:2332
UINT handles_size
Definition: emfdc.c:48
LONG cy
Definition: windef.h:335
Definition: fci.c:126

Referenced by CreateEnhMetaFileA().

◆ EMFDC_AbortPath()

BOOL EMFDC_AbortPath ( WINEDC dc_attr)

Definition at line 2144 of file emfdc.c.

2145 {
2146  struct emf *emf = dc_attr->emf;
2147  EMRABORTPATH emr;
2148 
2149  emr.emr.iType = EMR_ABORTPATH;
2150  emr.emr.nSize = sizeof(emr);
2151 
2152  emf->path = FALSE;
2153  return emfdc_record( dc_attr->emf, &emr.emr );
2154 }
#define EMR_ABORTPATH
Definition: wingdi.h:142
#define FALSE
Definition: types.h:117
WINEDC * dc_attr
Definition: emfdc.c:47
DWORD nSize
Definition: wingdi.h:1691
BOOL path
Definition: emfdc.c:53
Definition: emfdc.c:44
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690

◆ emfdc_add_handle()

static UINT emfdc_add_handle ( struct emf emf,
HGDIOBJ  obj 
)
static

Definition at line 199 of file emfdc.c.

200 {
201  UINT index;
202 
203  for (index = 0; index < emf->handles_size; index++)
204  if (emf->handles[index] == 0) break;
205 
206  if (index == emf->handles_size)
207  {
210  emf->handles,
211  emf->handles_size * sizeof(emf->handles[0]) );
212  }
214 
215  emf->cur_handles++;
216  if (emf->cur_handles > emf->emh->nHandles)
217  emf->emh->nHandles++;
218 
219  return index + 1; /* index 0 is reserved for the hmf, so we increment everything by 1 */
220 }
HGDIOBJ * handles
Definition: emfdc.c:49
#define HANDLE_LIST_INC
Definition: emfdc.c:56
HGDIOBJ get_full_gdi_handle(HGDIOBJ handle) DECLSPEC_HIDDEN
GLuint index
Definition: glext.h:6031
#define GetProcessHeap()
Definition: compat.h:736
#define index(s, c)
Definition: various.h:29
Definition: emfdc.c:44
UINT cur_handles
Definition: emfdc.c:48
ENHMETAHEADER * emh
Definition: emfdc.c:46
#define HeapReAlloc
Definition: compat.h:734
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
UINT handles_size
Definition: emfdc.c:48

Referenced by emfdc_create_brush(), emfdc_create_font(), emfdc_create_palette(), and emfdc_create_pen().

◆ EMFDC_AlphaBlend()

BOOL EMFDC_AlphaBlend ( WINEDC dc_attr,
INT  x_dst,
INT  y_dst,
INT  width_dst,
INT  height_dst,
HDC  hdc_src,
INT  x_src,
INT  y_src,
INT  width_src,
INT  height_src,
BLENDFUNCTION  blend_function 
)

Definition at line 1399 of file emfdc.c.

1402 {
1403  return emfdrv_stretchblt( dc_attr->emf, x_dst, y_dst, width_dst, height_dst, hdc_src,
1404  x_src, y_src, width_src, height_src, *(DWORD *)&blend_function,
1405  EMR_ALPHABLEND );
1406 }
WINEDC * dc_attr
Definition: emfdc.c:47
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL emfdrv_stretchblt(struct emf *emf, INT x_dst, INT y_dst, INT width_dst, INT height_dst, HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src, DWORD rop, DWORD type)
Definition: emfdc.c:1320

◆ EMFDC_AngleArc()

BOOL EMFDC_AngleArc ( WINEDC dc_attr,
INT  x,
INT  y,
DWORD  radius,
FLOAT  start,
FLOAT  sweep 
)

Definition at line 745 of file emfdc.c.

746 {
747  EMRANGLEARC emr;
748 
749  emr.emr.iType = EMR_ANGLEARC;
750  emr.emr.nSize = sizeof( emr );
751  emr.ptlCenter.x = x;
752  emr.ptlCenter.y = y;
753  emr.nRadius = radius;
754  emr.eStartAngle = start;
755  emr.eSweepAngle = sweep;
756  return emfdc_record( dc_attr->emf, &emr.emr );
757 }
POINTL ptlCenter
Definition: wingdi.h:1709
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
FLOAT eSweepAngle
Definition: wingdi.h:1712
LONG y
Definition: windef.h:330
DWORD nRadius
Definition: wingdi.h:1710
WINEDC * dc_attr
Definition: emfdc.c:47
LONG x
Definition: windef.h:329
DWORD nSize
Definition: wingdi.h:1691
#define EMR_ANGLEARC
Definition: wingdi.h:115
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
GLuint start
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
FLOAT eStartAngle
Definition: wingdi.h:1711

◆ EMFDC_ArcChordPie()

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

Definition at line 711 of file emfdc.c.

713 {
714  struct emf *emf = dc_attr->emf;
715  EMRARC emr;
716  INT temp;
717  BOOL Ret;
718 
719  if (left == right || top == bottom) return FALSE;
720 
721  if (left > right) { temp = left; left = right; right = temp; }
722  if (top > bottom) { temp = top; top = bottom; bottom = temp; }
723 
725  {
726  right--;
727  bottom--;
728  }
729 
730  emr.emr.iType = type;
731  emr.emr.nSize = sizeof(emr);
732  emr.rclBox.left = left;
733  emr.rclBox.top = top;
734  emr.rclBox.right = right;
735  emr.rclBox.bottom = bottom;
736  emr.ptlStart.x = xstart;
737  emr.ptlStart.y = ystart;
738  emr.ptlEnd.x = xend;
739  emr.ptlEnd.y = yend;
740  Ret = emfdc_record( emf, &emr.emr );
741  EMFDRV_ArcChordPie( dc_attr, left, top, right, bottom, xstart, ystart, xend, yend, type );
742  return Ret;
743 }
POINTL ptlStart
Definition: wingdi.h:1717
long bottom
Definition: polytest.cpp:53
int32_t INT
Definition: typedefs.h:58
LONG y
Definition: windef.h:330
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
long right
Definition: polytest.cpp:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long top
Definition: polytest.cpp:53
GLint GLint bottom
Definition: glext.h:7726
long left
Definition: polytest.cpp:53
WINEDC * dc_attr
Definition: emfdc.c:47
int WINAPI GetGraphicsMode(_In_ HDC)
GLint left
Definition: glext.h:7726
LONG x
Definition: windef.h:329
GLdouble GLdouble right
Definition: glext.h:10859
EMR emr
Definition: wingdi.h:1715
#define GM_COMPATIBLE
Definition: wingdi.h:864
POINTL ptlEnd
Definition: wingdi.h:1718
DWORD nSize
Definition: wingdi.h:1691
Definition: emfdc.c:44
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
static calc_node_t temp
Definition: rpn_ieee.c:38
RECTL rclBox
Definition: wingdi.h:1716
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

◆ EMFDC_BeginPath()

BOOL EMFDC_BeginPath ( WINEDC dc_attr)

Definition at line 2156 of file emfdc.c.

2157 {
2158  struct emf *emf = dc_attr->emf;
2159  EMRBEGINPATH emr;
2160 
2161  emr.emr.iType = EMR_BEGINPATH;
2162  emr.emr.nSize = sizeof(emr);
2163  if (!emfdc_record( emf, &emr.emr )) return FALSE;
2164 
2165  emf->path = TRUE;
2166  return TRUE;
2167 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
WINEDC * dc_attr
Definition: emfdc.c:47
DWORD nSize
Definition: wingdi.h:1691
BOOL path
Definition: emfdc.c:53
Definition: emfdc.c:44
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
#define EMR_BEGINPATH
Definition: wingdi.h:133

◆ EMFDC_BitBlt()

BOOL EMFDC_BitBlt ( WINEDC dc_attr,
INT  x_dst,
INT  y_dst,
INT  width,
INT  height,
HDC  hdc_src,
INT  x_src,
INT  y_src,
DWORD  rop 
)

Definition at line 1450 of file emfdc.c.

1452 {
1453  if (!rop_uses_src( rop )) return EMFDC_PatBlt( dc_attr, x_dst, y_dst, width, height, rop );
1454  return emfdrv_stretchblt( dc_attr->emf, x_dst, y_dst, width, height,
1455  hdc_src, x_src, y_src, width, height, rop, EMR_BITBLT );
1456 }
GLint GLint GLsizei width
Definition: gl.h:1546
BOOL EMFDC_PatBlt(WINEDC *dc_attr, INT left, INT top, INT width, INT height, DWORD rop)
Definition: emfdc.c:1408
static BOOL rop_uses_src(DWORD rop)
Definition: emfdc.c:1445
static int rop(int rop, int src, int dst)
Definition: nanoxwin.c:124
WINEDC * dc_attr
Definition: emfdc.c:47
#define EMR_BITBLT
Definition: wingdi.h:149
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
static BOOL emfdrv_stretchblt(struct emf *emf, INT x_dst, INT y_dst, INT width_dst, INT height_dst, HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src, DWORD rop, DWORD type)
Definition: emfdc.c:1320

◆ EMFDC_CloseFigure()

BOOL EMFDC_CloseFigure ( WINEDC dc_attr)

Definition at line 2169 of file emfdc.c.

2170 {
2171  EMRCLOSEFIGURE emr;
2172 
2173  emr.emr.iType = EMR_CLOSEFIGURE;
2174  emr.emr.nSize = sizeof(emr);
2175  return emfdc_record( dc_attr->emf, &emr.emr );
2176 }
WINEDC * dc_attr
Definition: emfdc.c:47
DWORD nSize
Definition: wingdi.h:1691
#define EMR_CLOSEFIGURE
Definition: wingdi.h:135
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690

◆ emfdc_create_brush()

static DWORD emfdc_create_brush ( struct emf emf,
HBRUSH  brush 
)
static

Definition at line 251 of file emfdc.c.

252 {
253  DWORD index = 0;
254  LOGBRUSH logbrush;
255 
256  if (!GetObjectA( brush, sizeof(logbrush), &logbrush )) return 0;
257 
258  switch (logbrush.lbStyle) {
259  case BS_SOLID:
260  case BS_HATCHED:
261  case BS_NULL:
262  {
265  emr.emr.nSize = sizeof(emr);
266  emr.ihBrush = index = emfdc_add_handle( emf, brush );
267  emr.lb.lbStyle = logbrush.lbStyle;
268  emr.lb.lbColor = logbrush.lbColor;
269  emr.lb.lbHatch = logbrush.lbHatch;
270 
271  if(!emfdc_record( emf, &emr.emr ))
272  index = 0;
273  }
274  break;
275  case BS_PATTERN:
276  case BS_DIBPATTERN:
277  {
278  unsigned char buffer[FIELD_OFFSET(BITMAPINFO, bmiColors)
279  + 256*RTL_FIELD_SIZE(BITMAPINFO, bmiColors)];
282  DWORD info_size;
283  UINT usage;
284 
285  if (!get_brush_bitmap_info( brush, info, NULL, &usage )) break;
286  info_size = get_dib_info_size( info, usage );
287 
288  emr = HeapAlloc( GetProcessHeap(), 0,
289  sizeof(EMRCREATEDIBPATTERNBRUSHPT) + sizeof(DWORD) +
290  info_size+info->bmiHeader.biSizeImage );
291  if(!emr) break;
292 
293  /* FIXME: There is an extra DWORD written by native before the BMI.
294  * Not sure what it's meant to contain.
295  */
296  emr->offBmi = sizeof( EMRCREATEDIBPATTERNBRUSHPT ) + sizeof(DWORD);
297  *(DWORD *)(emr + 1) = 0x20000000;
298 
299  if (logbrush.lbStyle == BS_PATTERN && info->bmiHeader.biBitCount == 1)
300  {
301  /* Presumably to reduce the size of the written EMF, MS supports an
302  * undocumented iUsage value of 2, indicating a mono bitmap without the
303  * 8 byte 2 entry black/white palette. Stupidly, they could have saved
304  * over 20 bytes more by also ignoring the BITMAPINFO fields that are
305  * irrelevant/constant for monochrome bitmaps.
306  * FIXME: It may be that the DIB functions themselves accept this value.
307  */
310  emr->cbBmi = sizeof( BITMAPINFOHEADER );
311  }
312  else
313  {
315  emr->cbBmi = info_size;
316  }
317  emr->ihBrush = index = emfdc_add_handle( emf, brush );
318  emr->iUsage = usage;
319  emr->offBits = emr->offBmi + emr->cbBmi;
320  emr->cbBits = info->bmiHeader.biSizeImage;
321  emr->emr.nSize = emr->offBits + emr->cbBits;
322 
323  if (info->bmiHeader.biClrUsed == 1 << info->bmiHeader.biBitCount)
324  info->bmiHeader.biClrUsed = 0;
325  memcpy( (BYTE *)emr + emr->offBmi, info, emr->cbBmi );
326  get_brush_bitmap_info( brush, NULL, (char *)emr + emr->offBits, NULL );
327 
328  if (!emfdc_record( emf, &emr->emr )) index = 0;
329  HeapFree( GetProcessHeap(), 0, emr );
330  }
331  break;
332 
333  default:
334  FIXME("Unknown style %x\n", logbrush.lbStyle);
335  break;
336  }
337 
338  return index;
339 }
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define RTL_FIELD_SIZE(type, field)
Definition: kdb_expr.c:84
#define BS_DIBPATTERN
Definition: wingdi.h:1092
ULONG lbHatch
Definition: wingdi.h:1755
UINT lbStyle
Definition: wingdi.h:1747
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
ULONG_PTR lbHatch
Definition: wingdi.h:1749
GLuint buffer
Definition: glext.h:5915
#define BS_NULL
Definition: wingdi.h:1087
#define FIXME(fmt,...)
Definition: debug.h:111
GLuint index
Definition: glext.h:6031
COLORREF lbColor
Definition: wingdi.h:1754
static UINT emfdc_add_handle(struct emf *emf, HGDIOBJ obj)
Definition: emfdc.c:199
#define EMR_CREATEDIBPATTERNBRUSHPT
Definition: wingdi.h:167
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
COLORREF lbColor
Definition: wingdi.h:1748
unsigned long DWORD
Definition: ntddk_ex.h:95
#define EMR_CREATEBRUSHINDIRECT
Definition: wingdi.h:113
BOOL get_brush_bitmap_info(HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage) DECLSPEC_HIDDEN
DWORD nSize
Definition: wingdi.h:1691
#define index(s, c)
Definition: various.h:29
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: emfdc.c:44
UINT lbStyle
Definition: wingdi.h:1753
unsigned char BYTE
Definition: xxhash.c:193
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
struct tagEMRCREATEDIBPATTERNBRUSHPT EMRCREATEDIBPATTERNBRUSHPT
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define DIB_PAL_MONO
Definition: gdi_private.h:196
#define BS_PATTERN
Definition: wingdi.h:1090
static int get_dib_info_size(const BITMAPINFO *info, UINT coloruse)
Definition: gdi_private.h:212
#define BS_HATCHED
Definition: wingdi.h:1089
#define BS_SOLID
Definition: wingdi.h:1086
#define HeapFree(x, y, z)
Definition: compat.h:735
#define EMR_CREATEMONOBRUSH
Definition: wingdi.h:166

Referenced by EMFDC_FillRgn(), EMFDC_FrameRgn(), emfdc_select_brush(), and EMFDC_SetDCBrushColor().

◆ emfdc_create_font()

static BOOL emfdc_create_font ( struct emf emf,
HFONT  font 
)
static

Definition at line 374 of file emfdc.c.

375 {
376  DWORD index = 0;
378  int i;
379 
380  if (!GetObjectW( font, sizeof(emr.elfw.elfLogFont), &emr.elfw.elfLogFont )) return FALSE;
381 
383  emr.emr.nSize = (sizeof(emr) + 3) / 4 * 4;
384  emr.ihFont = index = emfdc_add_handle( emf, font );
385  emr.elfw.elfFullName[0] = '\0';
386  emr.elfw.elfStyle[0] = '\0';
387  emr.elfw.elfVersion = 0;
388  emr.elfw.elfStyleSize = 0;
389  emr.elfw.elfMatch = 0;
390  emr.elfw.elfReserved = 0;
391  for (i = 0; i < ELF_VENDOR_SIZE; i++)
392  emr.elfw.elfVendorId[i] = 0;
404 
405  return emfdc_record( emf, &emr.emr ) ? index : 0;
406 }
BYTE bWeight
Definition: wingdi.h:1871
BYTE bFamilyType
Definition: wingdi.h:1869
Definition: mk_font.cpp:20
BYTE bContrast
Definition: wingdi.h:1873
#define PAN_CULTURE_LATIN
Definition: wingdi.h:464
#define EMR_EXTCREATEFONTINDIRECTW
Definition: wingdi.h:155
DWORD elfReserved
Definition: wingdi.h:1931
LOGFONTW elfLogFont
Definition: wingdi.h:1925
#define FALSE
Definition: types.h:117
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:1926
GLuint index
Definition: glext.h:6031
DWORD elfStyleSize
Definition: wingdi.h:1929
BYTE bSerifStyle
Definition: wingdi.h:1870
static UINT emfdc_add_handle(struct emf *emf, HGDIOBJ obj)
Definition: emfdc.c:199
#define PAN_NO_FIT
Definition: wingdi.h:466
BYTE bLetterform
Definition: wingdi.h:1876
unsigned long DWORD
Definition: ntddk_ex.h:95
BYTE bProportion
Definition: wingdi.h:1872
DWORD elfVersion
Definition: wingdi.h:1928
DWORD nSize
Definition: wingdi.h:1691
#define index(s, c)
Definition: various.h:29
WCHAR elfStyle[LF_FACESIZE]
Definition: wingdi.h:1927
Definition: emfdc.c:44
BYTE bMidline
Definition: wingdi.h:1877
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
DWORD iType
Definition: wingdi.h:1690
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
PANOSE elfPanose
Definition: wingdi.h:1934
BYTE bStrokeVariation
Definition: wingdi.h:1874
BYTE bArmStyle
Definition: wingdi.h:1875
BYTE bXHeight
Definition: wingdi.h:1878
DWORD elfCulture
Definition: wingdi.h:1933
#define ELF_VENDOR_SIZE
Definition: wingdi.h:293
DWORD elfMatch
Definition: wingdi.h:1930
BYTE elfVendorId[ELF_VENDOR_SIZE]
Definition: wingdi.h:1932

Referenced by emfdc_select_font().

◆ emfdc_create_palette()

static DWORD emfdc_create_palette ( struct emf emf,
HPALETTE  hPal 
)
static

Definition at line 507 of file emfdc.c.

508 {
509  WORD i;
510  struct {
512  PALETTEENTRY entry[255];
513  } pal;
514 
515  memset( &pal, 0, sizeof(pal) );
516 
517  if (!GetObjectW( hPal, sizeof(pal.hdr.lgpl) + sizeof(pal.entry), &pal.hdr.lgpl ))
518  return 0;
519 
520  for (i = 0; i < pal.hdr.lgpl.palNumEntries; i++)
521  pal.hdr.lgpl.palPalEntry[i].peFlags = 0;
522 
523  pal.hdr.emr.iType = EMR_CREATEPALETTE;
524  pal.hdr.emr.nSize = sizeof(pal.hdr) + pal.hdr.lgpl.palNumEntries * sizeof(PALETTEENTRY);
525  pal.hdr.ihPal = emfdc_add_handle( emf, hPal );
526 
527  if (!emfdc_record( emf, &pal.hdr.emr ))
528  pal.hdr.ihPal = 0;
529  return pal.hdr.ihPal;
530 }
char hdr[14]
Definition: iptest.cpp:33
#define EMR_CREATEPALETTE
Definition: wingdi.h:123
static UINT emfdc_add_handle(struct emf *emf, HGDIOBJ obj)
Definition: emfdc.c:199
unsigned short WORD
Definition: ntddk_ex.h:93
uint32_t entry
Definition: isohybrid.c:63
Definition: emfdc.c:44
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
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
struct tagPALETTEENTRY PALETTEENTRY
#define memset(x, y, z)
Definition: compat.h:39

Referenced by EMFDC_SelectPalette().

◆ emfdc_create_pen()

static DWORD emfdc_create_pen ( struct emf emf,
HPEN  hPen 
)
static

Definition at line 443 of file emfdc.c.

444 {
445  EMRCREATEPEN emr;
446  DWORD index = 0;
447 
448  if (!GetObjectW( hPen, sizeof(emr.lopn), &emr.lopn ))
449  {
450  /* must be an extended pen */
451  EXTLOGPEN *elp;
452  INT size = GetObjectW( hPen, 0, NULL );
453 
454  if (!size) return 0;
455 
456  elp = HeapAlloc( GetProcessHeap(), 0, size );
457 
458  GetObjectW( hPen, size, elp );
459  /* FIXME: add support for user style pens */
460  emr.lopn.lopnStyle = elp->elpPenStyle;
461  emr.lopn.lopnWidth.x = elp->elpWidth;
462  emr.lopn.lopnWidth.y = 0;
463  emr.lopn.lopnColor = elp->elpColor;
464 
465  HeapFree( GetProcessHeap(), 0, elp );
466  }
467 
468  emr.emr.iType = EMR_CREATEPEN;
469  emr.emr.nSize = sizeof(emr);
470  emr.ihPen = index = emfdc_add_handle( emf, hPen );
471  return emfdc_record( emf, &emr.emr ) ? index : 0;
472 }
COLORREF elpColor
Definition: wingdi.h:1945
long y
Definition: polytest.cpp:48
DWORD elpWidth
Definition: wingdi.h:1943
long x
Definition: polytest.cpp:48
POINT lopnWidth
Definition: wingdi.h:1846
int32_t INT
Definition: typedefs.h:58
LOGPEN lopn
Definition: wingdi.h:1852
DWORD elpPenStyle
Definition: wingdi.h:1942
UINT lopnStyle
Definition: wingdi.h:1845
COLORREF lopnColor
Definition: wingdi.h:1847
GLuint index
Definition: glext.h:6031
static UINT emfdc_add_handle(struct emf *emf, HGDIOBJ obj)
Definition: emfdc.c:199
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD nSize
Definition: wingdi.h:1691
#define EMR_CREATEPEN
Definition: wingdi.h:112
#define index(s, c)
Definition: various.h:29
Definition: emfdc.c:44
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
DWORD iType
Definition: wingdi.h:1690
#define NULL
Definition: types.h:112
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by emfdc_select_pen(), and EMFDC_SetDCPenColor().

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

BOOL EMFDC_DeleteDC ( WINEDC dc_attr)

Definition at line 2218 of file emfdc.c.

2219 {
2220  struct emf *emf = dc_attr->emf;
2221  UINT index;
2222 
2223  HeapFree( GetProcessHeap(), 0, emf->emh );
2224  for (index = 0; index < emf->handles_size; index++)
2225  if (emf->handles[index])
2227  HeapFree( GetProcessHeap(), 0, emf->handles );
2228  return TRUE;
2229 }
HGDIOBJ * handles
Definition: emfdc.c:49
#define TRUE
Definition: types.h:120
GLuint index
Definition: glext.h:6031
WINEDC * dc_attr
Definition: emfdc.c:47
#define GetProcessHeap()
Definition: compat.h:736
#define index(s, c)
Definition: various.h:29
Definition: emfdc.c:44
ENHMETAHEADER * emh
Definition: emfdc.c:46
unsigned int UINT
Definition: ndis.h:50
void GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:182
UINT handles_size
Definition: emfdc.c:48
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ EMFDC_Ellipse()

BOOL EMFDC_Ellipse ( WINEDC dc_attr,
INT  left,
INT  top,
INT  right,
INT  bottom 
)

Definition at line 759 of file emfdc.c.

760 {
761  struct emf *emf = dc_attr->emf;
762  EMRELLIPSE emr;
763  BOOL Ret;
764 
765  if (left == right || top == bottom) return FALSE;
766 
767  emr.emr.iType = EMR_ELLIPSE;
768  emr.emr.nSize = sizeof(emr);
769  emr.rclBox.left = min( left, right );
770  emr.rclBox.top = min( top, bottom );
771  emr.rclBox.right = max( left, right );
772  emr.rclBox.bottom = max( top, bottom );
774  {
775  emr.rclBox.right--;
776  emr.rclBox.bottom--;
777  }
778  Ret = emfdc_record( emf, &emr.emr );
780  return Ret;
781 }
#define max(a, b)
Definition: svc.c:63
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
RECTL rclBox
Definition: wingdi.h:1856
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long top
Definition: polytest.cpp:53
GLint GLint bottom
Definition: glext.h:7726
long left
Definition: polytest.cpp:53
WINEDC * dc_attr
Definition: emfdc.c:47
int WINAPI GetGraphicsMode(_In_ HDC)
#define EMR_ELLIPSE
Definition: wingdi.h:116
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
#define GM_COMPATIBLE
Definition: wingdi.h:864
DWORD nSize
Definition: wingdi.h:1691
Definition: emfdc.c:44
BOOL EMFDRV_Ellipse(WINEDC *dc, INT left, INT top, INT right, INT bottom)
Definition: emfdrv.c:255
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
#define min(a, b)
Definition: monoChain.cc:55
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

◆ EMFDC_EndPath()

BOOL EMFDC_EndPath ( WINEDC dc_attr)

Definition at line 2178 of file emfdc.c.

2179 {
2180  struct emf *emf = dc_attr->emf;
2181  EMRENDPATH emr;
2182 
2183  emf->path = FALSE;
2184 
2185  emr.emr.iType = EMR_ENDPATH;
2186  emr.emr.nSize = sizeof(emr);
2187  return emfdc_record( emf, &emr.emr );
2188 }
#define EMR_ENDPATH
Definition: wingdi.h:134
#define FALSE
Definition: types.h:117
WINEDC * dc_attr
Definition: emfdc.c:47
DWORD nSize
Definition: wingdi.h:1691
BOOL path
Definition: emfdc.c:53
Definition: emfdc.c:44
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690

◆ EMFDC_ExcludeClipRect()

BOOL EMFDC_ExcludeClipRect ( WINEDC dc_attr,
INT  left,
INT  top,
INT  right,
INT  bottom 
)

Definition at line 1947 of file emfdc.c.

1948 {
1949  EMREXCLUDECLIPRECT emr;
1950 
1952  emr.emr.nSize = sizeof(emr);
1953  emr.rclClip.left = left;
1954  emr.rclClip.top = top;
1955  emr.rclClip.right = right;
1956  emr.rclClip.bottom = bottom;
1957  return emfdc_record( dc_attr->emf, &emr.emr );
1958 }
#define EMR_EXCLUDECLIPRECT
Definition: wingdi.h:103
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
GLint GLint bottom
Definition: glext.h:7726
long left
Definition: polytest.cpp:53
WINEDC * dc_attr
Definition: emfdc.c:47
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
DWORD nSize
Definition: wingdi.h:1691
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

◆ EMFDC_ExtFloodFill()

BOOL EMFDC_ExtFloodFill ( WINEDC dc_attr,
INT  x,
INT  y,
COLORREF  color,
UINT  fill_type 
)

Definition at line 998 of file emfdc.c.

999 {
1000  EMREXTFLOODFILL emr;
1001 
1002  emr.emr.iType = EMR_EXTFLOODFILL;
1003  emr.emr.nSize = sizeof(emr);
1004  emr.ptlStart.x = x;
1005  emr.ptlStart.y = y;
1006  emr.crColor = color;
1007  emr.iMode = fill_type;
1008  return emfdc_record( dc_attr->emf, &emr.emr );
1009 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG y
Definition: windef.h:330
GLuint color
Definition: glext.h:6243
WINEDC * dc_attr
Definition: emfdc.c:47
LONG x
Definition: windef.h:329
DWORD nSize
Definition: wingdi.h:1691
#define EMR_EXTFLOODFILL
Definition: wingdi.h:127
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
COLORREF crColor
Definition: wingdi.h:1962
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ EMFDC_ExtSelectClipRgn()

BOOL EMFDC_ExtSelectClipRgn ( WINEDC dc_attr,
HRGN  hrgn,
INT  mode 
)

Definition at line 1984 of file emfdc.c.

1985 {
1986  EMREXTSELECTCLIPRGN *emr;
1987  DWORD size, rgnsize;
1988  BOOL ret;
1989 
1990  if (!hrgn)
1991  {
1992  if (mode != RGN_COPY) return ERROR;
1993  rgnsize = 0;
1994  }
1995  else rgnsize = /*NtGdi*/GetRegionData( hrgn, 0, NULL );
1996 
1997  size = rgnsize + offsetof(EMREXTSELECTCLIPRGN,RgnData);
1998  emr = HeapAlloc( GetProcessHeap(), 0, size );
1999  if (rgnsize) /*NtGdi*/GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
2000 
2002  emr->emr.nSize = size;
2003  emr->cbRgnData = rgnsize;
2004  emr->iMode = mode;
2005 
2006  ret = emfdc_record( dc_attr->emf, &emr->emr );
2007  HeapFree( GetProcessHeap(), 0, emr );
2008  return ret;
2009 }
#define ERROR(name)
Definition: error_private.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
#define offsetof(TYPE, MEMBER)
WINEDC * dc_attr
Definition: emfdc.c:47
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
DWORD nSize
Definition: wingdi.h:1691
static HRGN hrgn
Definition: win.c:55
GLenum mode
Definition: glext.h:6217
#define RGN_COPY
Definition: wingdi.h:357
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
#define NULL
Definition: types.h:112
DWORD WINAPI GetRegionData(_In_ HRGN hrgn, _In_ DWORD nCount, _Out_writes_bytes_to_opt_(nCount, return) LPRGNDATA lpRgnData)
#define HeapFree(x, y, z)
Definition: compat.h:735
#define EMR_EXTSELECTCLIPRGN
Definition: wingdi.h:148

◆ EMFDC_ExtTextOut()

BOOL EMFDC_ExtTextOut ( WINEDC dc_attr,
INT  x,
INT  y,
UINT  flags,
const RECT rect,
const WCHAR str,
UINT  count,
const INT dx 
)

Definition at line 1110 of file emfdc.c.

1112 {
1113  struct emf *emf = dc_attr->emf;
1114  FLOAT ex_scale, ey_scale;
1115  EMREXTTEXTOUTW *emr;
1116  int text_height = 0;
1117  int text_width = 0;
1118  TEXTMETRICW tm;
1119  DWORD size;
1120  BOOL ret;
1121 
1122  if (count > INT_MAX) return FALSE;
1123 
1124  size = sizeof(*emr) + ((count+1) & ~1) * sizeof(WCHAR) + count * sizeof(INT);
1125 
1126  TRACE( "%s %s count %d size = %d\n", debugstr_wn(str, count),
1129 
1131  {
1132  const INT horzSize = GetDeviceCaps( dc_attr->hdc, HORZSIZE );
1133  const INT horzRes = GetDeviceCaps( dc_attr->hdc, HORZRES );
1134  const INT vertSize = GetDeviceCaps( dc_attr->hdc, VERTSIZE );
1135  const INT vertRes = GetDeviceCaps( dc_attr->hdc, VERTRES );
1136  SIZE wndext, vportext;
1137 
1138  GetViewportExtEx( dc_attr->hdc, &vportext );
1139  GetWindowExtEx( dc_attr->hdc, &wndext );
1140  ex_scale = 100.0 * ((FLOAT)horzSize / (FLOAT)horzRes) /
1141  ((FLOAT)wndext.cx / (FLOAT)vportext.cx);
1142  ey_scale = 100.0 * ((FLOAT)vertSize / (FLOAT)vertRes) /
1143  ((FLOAT)wndext.cy / (FLOAT)vportext.cy);
1144  }
1145  else
1146  {
1147  ex_scale = 0.0;
1148  ey_scale = 0.0;
1149  }
1150 
1151  emr->emr.iType = EMR_EXTTEXTOUTW;
1152  emr->emr.nSize = size;
1154  emr->exScale = ex_scale;
1155  emr->eyScale = ey_scale;
1156  emr->emrtext.ptlReference.x = x;
1157  emr->emrtext.ptlReference.y = y;
1158  emr->emrtext.nChars = count;
1159  emr->emrtext.offString = sizeof(*emr);
1160  memcpy( (char*)emr + emr->emrtext.offString, str, count * sizeof(WCHAR) );
1161  emr->emrtext.fOptions = flags;
1162  if (!rect)
1163  {
1164  emr->emrtext.rcl.left = emr->emrtext.rcl.top = 0;
1165  emr->emrtext.rcl.right = emr->emrtext.rcl.bottom = -1;
1166  }
1167  else
1168  {
1169  emr->emrtext.rcl.left = rect->left;
1170  emr->emrtext.rcl.top = rect->top;
1171  emr->emrtext.rcl.right = rect->right;
1172  emr->emrtext.rcl.bottom = rect->bottom;
1173  }
1174 
1175  emr->emrtext.offDx = emr->emrtext.offString + ((count+1) & ~1) * sizeof(WCHAR);
1176  if (dx)
1177  {
1178  UINT i;
1179  SIZE str_size;
1180  memcpy( (char*)emr + emr->emrtext.offDx, dx, count * sizeof(INT) );
1181  for (i = 0; i < count; i++) text_width += dx[i];
1182  if (GetTextExtentPoint32W( dc_attr->hdc, str, count, &str_size ))
1183  text_height = str_size.cy;
1184  }
1185  else
1186  {
1187  UINT i;
1188  INT *emf_dx = (INT *)((char*)emr + emr->emrtext.offDx);
1189  SIZE charSize;
1190  for (i = 0; i < count; i++)
1191  {
1192  if (GetTextExtentPoint32W( dc_attr->hdc, str + i, 1, &charSize ))
1193  {
1194  emf_dx[i] = charSize.cx;
1195  text_width += charSize.cx;
1196  text_height = max( text_height, charSize.cy );
1197  }
1198  }
1199  }
1200 
1201  if (emf->path)
1202  {
1203  emr->rclBounds.left = emr->rclBounds.top = 0;
1204  emr->rclBounds.right = emr->rclBounds.bottom = -1;
1205  goto no_bounds;
1206  }
1207 
1208  /* FIXME: handle font escapement */
1209  switch (GetTextAlign(dc_attr->hdc) & (TA_LEFT | TA_RIGHT | TA_CENTER))
1210  {
1211  case TA_CENTER:
1212  emr->rclBounds.left = x - (text_width / 2) - 1;
1213  emr->rclBounds.right = x + (text_width / 2) + 1;
1214  break;
1215 
1216  case TA_RIGHT:
1217  emr->rclBounds.left = x - text_width - 1;
1218  emr->rclBounds.right = x;
1219  break;
1220 
1221  default: /* TA_LEFT */
1222  emr->rclBounds.left = x;
1223  emr->rclBounds.right = x + text_width + 1;
1224  }
1225 
1226  switch (GetTextAlign(dc_attr->hdc) & (TA_TOP | TA_BOTTOM | TA_BASELINE))
1227  {
1228  case TA_BASELINE:
1229  if (!GetTextMetricsW( dc_attr->hdc, &tm )) tm.tmDescent = 0;
1230  /* Play safe here... it's better to have a bounding box */
1231  /* that is too big than too small. */
1232  emr->rclBounds.top = y - text_height - 1;
1233  emr->rclBounds.bottom = y + tm.tmDescent + 1;
1234  break;
1235 
1236  case TA_BOTTOM:
1237  emr->rclBounds.top = y - text_height - 1;
1238  emr->rclBounds.bottom = y;
1239  break;
1240 
1241  default: /* TA_TOP */
1242  emr->rclBounds.top = y;
1243  emr->rclBounds.bottom = y + text_height + 1;
1244  }
1245  emfdc_update_bounds( emf, &emr->rclBounds );
1246 
1247 no_bounds:
1248  ret = emfdc_record( emf, &emr->emr );
1249  HeapFree( GetProcessHeap(), 0, emr );
1250  return ret;
1251 }
#define max(a, b)
Definition: svc.c:63
#define HORZRES
Definition: wingdi.h:716
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
POINTL ptlReference
Definition: wingdi.h:1972
#define INT_MAX
Definition: limits.h:40
DWORD iGraphicsMode
Definition: wingdi.h:1982
GLuint GLuint GLsizei count
Definition: gl.h:1545
long bottom
Definition: polytest.cpp:53
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define FLOAT
Definition: i386-dis.c:526
#define TA_LEFT
Definition: wingdi.h:932
static void emfdc_update_bounds(struct emf *emf, RECTL *rect)
Definition: emfdc.c:84
int32_t INT
Definition: typedefs.h:58
& rect
Definition: startmenu.cpp:1413
LONG y
Definition: windef.h:330
UINT WINAPI GetTextAlign(_In_ HDC)
Definition: text.c:838
long right
Definition: polytest.cpp:53
#define TA_TOP
Definition: wingdi.h:930
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TA_BASELINE
Definition: wingdi.h:928
long top
Definition: polytest.cpp:53
RECTL rcl
Definition: wingdi.h:1976
const WCHAR * str
#define TA_BOTTOM
Definition: wingdi.h:929
LONG cx
Definition: windef.h:334
#define EMR_EXTTEXTOUTW
Definition: wingdi.h:157
long left
Definition: polytest.cpp:53
WINEDC * dc_attr
Definition: emfdc.c:47
#define TA_RIGHT
Definition: wingdi.h:933
DWORD offDx
Definition: wingdi.h:1977
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI GetViewportExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:351
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI GetGraphicsMode(_In_ HDC)
BOOL WINAPI GetWindowExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:411
const char * wine_dbgstr_rect(const RECT *rect)
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG x
Definition: windef.h:329
GLbitfield flags
Definition: glext.h:7161
#define GM_COMPATIBLE
Definition: wingdi.h:864
int ret
DWORD nSize
Definition: wingdi.h:1691
BOOL path
Definition: emfdc.c:53
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: time.h:68
Definition: emfdc.c:44
#define debugstr_wn
Definition: kernel32.h:33
#define HORZSIZE
Definition: wingdi.h:714
DWORD nChars
Definition: wingdi.h:1973
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
#define VERTSIZE
Definition: wingdi.h:715
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
DWORD fOptions
Definition: wingdi.h:1975
unsigned int UINT
Definition: ndis.h:50
DWORD offString
Definition: wingdi.h:1974
#define VERTRES
Definition: wingdi.h:717
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97
float FLOAT
Definition: typedefs.h:69
#define TA_CENTER
Definition: wingdi.h:931
LONG cy
Definition: windef.h:335
#define HeapFree(x, y, z)
Definition: compat.h:735
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
EMRTEXT emrtext
Definition: wingdi.h:1985

◆ EMFDC_FillPath()

BOOL EMFDC_FillPath ( WINEDC dc_attr)

Definition at line 1304 of file emfdc.c.

1305 {
1307 }
WINEDC * dc_attr
Definition: emfdc.c:47
#define EMR_FILLPATH
Definition: wingdi.h:136
static BOOL emfdrv_stroke_and_fill_path(struct emf *emf, INT type)
Definition: emfdc.c:665

◆ EMFDC_FillRgn()

BOOL EMFDC_FillRgn ( WINEDC dc_attr,
HRGN  hrgn,
HBRUSH  hbrush 
)

Definition at line 1011 of file emfdc.c.

1012 {
1013  struct emf *emf = dc_attr->emf;
1014  EMRFILLRGN *emr;
1015  DWORD size, rgnsize, index;
1016  BOOL ret;
1017 
1018  if (!(index = emfdc_create_brush( emf, hbrush ))) return FALSE;
1019 
1020  rgnsize = /*NtGdi*/GetRegionData( hrgn, 0, NULL );
1021  size = rgnsize + offsetof(EMRFILLRGN,RgnData);
1022  emr = HeapAlloc( GetProcessHeap(), 0, size );
1023 
1024  /*NtGdi*/GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
1025 
1026  emr->emr.iType = EMR_FILLRGN;
1027  emr->emr.nSize = size;
1028  emr->rclBounds.left = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.left;
1029  emr->rclBounds.top = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.top;
1030  emr->rclBounds.right = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.right - 1;
1031  emr->rclBounds.bottom = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.bottom - 1;
1032  emr->cbRgnData = rgnsize;
1033  emr->ihBrush = index;
1034 
1035  ret = emfdc_record( emf, &emr->emr );
1036  if (ret) emfdc_update_bounds( emf, &emr->rclBounds );
1037  HeapFree( GetProcessHeap(), 0, emr );
1038  return ret;
1039 }
static HBRUSH hbrush
DWORD ihBrush
Definition: wingdi.h:1995
long bottom
Definition: polytest.cpp:53
static void emfdc_update_bounds(struct emf *emf, RECTL *rect)
Definition: emfdc.c:84
BYTE RgnData[1]
Definition: wingdi.h:1996
long right
Definition: polytest.cpp:53
DWORD cbRgnData
Definition: wingdi.h:1994
static DWORD emfdc_create_brush(struct emf *emf, HBRUSH brush)
Definition: emfdc.c:251
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long top
Definition: polytest.cpp:53
#define offsetof(TYPE, MEMBER)
GLuint index
Definition: glext.h:6031
long left
Definition: polytest.cpp:53
WINEDC * dc_attr
Definition: emfdc.c:47
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define EMR_FILLRGN
Definition: wingdi.h:144
int ret
DWORD nSize
Definition: wingdi.h:1691
#define index(s, c)
Definition: various.h:29
static HRGN hrgn
Definition: win.c:55
Definition: emfdc.c:44
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
RECTL rclBounds
Definition: wingdi.h:1993
#define NULL
Definition: types.h:112
DWORD WINAPI GetRegionData(_In_ HRGN hrgn, _In_ DWORD nCount, _Out_writes_bytes_to_opt_(nCount, return) LPRGNDATA lpRgnData)
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ emfdc_find_object()

static UINT emfdc_find_object ( struct emf emf,
HGDIOBJ  obj 
)
static

Definition at line 222 of file emfdc.c.

223 {
224  UINT index;
225 
226  for (index = 0; index < emf->handles_size; index++)
227  if (emf->handles[index] == obj) return index + 1;
228 
229  return 0;
230 }
HGDIOBJ * handles
Definition: emfdc.c:49
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29
Definition: emfdc.c:44
unsigned int UINT
Definition: ndis.h:50
UINT handles_size
Definition: emfdc.c:48

Referenced by emfdc_delete_object(), emfdc_select_brush(), emfdc_select_font(), emfdc_select_pen(), and EMFDC_SelectPalette().

◆ EMFDC_FlattenPath()

BOOL EMFDC_FlattenPath ( WINEDC dc_attr)

Definition at line 2190 of file emfdc.c.

2191 {
2192  EMRFLATTENPATH emr;
2193 
2194  emr.emr.iType = EMR_FLATTENPATH;
2195  emr.emr.nSize = sizeof(emr);
2196  return emfdc_record( dc_attr->emf, &emr.emr );
2197 }
WINEDC * dc_attr
Definition: emfdc.c:47
DWORD nSize
Definition: wingdi.h:1691
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
#define EMR_FLATTENPATH
Definition: wingdi.h:139

◆ EMFDC_FrameRgn()

BOOL EMFDC_FrameRgn ( WINEDC dc_attr,
HRGN  hrgn,
HBRUSH  hbrush,
INT  width,
INT  height 
)

Definition at line 1041 of file emfdc.c.

1042 {
1043  struct emf *emf = dc_attr->emf;
1044  EMRFRAMERGN *emr;
1045  DWORD size, rgnsize, index;
1046  BOOL ret;
1047 
1049  if(!index) return FALSE;
1050 
1051  rgnsize = /*NtGdi*/GetRegionData( hrgn, 0, NULL );
1052  size = rgnsize + offsetof(EMRFRAMERGN,RgnData);
1053  emr = HeapAlloc( GetProcessHeap(), 0, size );
1054 
1055  /*NtGdi*/GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
1056 
1057  emr->emr.iType = EMR_FRAMERGN;
1058  emr->emr.nSize = size;
1059  emr->rclBounds.left = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.left;
1060  emr->rclBounds.top = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.top;
1061  emr->rclBounds.right = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.right - 1;
1062  emr->rclBounds.bottom = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.bottom - 1;
1063  emr->cbRgnData = rgnsize;
1064  emr->ihBrush = index;
1065  emr->szlStroke.cx = width;
1066  emr->szlStroke.cy = height;
1067 
1068  ret = emfdc_record( emf, &emr->emr );
1069  if (ret) emfdc_update_bounds( emf, &emr->rclBounds );
1070  HeapFree( GetProcessHeap(), 0, emr );
1071  return ret;
1072 }
GLint GLint GLsizei width
Definition: gl.h:1546
static HBRUSH hbrush
long bottom
Definition: polytest.cpp:53
static void emfdc_update_bounds(struct emf *emf, RECTL *rect)
Definition: emfdc.c:84
long right
Definition: polytest.cpp:53
DWORD ihBrush
Definition: wingdi.h:2017
static DWORD emfdc_create_brush(struct emf *emf, HBRUSH brush)
Definition: emfdc.c:251
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long top
Definition: polytest.cpp:53
#define offsetof(TYPE, MEMBER)
LONG cx
Definition: windef.h:334
GLuint index
Definition: glext.h:6031
#define EMR_FRAMERGN
Definition: wingdi.h:145
long left
Definition: polytest.cpp:53
WINEDC * dc_attr
Definition: emfdc.c:47
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
BYTE RgnData[1]
Definition: wingdi.h:2019
int ret
DWORD nSize
Definition: wingdi.h:1691
#define index(s, c)
Definition: various.h:29
static HRGN hrgn
Definition: win.c:55
Definition: emfdc.c:44
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
SIZEL szlStroke
Definition: wingdi.h:2018
#define NULL
Definition: types.h:112
DWORD cbRgnData
Definition: wingdi.h:2016
RECTL rclBounds
Definition: wingdi.h:2015
LONG cy
Definition: windef.h:335
DWORD WINAPI GetRegionData(_In_ HRGN hrgn, _In_ DWORD nCount, _Out_writes_bytes_to_opt_(nCount, return) LPRGNDATA lpRgnData)
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ EMFDC_GdiComment()

BOOL WINAPI EMFDC_GdiComment ( HDC  hdc,
UINT  bytes,
const BYTE buffer 
)

Definition at line 2326 of file emfdc.c.

2327 {
2328  WINEDC *dc_attr;
2329  EMRGDICOMMENT *emr;
2330  UINT total, rounded_size;
2331  BOOL ret;
2332 
2333  if (!(dc_attr = get_dc_ptr( hdc )) || !dc_attr->emf) return FALSE;
2334 
2335  rounded_size = (bytes+3) & ~3;
2336  total = offsetof(EMRGDICOMMENT,Data) + rounded_size;
2337 
2338  emr = HeapAlloc(GetProcessHeap(), 0, total);
2339  emr->emr.iType = EMR_GDICOMMENT;
2340  emr->emr.nSize = total;
2341  emr->cbData = bytes;
2342  memset(&emr->Data[bytes], 0, rounded_size - bytes);
2343  memcpy(&emr->Data[0], buffer, bytes);
2344 
2345  ret = emfdc_record( dc_attr->emf, &emr->emr );
2346 
2347  HeapFree(GetProcessHeap(), 0, emr);
2348 
2349  return ret;
2350 }
BYTE Data[1]
Definition: wingdi.h:2024
GLuint buffer
Definition: glext.h:5915
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define offsetof(TYPE, MEMBER)
WINEDC * dc_attr
Definition: emfdc.c:47
#define EMR_GDICOMMENT
Definition: wingdi.h:143
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int ret
DWORD nSize
Definition: wingdi.h:1691
HDC hdc
Definition: main.c:9
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
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
size_t total
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by GdiComment().

◆ EMFDC_GradientFill()

BOOL EMFDC_GradientFill ( WINEDC dc_attr,
TRIVERTEX vert_array,
ULONG  nvert,
void grad_array,
ULONG  ngrad,
ULONG  mode 
)

Definition at line 1253 of file emfdc.c.

1255 {
1256  EMRGRADIENTFILL *emr;
1257  ULONG i, pt, size, num_pts = ngrad * (mode == GRADIENT_FILL_TRIANGLE ? 3 : 2);
1258  const ULONG *pts = (const ULONG *)grad_array;
1259  BOOL ret;
1260 
1261  size = FIELD_OFFSET(EMRGRADIENTFILL, Ver[nvert]) + num_pts * sizeof(pts[0]);
1262 
1263  emr = HeapAlloc( GetProcessHeap(), 0, size );
1264  if (!emr) return FALSE;
1265 
1266  for (i = 0; i < num_pts; i++)
1267  {
1268  pt = pts[i];
1269 
1270  if (i == 0)
1271  {
1272  emr->rclBounds.left = emr->rclBounds.right = vert_array[pt].x;
1273  emr->rclBounds.top = emr->rclBounds.bottom = vert_array[pt].y;
1274  }
1275  else
1276  {
1277  if (vert_array[pt].x < emr->rclBounds.left)
1278  emr->rclBounds.left = vert_array[pt].x;
1279  else if (vert_array[pt].x > emr->rclBounds.right)
1280  emr->rclBounds.right = vert_array[pt].x;
1281  if (vert_array[pt].y < emr->rclBounds.top)
1282  emr->rclBounds.top = vert_array[pt].y;
1283  else if (vert_array[pt].y > emr->rclBounds.bottom)
1284  emr->rclBounds.bottom = vert_array[pt].y;
1285  }
1286  }
1287  emr->rclBounds.right--;
1288  emr->rclBounds.bottom--;
1289 
1290  emr->emr.iType = EMR_GRADIENTFILL;
1291  emr->emr.nSize = size;
1292  emr->nVer = nvert;
1293  emr->nTri = ngrad;
1294  emr->ulMode = mode;
1295  memcpy( emr->Ver, vert_array, nvert * sizeof(vert_array[0]) );
1296  memcpy( emr->Ver + nvert, pts, num_pts * sizeof(pts[0]) );
1297 
1298  emfdc_update_bounds( dc_attr->emf, &emr->rclBounds );
1299  ret = emfdc_record( dc_attr->emf, &emr->emr );
1300  HeapFree( GetProcessHeap(), 0, emr );
1301  return ret;
1302 }
#define pt(x, y)
Definition: drawing.c:79
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static void emfdc_update_bounds(struct emf *emf, RECTL *rect)
Definition: emfdc.c:84
LONG y
Definition: wingdi.h:2785
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
WINEDC * dc_attr
Definition: emfdc.c:47
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG x
Definition: wingdi.h:2784
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum mode
Definition: glext.h:6217
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
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
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ EMFDC_IntersectClipRect()

BOOL EMFDC_IntersectClipRect ( WINEDC dc_attr,
INT  left,
INT  top,
INT  right,
INT  bottom 
)

Definition at line 1960 of file emfdc.c.

1961 {
1963 
1965  emr.emr.nSize = sizeof(emr);
1966  emr.rclClip.left = left;
1967  emr.rclClip.top = top;
1968  emr.rclClip.right = right;
1969  emr.rclClip.bottom = bottom;
1970  return emfdc_record( dc_attr->emf, &emr.emr );
1971 }
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
#define EMR_INTERSECTCLIPRECT
Definition: wingdi.h:104
long top
Definition: polytest.cpp:53
GLint GLint bottom
Definition: glext.h:7726
long left
Definition: polytest.cpp:53
WINEDC * dc_attr
Definition: emfdc.c:47
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
DWORD nSize
Definition: wingdi.h:1691
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

◆ EMFDC_InvertRgn()

BOOL EMFDC_InvertRgn ( WINEDC dc_attr,
HRGN  hrgn 
)

Definition at line 1105 of file emfdc.c.

1106 {
1108 }
WINEDC * dc_attr
Definition: emfdc.c:47
#define EMR_INVERTRGN
Definition: wingdi.h:146
static HRGN hrgn
Definition: win.c:55
static BOOL emfdc_paint_invert_region(struct emf *emf, HRGN hrgn, DWORD iType)
Definition: emfdc.c:1074

◆ EMFDC_LineTo()

BOOL EMFDC_LineTo ( WINEDC dc_attr,
INT  x,
INT  y 
)

Definition at line 697 of file emfdc.c.

698 {
699  EMRLINETO emr;
700  BOOL Ret;
701 
702  emr.emr.iType = EMR_LINETO;
703  emr.emr.nSize = sizeof(emr);
704  emr.ptl.x = x;
705  emr.ptl.y = y;
706  Ret = emfdc_record( dc_attr->emf, &emr.emr );
707  EMFDRV_LineTo( dc_attr, x, y );
708  return Ret;
709 }
#define EMR_LINETO
Definition: wingdi.h:128
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG y
Definition: windef.h:330
unsigned int BOOL
Definition: ntddk_ex.h:94
POINTL ptl
Definition: wingdi.h:2034
WINEDC * dc_attr
Definition: emfdc.c:47
BOOL EMFDRV_LineTo(WINEDC *dc, INT x, INT y)
Definition: emfdrv.c:83
LONG x
Definition: windef.h:329
DWORD nSize
Definition: wingdi.h:1691
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ EMFDC_MaskBlt()

BOOL EMFDC_MaskBlt ( WINEDC dc_attr,
INT  x_dst,
INT  y_dst,
INT  width_dst,
INT  height_dst,
HDC  hdc_src,
INT  x_src,
INT  y_src,
HBITMAP  mask,
INT  x_mask,
INT  y_mask,
DWORD  rop 
)

Definition at line 1477 of file emfdc.c.

1480 {
1481  unsigned char mask_info_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors)
1482  + 256*RTL_FIELD_SIZE(BITMAPINFO, bmiColors)];
1483  BITMAPINFO *mask_bits_info = (BITMAPINFO *)mask_info_buffer;
1484  struct emf *emf = dc_attr->emf;
1485  BITMAPINFO mask_info = {{ sizeof( mask_info.bmiHeader ) }};
1486  BITMAPINFO src_info = {{ sizeof( src_info.bmiHeader ) }};
1487  HBITMAP bitmap, blit_bitmap = NULL, mask_bitmap = NULL;
1488  UINT bmi_size, size, mask_info_size = 0;
1489  EMRMASKBLT *emr = NULL;
1490  BITMAPINFO *bmi;
1491  HDC blit_dc, mask_dc = NULL;
1492  BOOL ret = FALSE;
1493 
1494  if (!rop_uses_src( rop ))
1495  return EMFDC_PatBlt( dc_attr, x_dst, y_dst, width_dst, height_dst, rop );
1496 
1497  if (hdc_src && GDI_HANDLE_GET_TYPE(hdc_src) == GDILoObjType_LO_ALTDC_TYPE)
1498  {
1499  WINEDC * pldc = get_dc_ptr(hdc_src);
1500 
1501  if (pldc->iType == LDC_EMFLDC)
1502  {
1503  return FALSE;
1504  }
1505  }
1506 
1507  if (!(bitmap = GetCurrentObject( hdc_src, OBJ_BITMAP ))) return FALSE;
1508  blit_dc = hdc_src;
1509  blit_bitmap = bitmap;
1510  if (!(bmi_size = get_bitmap_info( &blit_dc, &blit_bitmap, &src_info ))) return FALSE;
1511 
1512  if (mask)
1513  {
1514  mask_dc = hdc_src;
1515  mask_bitmap = mask;
1516  if (!(mask_info_size = get_bitmap_info( &mask_dc, &mask_bitmap, &mask_info ))) goto err;
1517  if (mask_info.bmiHeader.biBitCount == 1)
1518  mask_info_size = sizeof(BITMAPINFOHEADER); /* don't include colors */
1519  }
1520  else mask_info.bmiHeader.biSizeImage = 0;
1521 
1522  size = sizeof(*emr) + bmi_size + src_info.bmiHeader.biSizeImage +
1523  mask_info_size + mask_info.bmiHeader.biSizeImage;
1524 
1525  if (!(emr = HeapAlloc(GetProcessHeap(), 0, size))) goto err;
1526 
1527  emr->emr.iType = EMR_MASKBLT;
1528  emr->emr.nSize = size;
1529  emr->rclBounds.left = x_dst;
1530  emr->rclBounds.top = y_dst;
1531  emr->rclBounds.right = x_dst + width_dst - 1;
1532  emr->rclBounds.bottom = y_dst + height_dst - 1;
1533  emr->xDest = x_dst;
1534  emr->yDest = y_dst;
1535  emr->cxDest = width_dst;
1536  emr->cyDest = height_dst;
1537  emr->dwRop = rop;
1538  emr->xSrc = x_src;
1539  emr->ySrc = y_src;
1541  emr->crBkColorSrc = GetBkColor( hdc_src );
1542  emr->iUsageSrc = DIB_RGB_COLORS;
1543  emr->offBmiSrc = sizeof(*emr);
1544  emr->cbBmiSrc = bmi_size;
1545  emr->offBitsSrc = emr->offBmiSrc + bmi_size;
1546  emr->cbBitsSrc = src_info.bmiHeader.biSizeImage;
1547  emr->xMask = x_mask;
1548  emr->yMask = y_mask;
1549  emr->iUsageMask = DIB_PAL_MONO;
1550  emr->offBmiMask = mask_info_size ? emr->offBitsSrc + emr->cbBitsSrc : 0;
1551  emr->cbBmiMask = mask_info_size;
1552  emr->offBitsMask = emr->offBmiMask + emr->cbBmiMask;
1553  emr->cbBitsMask = mask_info.bmiHeader.biSizeImage;
1554 
1555  bmi = (BITMAPINFO *)((char *)emr + emr->offBmiSrc);
1556  bmi->bmiHeader = src_info.bmiHeader;
1557  ret = GetDIBits( blit_dc, blit_bitmap, 0, src_info.bmiHeader.biHeight,
1558  (char *)emr + emr->offBitsSrc, bmi, DIB_RGB_COLORS );
1559  if (!ret) goto err;
1560 
1561  if (mask_info_size)
1562  {
1563  mask_bits_info->bmiHeader = mask_info.bmiHeader;
1564  ret = GetDIBits( blit_dc, mask_bitmap, 0, mask_info.bmiHeader.biHeight,
1565  (char *)emr + emr->offBitsMask, mask_bits_info, DIB_RGB_COLORS );
1566  if (ret) memcpy( (char *)emr + emr->offBmiMask, mask_bits_info, mask_info_size );
1567  }
1568 
1569  if (ret)
1570  {
1571  ret = emfdc_record( emf, (EMR *)emr );
1572  if (ret) emfdc_update_bounds( emf, &emr->rclBounds );
1573  }
1574 
1575 err:
1576  HeapFree( GetProcessHeap(), 0, emr );
1577  if (mask_bitmap != mask) DeleteObject( mask_bitmap );
1578  if (mask_dc != hdc_src) DeleteObject( mask_dc );
1579  if (blit_bitmap != bitmap) DeleteObject( blit_bitmap );
1580  if (blit_dc != hdc_src) DeleteDC( blit_dc );
1581  return ret;
1582 }
#define RTL_FIELD_SIZE(type, field)
Definition: kdb_expr.c:84
RECTL rclBounds
Definition: wingdi.h:2038
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:978
DWORD iUsageMask
Definition: wingdi.h:2055
BOOL EMFDC_PatBlt(WINEDC *dc_attr, INT left, INT top, INT width, INT height, DWORD rop)
Definition: emfdc.c:1408
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
static BOOL rop_uses_src(DWORD rop)
Definition: emfdc.c:1445
LONG cxDest
Definition: wingdi.h:2041
LONG yMask
Definition: wingdi.h:2054
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
static HDC
Definition: imagelist.c:92
XFORM xformSrc
Definition: wingdi.h:2046
long bottom
Definition: polytest.cpp:53
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
DWORD cbBitsMask
Definition: wingdi.h:2059
static void emfdc_update_bounds(struct emf *emf, RECTL *rect)
Definition: emfdc.c:84
DWORD offBitsSrc
Definition: wingdi.h:2051
long right
Definition: polytest.cpp:53
GLenum GLint GLuint mask
Definition: glext.h:6028
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL APIENTRY NtGdiGetTransform(_In_ HDC hdc, _In_ DWORD iXform, _Out_ LPXFORM pxf)
long top
Definition: polytest.cpp:53
static int rop(int rop, int src, int dst)
Definition: nanoxwin.c:124
long left
Definition: polytest.cpp:53
WINEDC * dc_attr
Definition: emfdc.c:47
DWORD cbBmiSrc
Definition: wingdi.h:2050
DWORD iUsageSrc
Definition: wingdi.h:2048
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
Definition: uimain.c:88
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD cbBitsSrc
Definition: wingdi.h:2052
DWORD offBitsMask
Definition: wingdi.h:2058
DWORD dwRop
Definition: wingdi.h:2043
DWORD biSizeImage
Definition: amvideo.idl:36
LONG cyDest
Definition: wingdi.h:2042
LONG yDest
Definition: wingdi.h:2040
int ret
DWORD nSize
Definition: wingdi.h:1691
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define err(...)
Definition: emfdc.c:44
DWORD offBmiSrc
Definition: wingdi.h:2049
#define GdiWorldSpaceToDeviceSpace
Definition: gdi_private.h:221
LONG xMask
Definition: wingdi.h:2053
static UINT get_bitmap_info(HDC *hdc, HBITMAP *bitmap, BITMAPINFO *info)
Definition: emfdc.c:120
DWORD cbBmiMask
Definition: wingdi.h:2057
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
BOOL WINAPI DeleteDC(_In_ HDC)
LONG xDest
Definition: wingdi.h:2039
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define DIB_PAL_MONO
Definition: gdi_private.h:196
DC * get_dc_ptr(HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:147
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)
COLORREF crBkColorSrc
Definition: wingdi.h:2047
DWORD offBmiMask
Definition: wingdi.h:2056
#define EMR_MASKBLT
Definition: wingdi.h:151
static HBITMAP bitmap
Definition: clipboard.c:1344
static HBITMAP
Definition: button.c:44
#define DIB_RGB_COLORS
Definition: wingdi.h:367
#define OBJ_BITMAP
Definition: objidl.idl:1415
#define HeapFree(x, y, z)
Definition: compat.h:735
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:428
#define LDC_EMFLDC
Definition: gdi_private.h:105

◆ EMFDC_ModifyWorldTransform()

BOOL EMFDC_ModifyWorldTransform ( WINEDC dc_attr,
const XFORM xform,
DWORD  mode 
)

Definition at line 2111 of file emfdc.c.

2112 {
2114 
2116  emr.emr.nSize = sizeof(emr);
2117  if (mode == MWT_IDENTITY)
2118  {
2119  emr.xform.eM11 = 1.0f;
2120  emr.xform.eM12 = 0.0f;
2121  emr.xform.eM21 = 0.0f;
2122  emr.xform.eM22 = 1.0f;
2123  emr.xform.eDx = 0.0f;
2124  emr.xform.eDy = 0.0f;
2125  }
2126  else
2127  {
2128  emr.xform = *xform;
2129  }
2130  emr.iMode = mode;
2131  return emfdc_record( dc_attr->emf, &emr.emr );
2132 }
FLOAT eDx
Definition: wingdi.h:1725
FLOAT eM21
Definition: wingdi.h:1723
FLOAT eM12
Definition: wingdi.h:1722
WINEDC * dc_attr
Definition: emfdc.c:47
#define EMR_MODIFYWORLDTRANSFORM
Definition: wingdi.h:110
DWORD nSize
Definition: wingdi.h:1691
FLOAT eM11
Definition: wingdi.h:1721
GLenum mode
Definition: glext.h:6217
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
FLOAT eM22
Definition: wingdi.h:1724
FLOAT eDy
Definition: wingdi.h:1726
#define MWT_IDENTITY
Definition: wingdi.h:944

◆ EMFDC_MoveTo()

BOOL EMFDC_MoveTo ( WINEDC dc_attr,
INT  x,
INT  y 
)

Definition at line 685 of file emfdc.c.

686 {
687  struct emf *emf = dc_attr->emf;
688  EMRMOVETOEX emr;
689 
690  emr.emr.iType = EMR_MOVETOEX;
691  emr.emr.nSize = sizeof(emr);
692  emr.ptl.x = x;
693  emr.ptl.y = y;
694  return emfdc_record( emf, &emr.emr );
695 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define EMR_MOVETOEX
Definition: wingdi.h:101
LONG y
Definition: windef.h:330
POINTL ptl
Definition: wingdi.h:2034
WINEDC * dc_attr
Definition: emfdc.c:47
LONG x
Definition: windef.h:329
DWORD nSize
Definition: wingdi.h:1691
Definition: emfdc.c:44
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ EMFDC_OffsetClipRgn()

BOOL EMFDC_OffsetClipRgn ( WINEDC dc_attr,
INT  x,
INT  y 
)

Definition at line 1973 of file emfdc.c.

1974 {
1975  EMROFFSETCLIPRGN emr;
1976 
1977  emr.emr.iType = EMR_OFFSETCLIPRGN;
1978  emr.emr.nSize = sizeof(emr);
1979  emr.ptlOffset.x = x;
1980  emr.ptlOffset.y = y;
1981  return emfdc_record( dc_attr->emf, &emr.emr );
1982 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG y
Definition: windef.h:330
WINEDC * dc_attr
Definition: emfdc.c:47
LONG x
Definition: windef.h:329
DWORD nSize
Definition: wingdi.h:1691
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define EMR_OFFSETCLIPRGN
Definition: wingdi.h:100

◆ emfdc_paint_invert_region()

static BOOL emfdc_paint_invert_region ( struct emf emf,
HRGN  hrgn,
DWORD  iType 
)
static

Definition at line 1074 of file emfdc.c.

1075 {
1076  EMRINVERTRGN *emr;
1077  DWORD size, rgnsize;
1078  BOOL ret;
1079 
1080  rgnsize = /*NtGdi*/GetRegionData( hrgn, 0, NULL );
1081  size = rgnsize + offsetof(EMRINVERTRGN,RgnData);
1082  emr = HeapAlloc( GetProcessHeap(), 0, size );
1083 
1084  /*NtGdi*/GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
1085 
1086  emr->emr.iType = iType;
1087  emr->emr.nSize = size;
1088  emr->rclBounds.left = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.left;
1089  emr->rclBounds.top = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.top;
1090  emr->rclBounds.right = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.right - 1;
1091  emr->rclBounds.bottom = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.bottom - 1;
1092  emr->cbRgnData = rgnsize;
1093 
1094  ret = emfdc_record( emf, &emr->emr );
1095  if (ret) emfdc_update_bounds( emf, &emr->rclBounds );
1096  HeapFree( GetProcessHeap(), 0, emr );
1097  return ret;
1098 }
_In_ ULONG iType
Definition: winddi.h:3748
long bottom
Definition: polytest.cpp:53
static void emfdc_update_bounds(struct emf *emf, RECTL *rect)
Definition: emfdc.c:84
long right
Definition: polytest.cpp:53
unsigned int BOOL
Definition: ntddk_ex.h:94
long top
Definition: polytest.cpp:53
#define offsetof(TYPE, MEMBER)
long left
Definition: polytest.cpp:53
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
DWORD nSize
Definition: wingdi.h:1691
static HRGN hrgn
Definition: win.c:55
Definition: emfdc.c:44
BYTE RgnData[1]
Definition: wingdi.h:2030
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
DWORD cbRgnData
Definition: wingdi.h:2029
#define NULL
Definition: types.h:112
RECTL rclBounds
Definition: wingdi.h:2028
DWORD WINAPI GetRegionData(_In_ HRGN hrgn, _In_ DWORD nCount, _Out_writes_bytes_to_opt_(nCount, return) LPRGNDATA lpRgnData)
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by EMFDC_InvertRgn(), and EMFDC_PaintRgn().

◆ EMFDC_PaintRgn()

BOOL EMFDC_PaintRgn ( WINEDC dc_attr,
HRGN  hrgn 
)

Definition at line 1100 of file emfdc.c.

1101 {
1103 }
#define EMR_PAINTRGN
Definition: wingdi.h:147
WINEDC * dc_attr
Definition: emfdc.c:47
static HRGN hrgn
Definition: win.c:55
static BOOL emfdc_paint_invert_region(struct emf *emf, HRGN hrgn, DWORD iType)
Definition: emfdc.c:1074

◆ EMFDC_PatBlt()

BOOL EMFDC_PatBlt ( WINEDC dc_attr,
INT  left,
INT  top,
INT  width,
INT  height,
DWORD  rop 
)

Definition at line 1408 of file emfdc.c.

1409 {
1410  struct emf *emf = dc_attr->emf;
1411  EMRBITBLT emr;
1412  BOOL ret;
1413 
1414  emr.emr.iType = EMR_BITBLT;
1415  emr.emr.nSize = sizeof(emr);
1416  emr.rclBounds.left = left;
1417  emr.rclBounds.top = top;
1418  emr.rclBounds.right = left + width - 1;
1419  emr.rclBounds.bottom = top + height - 1;
1420  emr.xDest = left;
1421  emr.yDest = top;
1422  emr.cxDest = width;
1423  emr.cyDest = height;
1424  emr.dwRop = rop;
1425  emr.xSrc = 0;
1426  emr.ySrc = 0;
1427  emr.xformSrc.eM11 = 1.0;
1428  emr.xformSrc.eM12 = 0.0;
1429  emr.xformSrc.eM21 = 0.0;
1430  emr.xformSrc.eM22 = 1.0;
1431  emr.xformSrc.eDx = 0.0;
1432  emr.xformSrc.eDy = 0.0;
1433  emr.crBkColorSrc = 0;
1434  emr.iUsageSrc = 0;
1435  emr.offBmiSrc = 0;
1436  emr.cbBmiSrc = 0;
1437  emr.offBitsSrc = 0;
1438  emr.cbBitsSrc = 0;
1439 
1440  ret = emfdc_record( emf, &emr.emr );
1441  if (ret) emfdc_update_bounds( emf, &emr.rclBounds );
1442  return ret;
1443 }
GLint GLint GLsizei width
Definition: gl.h:1546
DWORD iUsageSrc
Definition: wingdi.h:1740
DWORD cbBitsSrc
Definition: wingdi.h:1744
long bottom
Definition: polytest.cpp:53
LONG cxDest
Definition: wingdi.h:1733
static void emfdc_update_bounds(struct emf *emf, RECTL *rect)
Definition: emfdc.c:84
long right
Definition: polytest.cpp:53
unsigned int BOOL
Definition: ntddk_ex.h:94
FLOAT eDx
Definition: wingdi.h:1725
long top
Definition: polytest.cpp:53
static int rop(int rop, int src, int dst)
Definition: nanoxwin.c:124
XFORM xformSrc
Definition: wingdi.h:1738
FLOAT eM21
Definition: wingdi.h:1723
FLOAT eM12
Definition: wingdi.h:1722
LONG cyDest
Definition: wingdi.h:1734
long left
Definition: polytest.cpp:53
WINEDC * dc_attr
Definition: emfdc.c:47
#define EMR_BITBLT
Definition: wingdi.h:149
COLORREF crBkColorSrc
Definition: wingdi.h:1739
LONG xSrc
Definition: wingdi.h:1736
GLint left
Definition: glext.h:7726
int ret
DWORD nSize
Definition: wingdi.h:1691
FLOAT eM11
Definition: wingdi.h:1721
LONG yDest
Definition: wingdi.h:1732
Definition: emfdc.c:44
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
DWORD dwRop
Definition: wingdi.h:1735
RECTL rclBounds
Definition: wingdi.h:1730
DWORD offBmiSrc
Definition: wingdi.h:1741
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
LONG ySrc
Definition: wingdi.h:1737
FLOAT eM22
Definition: wingdi.h:1724
FLOAT eDy
Definition: wingdi.h:1726
LONG xDest
Definition: wingdi.h:1731
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
DWORD offBitsSrc
Definition: wingdi.h:1743
DWORD cbBmiSrc
Definition: wingdi.h:1742

Referenced by EMFDC_BitBlt(), EMFDC_MaskBlt(), and EMFDC_StretchBlt().

◆ EMFDC_PlgBlt()

BOOL EMFDC_PlgBlt ( WINEDC dc_attr,
const POINT points,
HDC  hdc_src,
INT  x_src,
INT  y_src,
INT  width,
INT  height,
HBITMAP  mask,
INT  x_mask,
INT  y_mask 
)

Definition at line 1584 of file emfdc.c.

1586 {
1587  unsigned char mask_info_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors)
1588  + 256*RTL_FIELD_SIZE(BITMAPINFO, bmiColors)];
1589  BITMAPINFO *mask_bits_info = (BITMAPINFO *)mask_info_buffer;
1590  struct emf *emf = dc_attr->emf;
1591  BITMAPINFO mask_info = {{ sizeof( mask_info.bmiHeader ) }};
1592  BITMAPINFO src_info = {{ sizeof( src_info.bmiHeader ) }};
1593  HBITMAP bitmap, blit_bitmap = NULL, mask_bitmap = NULL;
1594  UINT bmi_size, size, mask_info_size = 0;
1595  EMRPLGBLT *emr = NULL;
1596  BITMAPINFO *bmi;
1597  HDC blit_dc, mask_dc = NULL;
1598  int x_min, y_min, x_max, y_max, i;
1599  BOOL ret = FALSE;
1600 
1601  if (hdc_src && GDI_HANDLE_GET_TYPE(hdc_src) == GDILoObjType_LO_ALTDC_TYPE)
1602  {
1603  WINEDC * pldc = get_dc_ptr(hdc_src);
1604 
1605  if (pldc->iType == LDC_EMFLDC)
1606  {
1607  return FALSE;
1608  }
1609  }
1610 
1611  if (!(bitmap = GetCurrentObject( hdc_src, OBJ_BITMAP ))) return FALSE;
1612 
1613  blit_dc = hdc_src;
1614  blit_bitmap = bitmap;
1615  if (!(bmi_size = get_bitmap_info( &blit_dc, &blit_bitmap, &src_info ))) return FALSE;
1616 
1617  if (mask)
1618  {
1619  mask_dc = hdc_src;
1620  mask_bitmap = mask;
1621  if (!(mask_info_size = get_bitmap_info( &mask_dc, &mask_bitmap, &mask_info ))) goto err;
1622  if (mask_info.bmiHeader.biBitCount == 1)
1623  mask_info_size = sizeof(BITMAPINFOHEADER); /* don't include colors */
1624  }
1625  else mask_info.bmiHeader.biSizeImage = 0;
1626 
1627  size = sizeof(*emr) + bmi_size + src_info.bmiHeader.biSizeImage +
1628  mask_info_size + mask_info.bmiHeader.biSizeImage;
1629 
1630  if (!(emr = HeapAlloc(GetProcessHeap(), 0, size))) goto err;
1631 
1632  emr->emr.iType = EMR_PLGBLT;
1633  emr->emr.nSize = size;
1634 
1635  /* FIXME: not exactly what native does */
1636  x_min = x_max = points[1].x + points[2].x - points[0].x;
1637  y_min = y_max = points[1].y + points[2].y - points[0].y;
1638  for (i = 0; i < ARRAYSIZE(emr->aptlDest); i++)
1639  {
1640  x_min = min( x_min, points[i].x );
1641  y_min = min( y_min, points[i].y );
1642  x_max = max( x_max, points[i].x );
1643  y_max = max( y_min, points[i].y );
1644  }
1645  emr->rclBounds.left = x_min;
1646  emr->rclBounds.top = y_min;
1647  emr->rclBounds.right = x_max;
1648  emr->rclBounds.bottom = y_max;
1649  memcpy( emr->aptlDest, points, sizeof(emr->aptlDest) );
1650  emr->xSrc = x_src;
1651  emr->ySrc = y_src;
1652  emr->cxSrc = width;
1653  emr->cySrc = height;
1655  emr->crBkColorSrc = GetBkColor( hdc_src );
1656  emr->iUsageSrc = DIB_RGB_COLORS;
1657  emr->offBmiSrc = sizeof(*emr);
1658  emr->cbBmiSrc = bmi_size;
1659  emr->offBitsSrc = emr->offBmiSrc + bmi_size;
1660  emr->cbBitsSrc = src_info.bmiHeader.biSizeImage;
1661  emr->xMask = x_mask;
1662  emr->yMask = y_mask;
1663  emr->iUsageMask = DIB_PAL_MONO;
1664  emr->offBmiMask = mask_info_size ? emr->offBitsSrc + emr->cbBitsSrc : 0;
1665  emr->cbBmiMask = mask_info_size;
1666  emr->offBitsMask = emr->offBmiMask + emr->cbBmiMask;
1667  emr->cbBitsMask = mask_info.bmiHeader.biSizeImage;
1668 
1669  bmi = (BITMAPINFO *)((char *)emr + emr->offBmiSrc);
1670  bmi->bmiHeader = src_info.bmiHeader;
1671  ret = GetDIBits( blit_dc, blit_bitmap, 0, src_info.bmiHeader.biHeight,
1672  (char *)emr + emr->offBitsSrc, bmi, DIB_RGB_COLORS );
1673  if (!ret) goto err;
1674 
1675  if (mask_info_size)
1676  {
1677  mask_bits_info->bmiHeader = mask_info.bmiHeader;
1678  ret = GetDIBits( blit_dc, mask_bitmap, 0, mask_info.bmiHeader.biHeight,
1679  (char *)emr + emr->offBitsMask, mask_bits_info, DIB_RGB_COLORS );
1680  if (ret) memcpy( (char *)emr + emr->offBmiMask, mask_bits_info, mask_info_size );
1681  }
1682 
1683  if (ret)
1684  {
1685  ret = emfdc_record( emf, (EMR *)emr );
1686  if (ret) emfdc_update_bounds( emf, &emr->rclBounds );
1687  }
1688 
1689 err:
1690  HeapFree( GetProcessHeap(), 0, emr );
1691  if (mask_bitmap != mask) DeleteObject( mask_bitmap );
1692  if (mask_dc != hdc_src) DeleteObject( mask_dc );
1693  if (blit_bitmap != bitmap) DeleteObject( blit_bitmap );
1694  if (blit_dc != hdc_src) DeleteDC( blit_dc );
1695  return ret;
1696 }
COLORREF crBkColorSrc
Definition: wingdi.h:2079
#define RTL_FIELD_SIZE(type, field)
Definition: kdb_expr.c:84
GLint GLint GLsizei width
Definition: gl.h:1546
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:978
#define max(a, b)
Definition: svc.c:63
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
LONG cxSrc
Definition: wingdi.h:2076
DWORD cbBitsMask
Definition: wingdi.h:2091
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
static HDC
Definition: imagelist.c:92
DWORD cbBmiMask
Definition: wingdi.h:2089
long bottom
Definition: polytest.cpp:53
DWORD offBmiSrc
Definition: wingdi.h:2081
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
DWORD iUsageMask
Definition: wingdi.h:2087
static void emfdc_update_bounds(struct emf *emf, RECTL *rect)
Definition: emfdc.c:84
LONG cySrc
Definition: wingdi.h:2077
#define EMR_PLGBLT
Definition: wingdi.h:152
long right
Definition: polytest.cpp:53
GLenum GLint GLuint mask
Definition: glext.h:6028
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG xSrc
Definition: wingdi.h:2074
BOOL APIENTRY NtGdiGetTransform(_In_ HDC hdc, _In_ DWORD iXform, _Out_ LPXFORM pxf)
long top
Definition: polytest.cpp:53
LONG xMask
Definition: wingdi.h:2085
long left
Definition: polytest.cpp:53
WINEDC * dc_attr
Definition: emfdc.c:47
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
Definition: uimain.c:88
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD offBitsSrc
Definition: wingdi.h:2083
DWORD biSizeImage
Definition: amvideo.idl:36
GLsizei const GLfloat * points
Definition: glext.h:8112
int ret
DWORD nSize
Definition: wingdi.h:1691
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define err(...)
Definition: emfdc.c:44
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define GdiWorldSpaceToDeviceSpace
Definition: gdi_private.h:221
DWORD offBitsMask
Definition: wingdi.h:2090
static UINT get_bitmap_info(HDC *hdc, HBITMAP *bitmap, BITMAPINFO *info)
Definition: emfdc.c:120
RECTL rclBounds
Definition: wingdi.h:2072
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
LONG ySrc
Definition: wingdi.h:2075
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
BOOL WINAPI DeleteDC(_In_ HDC)
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define DIB_PAL_MONO
Definition: gdi_private.h:196
DC * get_dc_ptr(HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:147
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
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)
XFORM xformSrc
Definition: wingdi.h:2078
static HBITMAP bitmap
Definition: clipboard.c:1344
static HBITMAP
Definition: button.c:44
DWORD iUsageSrc
Definition: wingdi.h:2080
#define DIB_RGB_COLORS
Definition: wingdi.h:367
DWORD offBmiMask
Definition: wingdi.h:2088
LONG yMask
Definition: wingdi.h:2086
POINTL aptlDest[3]
Definition: wingdi.h:2073
#define OBJ_BITMAP
Definition: objidl.idl:1415
#define HeapFree(x, y, z)
Definition: compat.h:735
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:428
DWORD cbBitsSrc
Definition: wingdi.h:2084
DWORD cbBmiSrc
Definition: wingdi.h:2082
#define LDC_EMFLDC
Definition: gdi_private.h:105

◆ emfdc_poly_polylinegon()

static BOOL emfdc_poly_polylinegon ( struct emf emf,
const POINT pt,
const INT counts,
UINT  polys,
DWORD  type 
)
static

Definition at line 903 of file emfdc.c.

905 {
906  EMRPOLYPOLYLINE *emr;
907  DWORD cptl = 0, poly, size;
908  BOOL ret, use_small_emr, bounds_valid = TRUE;
909 
910  for(poly = 0; poly < polys; poly++) {
911  cptl += counts[poly];
912  if(counts[poly] < 2) bounds_valid = FALSE;
913  }
914  if(!cptl) bounds_valid = FALSE;
915  use_small_emr = can_use_short_points( pt, cptl );
916 
917  size = FIELD_OFFSET(EMRPOLYPOLYLINE, aPolyCounts[polys]);
918  if(use_small_emr)
919  size += cptl * sizeof(POINTS);
920  else
921  size += cptl * sizeof(POINTL);
922 
923  emr = HeapAlloc( GetProcessHeap(), 0, size );
924 
925  emr->emr.iType = type;
926  if(use_small_emr) emr->emr.iType += EMR_POLYPOLYLINE16 - EMR_POLYPOLYLINE;
927 
928  emr->emr.nSize = size;
929  if(bounds_valid && !emf->path)
930  get_points_bounds( &emr->rclBounds, pt, cptl, 0 );
931  else
932  emr->rclBounds = empty_bounds;
933  emr->nPolys = polys;
934  emr->cptl = cptl;
935 
936  if(polys)
937  {
938  memcpy( emr->aPolyCounts, counts, polys * sizeof(DWORD) );
939  store_points( (POINTL *)(emr->aPolyCounts + polys), pt, cptl, use_small_emr );
940  }
941 
942  ret = emfdc_record( emf, &emr->emr );
943  if(ret && !bounds_valid)
944  {
945  ret = FALSE;
947  }
948  if(ret && !emf->path)
949  emfdc_update_bounds( emf, &emr->rclBounds );
950  HeapFree( GetProcessHeap(), 0, emr );
951  return ret;
952 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
struct tagPOINTS POINTS
static void emfdc_update_bounds(struct emf *emf, RECTL *rect)
Definition: emfdc.c:84
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EMR_POLYPOLYLINE
Definition: wingdi.h:81
static void get_points_bounds(RECTL *bounds, const POINT *pts, UINT count, WINEDC *dc_attr)
Definition: emfdc.c:604
static BOOL can_use_short_points(const POINT *pts, UINT count)
Definition: emfdc.c:571
static const RECTL empty_bounds
Definition: emfdc.c:57
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:752
static void * store_points(POINTL *dest, const POINT *pts, UINT count, BOOL short_points)
Definition: emfdc.c:582
int ret
struct _POINTL POINTL
BOOL path
Definition: emfdc.c:53
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: emfdc.c:44
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define EMR_POLYPOLYLINE16
Definition: wingdi.h:163
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by EMFDC_PolyPolygon(), and EMFDC_PolyPolyline().

◆ EMFDC_PolyBezier()

BOOL EMFDC_PolyBezier ( WINEDC dc_attr,
const POINT pts,
DWORD  count 
)

Definition at line 893 of file emfdc.c.

894 {
896 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
WINEDC * dc_attr
Definition: emfdc.c:47
static BOOL emfdc_polylinegon(WINEDC *dc_attr, const POINT *points, INT count, DWORD type)
Definition: emfdc.c:849
#define EMR_POLYBEZIER
Definition: wingdi.h:76

◆ EMFDC_PolyBezierTo()

BOOL EMFDC_PolyBezierTo ( WINEDC dc_attr,
const POINT pts,
DWORD  count 
)

Definition at line 898 of file emfdc.c.

899 {
901 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
WINEDC * dc_attr
Definition: emfdc.c:47
static BOOL emfdc_polylinegon(WINEDC *dc_attr, const POINT *points, INT count, DWORD type)
Definition: emfdc.c:849
#define EMR_POLYBEZIERTO
Definition: wingdi.h:79

◆ EMFDC_PolyDraw()

BOOL EMFDC_PolyDraw ( WINEDC dc_attr,
const POINT pts,
const BYTE types,
DWORD  count 
)

Definition at line 964 of file emfdc.c.

965 {
966  struct emf *emf = dc_attr->emf;
967  EMRPOLYDRAW *emr;
968  BOOL ret;
969  BYTE *types_dest;
970  BOOL use_small_emr = can_use_short_points( pts, count );
971  DWORD size;
972 
973  size = use_small_emr ? (DWORD)offsetof( EMRPOLYDRAW16, apts[count] )
974  : (DWORD)offsetof( EMRPOLYDRAW, aptl[count] );
975  size += (count + 3) & ~3;
976 
977  if (!(emr = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
978 
979  emr->emr.iType = use_small_emr ? EMR_POLYDRAW16 : EMR_POLYDRAW;
980  emr->emr.nSize = size;
981  emr->cptl = count;
982 
983  types_dest = store_points( emr->aptl, pts, count, use_small_emr );
984  memcpy( types_dest, types, count );
985  if (count & 3) memset( types_dest + count, 0, 4 - (count & 3) );
986 
987  if (!emf->path)
988  get_points_bounds( &emr->rclBounds, pts, count, 0 );
989  else
990  emr->rclBounds = empty_bounds;
991 
992  ret = emfdc_record( emf, &emr->emr );
993  if (ret && !emf->path) emfdc_update_bounds( emf, &emr->rclBounds );
994  HeapFree( GetProcessHeap(), 0, emr );
995  return ret;
996 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
POINTL aptl[1]
Definition: wingdi.h:2097
static void emfdc_update_bounds(struct emf *emf, RECTL *rect)
Definition: emfdc.c:84
#define EMR_POLYDRAW
Definition: wingdi.h:130
#define DWORD
Definition: nt_native.h:44
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static struct list apts
Definition: compobj.c:78
#define offsetof(TYPE, MEMBER)
static void get_points_bounds(RECTL *bounds, const POINT *pts, UINT count, WINEDC *dc_attr)
Definition: emfdc.c:604
RECTL rclBounds
Definition: wingdi.h:2095
static BOOL can_use_short_points(const POINT *pts, UINT count)
Definition: emfdc.c:571
WINEDC * dc_attr
Definition: emfdc.c:47
static const RECTL empty_bounds
Definition: emfdc.c:57
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
Definition: cmds.c:130
unsigned long DWORD
Definition: ntddk_ex.h:95
static void * store_points(POINTL *dest, const POINT *pts, UINT count, BOOL short_points)
Definition: emfdc.c:582
int ret
DWORD nSize
Definition: wingdi.h:1691
BOOL path
Definition: emfdc.c:53
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: emfdc.c:44
unsigned char BYTE
Definition: xxhash.c:193
DWORD cptl
Definition: wingdi.h:2096
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
DWORD iType
Definition: wingdi.h:1690
#define EMR_POLYDRAW16
Definition: wingdi.h:165
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ EMFDC_Polygon()

BOOL EMFDC_Polygon ( WINEDC dc_attr,
const POINT pt,
INT  count 
)

Definition at line 887 of file emfdc.c.

888 {
889  if(count < 2) return FALSE;
891 }
#define pt(x, y)
Definition: drawing.c:79
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FALSE
Definition: types.h:117
WINEDC * dc_attr
Definition: emfdc.c:47
#define EMR_POLYGON
Definition: wingdi.h:77
static BOOL emfdc_polylinegon(WINEDC *dc_attr, const POINT *points, INT count, DWORD type)
Definition: emfdc.c:849

◆ EMFDC_Polyline()

BOOL EMFDC_Polyline ( WINEDC dc_attr,
const POINT points,
INT  count 
)

Definition at line 877 of file emfdc.c.

878 {
880 }
#define EMR_POLYLINE
Definition: wingdi.h:78
GLuint GLuint GLsizei count
Definition: gl.h:1545
WINEDC * dc_attr
Definition: emfdc.c:47
static BOOL emfdc_polylinegon(WINEDC *dc_attr, const POINT *points, INT count, DWORD type)
Definition: emfdc.c:849
GLsizei const GLfloat * points
Definition: glext.h:8112

◆ emfdc_polylinegon()

static BOOL emfdc_polylinegon ( WINEDC dc_attr,
const POINT points,
INT  count,
DWORD  type 
)
static

Definition at line 849 of file emfdc.c.

850 {
851  struct emf *emf = dc_attr->emf;
852  EMRPOLYLINE *emr;
853  DWORD size;
854  BOOL ret, use_small_emr = can_use_short_points( points, count );
855 
856  size = use_small_emr ? (DWORD)offsetof( EMRPOLYLINE16, apts[count] ) : (DWORD)offsetof( EMRPOLYLINE, aptl[count] );
857 
858  emr = HeapAlloc( GetProcessHeap(), 0, size );
859  emr->emr.iType = use_small_emr ? type + EMR_POLYLINE16 - EMR_POLYLINE : type;
860  emr->emr.nSize = size;
861  emr->cptl = count;
862 
863  store_points( emr->aptl, points, count, use_small_emr );
864 
865  if (!emf->path)
867  (type == EMR_POLYBEZIERTO || type == EMR_POLYLINETO) ? dc_attr : 0 );
868  else
869  emr->rclBounds = empty_bounds;
870 
871  ret = emfdc_record( emf, &emr->emr );
872  if (ret && !emf->path) emfdc_update_bounds( emf, &emr->rclBounds );
873  HeapFree( GetProcessHeap(), 0, emr );
874  return ret;
875 }
#define EMR_POLYLINE
Definition: wingdi.h:78
#define EMR_POLYLINE16
Definition: wingdi.h:160
GLuint GLuint GLsizei count
Definition: gl.h:1545
DWORD cptl
Definition: wingdi.h:2110
#define EMR_POLYLINETO
Definition: wingdi.h:80
static void emfdc_update_bounds(struct emf *emf, RECTL *rect)
Definition: emfdc.c:84
#define DWORD
Definition: nt_native.h:44
unsigned int BOOL
Definition: ntddk_ex.h:94
static struct list apts
Definition: compobj.c:78
#define offsetof(TYPE, MEMBER)
static void get_points_bounds(RECTL *bounds, const POINT *pts, UINT count, WINEDC *dc_attr)
Definition: emfdc.c:604
static BOOL can_use_short_points(const POINT *pts, UINT count)
Definition: emfdc.c:571
WINEDC * dc_attr
Definition: emfdc.c:47
static const RECTL empty_bounds
Definition: emfdc.c:57
RECTL rclBounds
Definition: wingdi.h:2109
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: