ReactOS  0.4.14-dev-317-g96040ec
graphics.c File Reference
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "enhmfdrv/enhmetafiledrv.h"
#include "wine/debug.h"
Include dependency graph for graphics.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (enhmetafile)
 
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, DC *dc)
 
static BOOL emfdrv_stroke_and_fill_path (PHYSDEV dev, INT type)
 
BOOL EMFDRV_MoveTo (PHYSDEV dev, INT x, INT y)
 
BOOL EMFDRV_LineTo (PHYSDEV dev, INT x, INT y)
 
static BOOL EMFDRV_ArcChordPie (PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend, DWORD iType)
 
BOOL EMFDRV_Arc (PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
 
BOOL EMFDRV_ArcTo (PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
 
BOOL EMFDRV_Pie (PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
 
BOOL EMFDRV_Chord (PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend)
 
BOOL EMFDRV_AngleArc (PHYSDEV dev, INT x, INT y, DWORD radius, FLOAT start, FLOAT sweep)
 
BOOL EMFDRV_Ellipse (PHYSDEV dev, INT left, INT top, INT right, INT bottom)
 
BOOL EMFDRV_Rectangle (PHYSDEV dev, INT left, INT top, INT right, INT bottom)
 
BOOL EMFDRV_RoundRect (PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height)
 
COLORREF EMFDRV_SetPixel (PHYSDEV dev, INT x, INT y, COLORREF color)
 
static BOOL EMFDRV_Polylinegon (PHYSDEV dev, const POINT *pt, INT count, DWORD iType)
 
BOOL EMFDRV_Polyline (PHYSDEV dev, const POINT *pt, INT count)
 
BOOL EMFDRV_PolylineTo (PHYSDEV dev, const POINT *pt, INT count)
 
BOOL EMFDRV_Polygon (PHYSDEV dev, const POINT *pt, INT count)
 
BOOL EMFDRV_PolyBezier (PHYSDEV dev, const POINT *pts, DWORD count)
 
BOOL EMFDRV_PolyBezierTo (PHYSDEV dev, const POINT *pts, DWORD count)
 
static BOOL EMFDRV_PolyPolylinegon (PHYSDEV dev, const POINT *pt, const INT *counts, UINT polys, DWORD iType)
 
BOOL EMFDRV_PolyPolyline (PHYSDEV dev, const POINT *pt, const DWORD *counts, DWORD polys)
 
BOOL EMFDRV_PolyPolygon (PHYSDEV dev, const POINT *pt, const INT *counts, UINT polys)
 
BOOL EMFDRV_PolyDraw (PHYSDEV dev, const POINT *pts, const BYTE *types, DWORD count)
 
BOOL EMFDRV_ExtFloodFill (PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType)
 
BOOL EMFDRV_FillRgn (PHYSDEV dev, HRGN hrgn, HBRUSH hbrush)
 
BOOL EMFDRV_FrameRgn (PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT width, INT height)
 
static BOOL EMFDRV_PaintInvertRgn (PHYSDEV dev, HRGN hrgn, DWORD iType)
 
BOOL EMFDRV_PaintRgn (PHYSDEV dev, HRGN hrgn)
 
BOOL EMFDRV_InvertRgn (PHYSDEV dev, HRGN hrgn)
 
BOOL EMFDRV_ExtTextOut (PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx)
 
BOOL EMFDRV_GradientFill (PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, void *grad_array, ULONG ngrad, ULONG mode)
 
BOOL EMFDRV_FillPath (PHYSDEV dev)
 
BOOL EMFDRV_StrokeAndFillPath (PHYSDEV dev)
 
BOOL EMFDRV_StrokePath (PHYSDEV dev)
 

Variables

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

Function Documentation

◆ can_use_short_points()

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

Definition at line 39 of file graphics.c.

40 {
41  UINT i;
42 
43  for (i = 0; i < count; i++)
44  if (((pts[i].x + 0x8000) & ~0xffff) || ((pts[i].y + 0x8000) & ~0xffff))
45  return FALSE;
46  return TRUE;
47 }
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
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 EMFDRV_PolyDraw(), EMFDRV_Polylinegon(), and EMFDRV_PolyPolylinegon().

◆ EMFDRV_AngleArc()

BOOL EMFDRV_AngleArc ( PHYSDEV  dev,
INT  x,
INT  y,
DWORD  radius,
FLOAT  start,
FLOAT  sweep 
)

Definition at line 390 of file graphics.c.

391 {
392  EMRANGLEARC emr;
393 
394  emr.emr.iType = EMR_ANGLEARC;
395  emr.emr.nSize = sizeof( emr );
396  emr.ptlCenter.x = x;
397  emr.ptlCenter.y = y;
398  emr.nRadius = radius;
399  emr.eStartAngle = start;
400  emr.eSweepAngle = sweep;
401 
402  return EMFDRV_WriteRecord( dev, &emr.emr );
403 }
POINTL ptlCenter
Definition: wingdi.h:1704
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
FLOAT eSweepAngle
Definition: wingdi.h:1707
LONG y
Definition: windef.h:315
DWORD nRadius
Definition: wingdi.h:1705
LONG x
Definition: windef.h:314
DWORD nSize
Definition: wingdi.h:1686
#define EMR_ANGLEARC
Definition: wingdi.h:115
DWORD iType
Definition: wingdi.h:1685
GLuint start
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
FLOAT eStartAngle
Definition: wingdi.h:1706

◆ EMFDRV_Arc()

BOOL EMFDRV_Arc ( PHYSDEV  dev,
INT  left,
INT  top,
INT  right,
INT  bottom,
INT  xstart,
INT  ystart,
INT  xend,
INT  yend 
)

Definition at line 349 of file graphics.c.

351 {
352  return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart,
353  xend, yend, EMR_ARC );
354 }
GLint GLint bottom
Definition: glext.h:7726
static BOOL EMFDRV_ArcChordPie(PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend, DWORD iType)
Definition: graphics.c:226
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
#define EMR_ARC
Definition: wingdi.h:119
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

◆ EMFDRV_ArcChordPie()

static BOOL EMFDRV_ArcChordPie ( PHYSDEV  dev,
INT  left,
INT  top,
INT  right,
INT  bottom,
INT  xstart,
INT  ystart,
INT  xend,
INT  yend,
DWORD  iType 
)
static

Definition at line 226 of file graphics.c.

228 {
229  EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
230 #ifndef __REACTOS__
231  DC *dc = get_physdev_dc( dev );
232 #endif
233  INT temp, xCentre, yCentre, i;
234  double angleStart, angleEnd;
235  double xinterStart, yinterStart, xinterEnd, yinterEnd;
236  EMRARC emr;
237  RECTL bounds;
238 
239  if(left == right || top == bottom) return FALSE;
240 
241  if(left > right) {temp = left; left = right; right = temp;}
242  if(top > bottom) {temp = top; top = bottom; bottom = temp;}
243 #ifdef __REACTOS__
244  if(GetGraphicsMode(dev->hdc) == GM_COMPATIBLE) {
245 #else
246  if(dc->GraphicsMode == GM_COMPATIBLE) {
247 #endif
248  right--;
249  bottom--;
250  }
251 
252  emr.emr.iType = iType;
253  emr.emr.nSize = sizeof(emr);
254  emr.rclBox.left = left;
255  emr.rclBox.top = top;
256  emr.rclBox.right = right;
257  emr.rclBox.bottom = bottom;
258  emr.ptlStart.x = xstart;
259  emr.ptlStart.y = ystart;
260  emr.ptlEnd.x = xend;
261  emr.ptlEnd.y = yend;
262 
263 
264  /* Now calculate the BBox */
265  xCentre = (left + right + 1) / 2;
266  yCentre = (top + bottom + 1) / 2;
267 
268  xstart -= xCentre;
269  ystart -= yCentre;
270  xend -= xCentre;
271  yend -= yCentre;
272 
273  /* invert y co-ords to get angle anti-clockwise from x-axis */
274  angleStart = atan2( -(double)ystart, (double)xstart);
275  angleEnd = atan2( -(double)yend, (double)xend);
276 
277  /* These are the intercepts of the start/end lines with the arc */
278 
279  xinterStart = (right - left + 1)/2 * cos(angleStart) + xCentre;
280  yinterStart = -(bottom - top + 1)/2 * sin(angleStart) + yCentre;
281  xinterEnd = (right - left + 1)/2 * cos(angleEnd) + xCentre;
282  yinterEnd = -(bottom - top + 1)/2 * sin(angleEnd) + yCentre;
283 
284  if(angleStart < 0) angleStart += 2 * M_PI;
285  if(angleEnd < 0) angleEnd += 2 * M_PI;
286  if(angleEnd < angleStart) angleEnd += 2 * M_PI;
287 
288  bounds.left = min(xinterStart, xinterEnd);
289  bounds.top = min(yinterStart, yinterEnd);
290  bounds.right = max(xinterStart, xinterEnd);
291  bounds.bottom = max(yinterStart, yinterEnd);
292 
293  for(i = 0; i <= 8; i++) {
294  if(i * M_PI / 2 < angleStart) /* loop until we're past start */
295  continue;
296  if(i * M_PI / 2 > angleEnd) /* if we're past end we're finished */
297  break;
298 
299  /* the arc touches the rectangle at the start of quadrant i, so adjust
300  BBox to reflect this. */
301 
302  switch(i % 4) {
303  case 0:
304  bounds.right = right;
305  break;
306  case 1:
307  bounds.top = top;
308  break;
309  case 2:
310  bounds.left = left;
311  break;
312  case 3:
313  bounds.bottom = bottom;
314  break;
315  }
316  }
317 
318  /* If we're drawing a pie then make sure we include the centre */
319  if(iType == EMR_PIE) {
320  if(bounds.left > xCentre) bounds.left = xCentre;
321  else if(bounds.right < xCentre) bounds.right = xCentre;
322  if(bounds.top > yCentre) bounds.top = yCentre;
323  else if(bounds.bottom < yCentre) bounds.bottom = yCentre;
324  }
325  if (iType == EMR_ARCTO)
326  {
327  POINT pt;
328 #ifdef __REACTOS__
329  GetCurrentPositionEx( dev->hdc, &pt );
330 #else
331  pt = dc->cur_pos;
332 #endif
333  bounds.left = min( bounds.left, pt.x );
334  bounds.top = min( bounds.top, pt.y );
335  bounds.right = max( bounds.right, pt.x );
336  bounds.bottom = max( bounds.bottom, pt.y );
337  }
338  if(!EMFDRV_WriteRecord( dev, &emr.emr ))
339  return FALSE;
340  if(!physDev->path)
341  EMFDRV_UpdateBBox( dev, &bounds );
342  return TRUE;
343 }
BOOL WINAPI GetCurrentPositionEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:241
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
valarray< _Tp > atan2(const valarray< _Tp > &__x, const valarray< _Tp > &__y)
Definition: _valarray.h:928
#define EMR_ARCTO
Definition: wingdi.h:129
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
#define pt(x, y)
Definition: drawing.c:79
_In_ ULONG iType
Definition: winddi.h:3748
static EMFDRV_PDEVICE * get_emf_physdev(PHYSDEV dev)
POINTL ptlStart
Definition: wingdi.h:1712
long bottom
Definition: polytest.cpp:53
HDC dc
Definition: cylfrac.c:34
int32_t INT
Definition: typedefs.h:56
LONG y
Definition: windef.h:315
long right
Definition: polytest.cpp:53
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
long top
Definition: polytest.cpp:53
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
GLint GLint bottom
Definition: glext.h:7726
long left
Definition: polytest.cpp:53
Definition: polytest.cpp:40
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect) DECLSPEC_HIDDEN
Definition: init.c:231
int WINAPI GetGraphicsMode(_In_ HDC)
GLint left
Definition: glext.h:7726
LONG x
Definition: windef.h:314
GLdouble GLdouble right
Definition: glext.h:10859
EMR emr
Definition: wingdi.h:1710
#define GM_COMPATIBLE
Definition: wingdi.h:863
#define EMR_PIE
Definition: wingdi.h:121
POINTL ptlEnd
Definition: wingdi.h:1713
DWORD nSize
Definition: wingdi.h:1686
DWORD iType
Definition: wingdi.h:1685
static calc_node_t temp
Definition: rpn_ieee.c:38
WINEDC * get_physdev_dc(PHYSDEV dev)
Definition: rosglue.c:191
#define M_PI
Definition: macros.h:263
#define min(a, b)
Definition: monoChain.cc:55
RECTL rclBox
Definition: wingdi.h:1711
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

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

◆ EMFDRV_ArcTo()

BOOL EMFDRV_ArcTo ( PHYSDEV  dev,
INT  left,
INT  top,
INT  right,
INT  bottom,
INT  xstart,
INT  ystart,
INT  xend,
INT  yend 
)

Definition at line 359 of file graphics.c.

361 {
362  return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart,
363  xend, yend, EMR_ARCTO );
364 }
#define EMR_ARCTO
Definition: wingdi.h:129
GLint GLint bottom
Definition: glext.h:7726
static BOOL EMFDRV_ArcChordPie(PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend, DWORD iType)
Definition: graphics.c:226
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

◆ EMFDRV_Chord()

BOOL EMFDRV_Chord ( PHYSDEV  dev,
INT  left,
INT  top,
INT  right,
INT  bottom,
INT  xstart,
INT  ystart,
INT  xend,
INT  yend 
)

Definition at line 380 of file graphics.c.

382 {
383  return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart,
384  xend, yend, EMR_CHORD );
385 }
GLint GLint bottom
Definition: glext.h:7726
static BOOL EMFDRV_ArcChordPie(PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend, DWORD iType)
Definition: graphics.c:226
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
#define EMR_CHORD
Definition: wingdi.h:120
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

◆ EMFDRV_Ellipse()

BOOL EMFDRV_Ellipse ( PHYSDEV  dev,
INT  left,
INT  top,
INT  right,
INT  bottom 
)

Definition at line 408 of file graphics.c.

409 {
410  EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
411 #ifndef __REACTOS__
412  DC *dc = get_physdev_dc( dev );
413 #endif
414  EMRELLIPSE emr;
415  INT temp;
416 
417  TRACE("%d,%d - %d,%d\n", left, top, right, bottom);
418 
419  if(left == right || top == bottom) return FALSE;
420 
421  if(left > right) {temp = left; left = right; right = temp;}
422  if(top > bottom) {temp = top; top = bottom; bottom = temp;}
423 #ifdef __REACTOS__
424  if(GetGraphicsMode(dev->hdc) == GM_COMPATIBLE) {
425 #else
426  if(dc->GraphicsMode == GM_COMPATIBLE) {
427 #endif
428  right--;
429  bottom--;
430  }
431 
432  emr.emr.iType = EMR_ELLIPSE;
433  emr.emr.nSize = sizeof(emr);
434  emr.rclBox.left = left;
435  emr.rclBox.top = top;
436  emr.rclBox.right = right;
437  emr.rclBox.bottom = bottom;
438 
439  if(!physDev->path)
440  EMFDRV_UpdateBBox( dev, &emr.rclBox );
441  return EMFDRV_WriteRecord( dev, &emr.emr );
442 }
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
static EMFDRV_PDEVICE * get_emf_physdev(PHYSDEV dev)
long bottom
Definition: polytest.cpp:53
HDC dc
Definition: cylfrac.c:34
int32_t INT
Definition: typedefs.h:56
long right
Definition: polytest.cpp:53
RECTL rclBox
Definition: wingdi.h:1851
long top
Definition: polytest.cpp:53
GLint GLint bottom
Definition: glext.h:7726
long left
Definition: polytest.cpp:53
#define TRACE(s)
Definition: solgame.cpp:4
Definition: polytest.cpp:40
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect) DECLSPEC_HIDDEN
Definition: init.c:231
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:863
DWORD nSize
Definition: wingdi.h:1686
DWORD iType
Definition: wingdi.h:1685
static calc_node_t temp
Definition: rpn_ieee.c:38
WINEDC * get_physdev_dc(PHYSDEV dev)
Definition: rosglue.c:191
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

◆ EMFDRV_ExtFloodFill()

BOOL EMFDRV_ExtFloodFill ( PHYSDEV  dev,
INT  x,
INT  y,
COLORREF  color,
UINT  fillType 
)

Definition at line 747 of file graphics.c.

748 {
749  EMREXTFLOODFILL emr;
750 
751  emr.emr.iType = EMR_EXTFLOODFILL;
752  emr.emr.nSize = sizeof(emr);
753  emr.ptlStart.x = x;
754  emr.ptlStart.y = y;
755  emr.crColor = color;
756  emr.iMode = fillType;
757 
758  return EMFDRV_WriteRecord( dev, &emr.emr );
759 }
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG y
Definition: windef.h:315
GLuint color
Definition: glext.h:6243
LONG x
Definition: windef.h:314
DWORD nSize
Definition: wingdi.h:1686
#define EMR_EXTFLOODFILL
Definition: wingdi.h:127
DWORD iType
Definition: wingdi.h:1685
COLORREF crColor
Definition: wingdi.h:1957
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ EMFDRV_ExtTextOut()

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

Definition at line 883 of file graphics.c.

885 {
886  EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
887 #ifndef __REACTOS__
888  DC *dc = get_physdev_dc( dev );
889 #endif
890  EMREXTTEXTOUTW *pemr;
891  DWORD nSize;
892  BOOL ret;
893  int textHeight = 0;
894  int textWidth = 0;
895 #ifdef __REACTOS__
896  const UINT textAlign = GetTextAlign( dev->hdc );
897  const INT graphicsMode = GetGraphicsMode( dev->hdc );
898 #else
899  const UINT textAlign = dc->textAlign;
900  const INT graphicsMode = dc->GraphicsMode;
901 #endif
902  FLOAT exScale, eyScale;
903 
904  nSize = sizeof(*pemr) + ((count+1) & ~1) * sizeof(WCHAR) + count * sizeof(INT);
905 
906  TRACE("%s %s count %d nSize = %d\n", debugstr_wn(str, count),
907  wine_dbgstr_rect(lprect), count, nSize);
909 
910  if (graphicsMode == GM_COMPATIBLE)
911  {
912  const INT horzSize = GetDeviceCaps( dev->hdc, HORZSIZE );
913  const INT horzRes = GetDeviceCaps( dev->hdc, HORZRES );
914  const INT vertSize = GetDeviceCaps( dev->hdc, VERTSIZE );
915  const INT vertRes = GetDeviceCaps( dev->hdc, VERTRES );
916  SIZE wndext, vportext;
917 
918  GetViewportExtEx( dev->hdc, &vportext );
919  GetWindowExtEx( dev->hdc, &wndext );
920  exScale = 100.0 * ((FLOAT)horzSize / (FLOAT)horzRes) /
921  ((FLOAT)wndext.cx / (FLOAT)vportext.cx);
922  eyScale = 100.0 * ((FLOAT)vertSize / (FLOAT)vertRes) /
923  ((FLOAT)wndext.cy / (FLOAT)vportext.cy);
924  }
925  else
926  {
927  exScale = 0.0;
928  eyScale = 0.0;
929  }
930 
931  pemr->emr.iType = EMR_EXTTEXTOUTW;
932  pemr->emr.nSize = nSize;
933  pemr->iGraphicsMode = graphicsMode;
934  pemr->exScale = exScale;
935  pemr->eyScale = eyScale;
936  pemr->emrtext.ptlReference.x = x;
937  pemr->emrtext.ptlReference.y = y;
938  pemr->emrtext.nChars = count;
939  pemr->emrtext.offString = sizeof(*pemr);
940  memcpy((char*)pemr + pemr->emrtext.offString, str, count * sizeof(WCHAR));
941  pemr->emrtext.fOptions = flags;
942  if(!lprect) {
943  pemr->emrtext.rcl.left = pemr->emrtext.rcl.top = 0;
944  pemr->emrtext.rcl.right = pemr->emrtext.rcl.bottom = -1;
945  } else {
946  pemr->emrtext.rcl.left = lprect->left;
947  pemr->emrtext.rcl.top = lprect->top;
948  pemr->emrtext.rcl.right = lprect->right;
949  pemr->emrtext.rcl.bottom = lprect->bottom;
950  }
951 
952  pemr->emrtext.offDx = pemr->emrtext.offString + ((count+1) & ~1) * sizeof(WCHAR);
953  if(lpDx) {
954  UINT i;
955  SIZE strSize;
956  memcpy((char*)pemr + pemr->emrtext.offDx, lpDx, count * sizeof(INT));
957  for (i = 0; i < count; i++) {
958  textWidth += lpDx[i];
959  }
960  if (GetTextExtentPoint32W( dev->hdc, str, count, &strSize ))
961  textHeight = strSize.cy;
962  }
963  else {
964  UINT i;
965  INT *dx = (INT *)((char*)pemr + pemr->emrtext.offDx);
966  SIZE charSize;
967  for (i = 0; i < count; i++) {
968  if (GetTextExtentPoint32W( dev->hdc, str + i, 1, &charSize )) {
969  dx[i] = charSize.cx;
970  textWidth += charSize.cx;
971  textHeight = max(textHeight, charSize.cy);
972  }
973  }
974  }
975 
976  if (physDev->path)
977  {
978  pemr->rclBounds.left = pemr->rclBounds.top = 0;
979  pemr->rclBounds.right = pemr->rclBounds.bottom = -1;
980  goto no_bounds;
981  }
982 
983  /* FIXME: handle font escapement */
984  switch (textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER)) {
985  case TA_CENTER: {
986  pemr->rclBounds.left = x - (textWidth / 2) - 1;
987  pemr->rclBounds.right = x + (textWidth / 2) + 1;
988  break;
989  }
990  case TA_RIGHT: {
991  pemr->rclBounds.left = x - textWidth - 1;
992  pemr->rclBounds.right = x;
993  break;
994  }
995  default: { /* TA_LEFT */
996  pemr->rclBounds.left = x;
997  pemr->rclBounds.right = x + textWidth + 1;
998  }
999  }
1000 
1001  switch (textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE)) {
1002  case TA_BASELINE: {
1003  TEXTMETRICW tm;
1004  if (!GetTextMetricsW( dev->hdc, &tm ))
1005  tm.tmDescent = 0;
1006  /* Play safe here... it's better to have a bounding box */
1007  /* that is too big than too small. */
1008  pemr->rclBounds.top = y - textHeight - 1;
1009  pemr->rclBounds.bottom = y + tm.tmDescent + 1;
1010  break;
1011  }
1012  case TA_BOTTOM: {
1013  pemr->rclBounds.top = y - textHeight - 1;
1014  pemr->rclBounds.bottom = y;
1015  break;
1016  }
1017  default: { /* TA_TOP */
1018  pemr->rclBounds.top = y;
1019  pemr->rclBounds.bottom = y + textHeight + 1;
1020  }
1021  }
1022  EMFDRV_UpdateBBox( dev, &pemr->rclBounds );
1023 
1024 no_bounds:
1025  ret = EMFDRV_WriteRecord( dev, &pemr->emr );
1026  HeapFree( GetProcessHeap(), 0, pemr );
1027  return ret;
1028 }
#define max(a, b)
Definition: svc.c:63
#define HORZRES
Definition: wingdi.h:715
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
#define FLOAT
Definition: i386-dis.c:516
GLuint GLuint GLsizei count
Definition: gl.h:1545
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2031
static EMFDRV_PDEVICE * get_emf_physdev(PHYSDEV dev)
LONG top
Definition: windef.h:292
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HDC dc
Definition: cylfrac.c:34
#define TA_LEFT
Definition: wingdi.h:931
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
int32_t INT
Definition: typedefs.h:56
UINT WINAPI GetTextAlign(_In_ HDC)
Definition: text.c:808
#define TA_TOP
Definition: wingdi.h:929
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 BOOL
Definition: ntddk_ex.h:94
#define TA_BASELINE
Definition: wingdi.h:927
const WCHAR * str
#define TA_BOTTOM
Definition: wingdi.h:928
LONG cx
Definition: windef.h:319
#define EMR_EXTTEXTOUTW
Definition: wingdi.h:157
#define TA_RIGHT
Definition: wingdi.h:932
#define TRACE(s)
Definition: solgame.cpp:4
Definition: polytest.cpp:40
#define GetProcessHeap()
Definition: compat.h:395
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
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect) DECLSPEC_HIDDEN
Definition: init.c:231
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
GLbitfield flags
Definition: glext.h:7161
#define GM_COMPATIBLE
Definition: wingdi.h:863
int ret
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: time.h:76
#define debugstr_wn
Definition: kernel32.h:33
#define HORZSIZE
Definition: wingdi.h:713
#define VERTSIZE
Definition: wingdi.h:714
WINEDC * get_physdev_dc(PHYSDEV dev)
Definition: rosglue.c:191
unsigned int UINT
Definition: ndis.h:50
#define VERTRES
Definition: wingdi.h:716
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97
float FLOAT
Definition: typedefs.h:67
LONG bottom
Definition: windef.h:294
#define TA_CENTER
Definition: wingdi.h:930
LONG cy
Definition: windef.h:320
#define HeapFree(x, y, z)
Definition: compat.h:394
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)

◆ EMFDRV_FillPath()

BOOL EMFDRV_FillPath ( PHYSDEV  dev)

Definition at line 1087 of file graphics.c.

1088 {
1090 }
static BOOL emfdrv_stroke_and_fill_path(PHYSDEV dev, INT type)
Definition: graphics.c:144
#define EMR_FILLPATH
Definition: wingdi.h:136

◆ EMFDRV_FillRgn()

BOOL EMFDRV_FillRgn ( PHYSDEV  dev,
HRGN  hrgn,
HBRUSH  hbrush 
)

Definition at line 765 of file graphics.c.

766 {
767  EMRFILLRGN *emr;
768  DWORD size, rgnsize, index;
769  BOOL ret;
770 
772  if(!index) return FALSE;
773 
774  rgnsize = GetRegionData( hrgn, 0, NULL );
775  size = rgnsize + offsetof(EMRFILLRGN,RgnData);
776  emr = HeapAlloc( GetProcessHeap(), 0, size );
777 
778  GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
779 
780  emr->emr.iType = EMR_FILLRGN;
781  emr->emr.nSize = size;
782  emr->rclBounds.left = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.left;
783  emr->rclBounds.top = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.top;
784  emr->rclBounds.right = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.right - 1;
785  emr->rclBounds.bottom = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.bottom - 1;
786  emr->cbRgnData = rgnsize;
787  emr->ihBrush = index;
788 
789  ret = EMFDRV_WriteRecord( dev, &emr->emr );
790  if(ret)
791  EMFDRV_UpdateBBox( dev, &emr->rclBounds );
792  HeapFree( GetProcessHeap(), 0, emr );
793  return ret;
794 }
static HBRUSH hbrush
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
DWORD ihBrush
Definition: wingdi.h:1990
long bottom
Definition: polytest.cpp:53
BYTE RgnData[1]
Definition: wingdi.h:1991
long right
Definition: polytest.cpp:53
DWORD cbRgnData
Definition: wingdi.h:1989
unsigned int BOOL
Definition: ntddk_ex.h:94
long top
Definition: polytest.cpp:53
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
GLuint index
Definition: glext.h:6031
long left
Definition: polytest.cpp:53
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect) DECLSPEC_HIDDEN
Definition: init.c:231
unsigned long DWORD
Definition: ntddk_ex.h:95
#define EMR_FILLRGN
Definition: wingdi.h:144
int ret
DWORD nSize
Definition: wingdi.h:1686
#define index(s, c)
Definition: various.h:29
static HRGN hrgn
Definition: win.c:55
DWORD iType
Definition: wingdi.h:1685
RECTL rclBounds
Definition: wingdi.h:1988
DWORD EMFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush) DECLSPEC_HIDDEN
Definition: objects.c:111
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:394

◆ EMFDRV_FrameRgn()

BOOL EMFDRV_FrameRgn ( PHYSDEV  dev,
HRGN  hrgn,
HBRUSH  hbrush,
INT  width,
INT  height 
)

Definition at line 798 of file graphics.c.

799 {
800  EMRFRAMERGN *emr;
801  DWORD size, rgnsize, index;
802  BOOL ret;
803 
805  if(!index) return FALSE;
806 
807  rgnsize = GetRegionData( hrgn, 0, NULL );
808  size = rgnsize + offsetof(EMRFRAMERGN,RgnData);
809  emr = HeapAlloc( GetProcessHeap(), 0, size );
810 
811  GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
812 
813  emr->emr.iType = EMR_FRAMERGN;
814  emr->emr.nSize = size;
815  emr->rclBounds.left = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.left;
816  emr->rclBounds.top = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.top;
817  emr->rclBounds.right = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.right - 1;
818  emr->rclBounds.bottom = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.bottom - 1;
819  emr->cbRgnData = rgnsize;
820  emr->ihBrush = index;
821  emr->szlStroke.cx = width;
822  emr->szlStroke.cy = height;
823 
824  ret = EMFDRV_WriteRecord( dev, &emr->emr );
825  if(ret)
826  EMFDRV_UpdateBBox( dev, &emr->rclBounds );
827  HeapFree( GetProcessHeap(), 0, emr );
828  return ret;
829 }
GLint GLint GLsizei width
Definition: gl.h:1546
static HBRUSH hbrush
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
DWORD ihBrush
Definition: wingdi.h:2012
unsigned int BOOL
Definition: ntddk_ex.h:94
long top
Definition: polytest.cpp:53
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
LONG cx
Definition: windef.h:319
GLuint index
Definition: glext.h:6031
#define EMR_FRAMERGN
Definition: wingdi.h:145
long left
Definition: polytest.cpp:53
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect) DECLSPEC_HIDDEN
Definition: init.c:231
unsigned long DWORD
Definition: ntddk_ex.h:95
BYTE RgnData[1]
Definition: wingdi.h:2014
int ret
DWORD nSize
Definition: wingdi.h:1686
#define index(s, c)
Definition: various.h:29
static HRGN hrgn
Definition: win.c:55
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
DWORD iType
Definition: wingdi.h:1685
SIZEL szlStroke
Definition: wingdi.h:2013
DWORD EMFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush) DECLSPEC_HIDDEN
Definition: objects.c:111
DWORD cbRgnData
Definition: wingdi.h:2011
RECTL rclBounds
Definition: wingdi.h:2010
LONG cy
Definition: windef.h:320
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:394

◆ EMFDRV_GradientFill()

BOOL EMFDRV_GradientFill ( PHYSDEV  dev,
TRIVERTEX vert_array,
ULONG  nvert,
void grad_array,
ULONG  ngrad,
ULONG  mode 
)

Definition at line 1033 of file graphics.c.

1035 {
1036  EMRGRADIENTFILL *emr;
1037  ULONG i, pt, size, num_pts = ngrad * (mode == GRADIENT_FILL_TRIANGLE ? 3 : 2);
1038  const ULONG *pts = (const ULONG *)grad_array;
1039  BOOL ret;
1040 
1041  size = FIELD_OFFSET(EMRGRADIENTFILL, Ver[nvert]) + num_pts * sizeof(pts[0]);
1042 
1043  emr = HeapAlloc( GetProcessHeap(), 0, size );
1044  if (!emr) return FALSE;
1045 
1046  for (i = 0; i < num_pts; i++)
1047  {
1048  pt = pts[i];
1049 
1050  if (i == 0)
1051  {
1052  emr->rclBounds.left = emr->rclBounds.right = vert_array[pt].x;
1053  emr->rclBounds.top = emr->rclBounds.bottom = vert_array[pt].y;
1054  }
1055  else
1056  {
1057  if (vert_array[pt].x < emr->rclBounds.left)
1058  emr->rclBounds.left = vert_array[pt].x;
1059  else if (vert_array[pt].x > emr->rclBounds.right)
1060  emr->rclBounds.right = vert_array[pt].x;
1061  if (vert_array[pt].y < emr->rclBounds.top)
1062  emr->rclBounds.top = vert_array[pt].y;
1063  else if (vert_array[pt].y > emr->rclBounds.bottom)
1064  emr->rclBounds.bottom = vert_array[pt].y;
1065  }
1066  }
1067  emr->rclBounds.right--;
1068  emr->rclBounds.bottom--;
1069 
1070  emr->emr.iType = EMR_GRADIENTFILL;
1071  emr->emr.nSize = size;
1072  emr->nVer = nvert;
1073  emr->nTri = ngrad;
1074  emr->ulMode = mode;
1075  memcpy( emr->Ver, vert_array, nvert * sizeof(vert_array[0]) );
1076  memcpy( emr->Ver + nvert, pts, num_pts * sizeof(pts[0]) );
1077 
1078  EMFDRV_UpdateBBox( dev, &emr->rclBounds );
1079  ret = EMFDRV_WriteRecord( dev, &emr->emr );
1080  HeapFree( GetProcessHeap(), 0, emr );
1081  return ret;
1082 }
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
#define pt(x, y)
Definition: drawing.c:79
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
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
LONG y
Definition: wingdi.h:2780
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect) DECLSPEC_HIDDEN
Definition: init.c:231
LONG x
Definition: wingdi.h:2779
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum mode
Definition: glext.h:6217
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
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:394

◆ EMFDRV_InvertRgn()

BOOL EMFDRV_InvertRgn ( PHYSDEV  dev,
HRGN  hrgn 
)

Definition at line 875 of file graphics.c.

876 {
878 }
static BOOL EMFDRV_PaintInvertRgn(PHYSDEV dev, HRGN hrgn, DWORD iType)
Definition: graphics.c:836
#define EMR_INVERTRGN
Definition: wingdi.h:146
static HRGN hrgn
Definition: win.c:55

◆ EMFDRV_LineTo()

BOOL EMFDRV_LineTo ( PHYSDEV  dev,
INT  x,
INT  y 
)

Definition at line 188 of file graphics.c.

189 {
190  EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
191 #ifndef __REACTOS__
192  DC *dc = get_physdev_dc( dev );
193 #endif
194  POINT pt;
195  EMRLINETO emr;
196  RECTL bounds;
197 
198  emr.emr.iType = EMR_LINETO;
199  emr.emr.nSize = sizeof(emr);
200  emr.ptl.x = x;
201  emr.ptl.y = y;
202 
203  if(!EMFDRV_WriteRecord( dev, &emr.emr ))
204  return FALSE;
205 #ifdef __REACTOS__
206  GetCurrentPositionEx( dev->hdc, &pt );
207 #else
208  pt = dc->cur_pos;
209 #endif
210  bounds.left = min(x, pt.x);
211  bounds.top = min(y, pt.y);
212  bounds.right = max(x, pt.x);
213  bounds.bottom = max(y, pt.y);
214 
215  if(!physDev->path)
216  EMFDRV_UpdateBBox( dev, &bounds );
217 
218  return TRUE;
219 }
BOOL WINAPI GetCurrentPositionEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:241
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
#define pt(x, y)
Definition: drawing.c:79
#define EMR_LINETO
Definition: wingdi.h:128
static EMFDRV_PDEVICE * get_emf_physdev(PHYSDEV dev)
long bottom
Definition: polytest.cpp:53
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HDC dc
Definition: cylfrac.c:34
LONG y
Definition: windef.h:315
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
POINTL ptl
Definition: wingdi.h:2029
long left
Definition: polytest.cpp:53
Definition: polytest.cpp:40
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect) DECLSPEC_HIDDEN
Definition: init.c:231
LONG x
Definition: windef.h:314
DWORD nSize
Definition: wingdi.h:1686
DWORD iType
Definition: wingdi.h:1685
WINEDC * get_physdev_dc(PHYSDEV dev)
Definition: rosglue.c:191
#define min(a, b)
Definition: monoChain.cc:55
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ EMFDRV_MoveTo()

BOOL EMFDRV_MoveTo ( PHYSDEV  dev,
INT  x,
INT  y 
)

Definition at line 173 of file graphics.c.

174 {
175  EMRMOVETOEX emr;
176 
177  emr.emr.iType = EMR_MOVETOEX;
178  emr.emr.nSize = sizeof(emr);
179  emr.ptl.x = x;
180  emr.ptl.y = y;
181 
182  return EMFDRV_WriteRecord( dev, &emr.emr );
183 }
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define EMR_MOVETOEX
Definition: wingdi.h:101
LONG y
Definition: windef.h:315
POINTL ptl
Definition: wingdi.h:2029
LONG x
Definition: windef.h:314
DWORD nSize
Definition: wingdi.h:1686
DWORD iType
Definition: wingdi.h:1685
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ EMFDRV_PaintInvertRgn()

static BOOL EMFDRV_PaintInvertRgn ( PHYSDEV  dev,
HRGN  hrgn,
DWORD  iType 
)
static

Definition at line 836 of file graphics.c.

837 {
838  EMRINVERTRGN *emr;
839  DWORD size, rgnsize;
840  BOOL ret;
841 
842 
843  rgnsize = GetRegionData( hrgn, 0, NULL );
844  size = rgnsize + offsetof(EMRINVERTRGN,RgnData);
845  emr = HeapAlloc( GetProcessHeap(), 0, size );
846 
847  GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
848 
849  emr->emr.iType = iType;
850  emr->emr.nSize = size;
851  emr->rclBounds.left = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.left;
852  emr->rclBounds.top = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.top;
853  emr->rclBounds.right = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.right - 1;
854  emr->rclBounds.bottom = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.bottom - 1;
855  emr->cbRgnData = rgnsize;
856 
857  ret = EMFDRV_WriteRecord( dev, &emr->emr );
858  if(ret)
859  EMFDRV_UpdateBBox( dev, &emr->rclBounds );
860  HeapFree( GetProcessHeap(), 0, emr );
861  return ret;
862 }
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
_In_ ULONG iType
Definition: winddi.h:3748
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
unsigned int BOOL
Definition: ntddk_ex.h:94
long top
Definition: polytest.cpp:53
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
long left
Definition: polytest.cpp:53
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect) DECLSPEC_HIDDEN
Definition: init.c:231
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
DWORD nSize
Definition: wingdi.h:1686
static HRGN hrgn
Definition: win.c:55
BYTE RgnData[1]
Definition: wingdi.h:2025
DWORD iType
Definition: wingdi.h:1685
DWORD cbRgnData
Definition: wingdi.h:2024
RECTL rclBounds
Definition: wingdi.h:2023
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:394

Referenced by EMFDRV_InvertRgn(), and EMFDRV_PaintRgn().

◆ EMFDRV_PaintRgn()

BOOL EMFDRV_PaintRgn ( PHYSDEV  dev,
HRGN  hrgn 
)

Definition at line 867 of file graphics.c.

868 {
870 }
static BOOL EMFDRV_PaintInvertRgn(PHYSDEV dev, HRGN hrgn, DWORD iType)
Definition: graphics.c:836
#define EMR_PAINTRGN
Definition: wingdi.h:147
static HRGN hrgn
Definition: win.c:55

◆ EMFDRV_Pie()

BOOL EMFDRV_Pie ( PHYSDEV  dev,
INT  left,
INT  top,
INT  right,
INT  bottom,
INT  xstart,
INT  ystart,
INT  xend,
INT  yend 
)

Definition at line 369 of file graphics.c.

371 {
372  return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart,
373  xend, yend, EMR_PIE );
374 }
GLint GLint bottom
Definition: glext.h:7726
static BOOL EMFDRV_ArcChordPie(PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend, DWORD iType)
Definition: graphics.c:226
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
#define EMR_PIE
Definition: wingdi.h:121
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

◆ EMFDRV_PolyBezier()

BOOL EMFDRV_PolyBezier ( PHYSDEV  dev,
const POINT pts,
DWORD  count 
)

Definition at line 617 of file graphics.c.

618 {
619  return EMFDRV_Polylinegon( dev, pts, count, EMR_POLYBEZIER );
620 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define EMR_POLYBEZIER
Definition: wingdi.h:76
static BOOL EMFDRV_Polylinegon(PHYSDEV dev, const POINT *pt, INT count, DWORD iType)
Definition: graphics.c:552

◆ EMFDRV_PolyBezierTo()

BOOL EMFDRV_PolyBezierTo ( PHYSDEV  dev,
const POINT pts,
DWORD  count 
)

Definition at line 625 of file graphics.c.

626 {
627  return EMFDRV_Polylinegon( dev, pts, count, EMR_POLYBEZIERTO );
628 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
static BOOL EMFDRV_Polylinegon(PHYSDEV dev, const POINT *pt, INT count, DWORD iType)
Definition: graphics.c:552
#define EMR_POLYBEZIERTO
Definition: wingdi.h:79

◆ EMFDRV_PolyDraw()

BOOL EMFDRV_PolyDraw ( PHYSDEV  dev,
const POINT pts,
const BYTE types,
DWORD  count 
)

Definition at line 710 of file graphics.c.

711 {
712  EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
713  EMRPOLYDRAW *emr;
714  BOOL ret;
715  BYTE *types_dest;
716  BOOL use_small_emr = can_use_short_points( pts, count );
717  DWORD size;
718 
719  size = use_small_emr ? offsetof( EMRPOLYDRAW16, apts[count] ) : offsetof( EMRPOLYDRAW, aptl[count] );
720  size += (count + 3) & ~3;
721 
722  if (!(emr = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
723 
724  emr->emr.iType = use_small_emr ? EMR_POLYDRAW16 : EMR_POLYDRAW;
725  emr->emr.nSize = size;
726  emr->cptl = count;
727 
728  types_dest = store_points( emr->aptl, pts, count, use_small_emr );
729  memcpy( types_dest, types, count );
730  if (count & 3) memset( types_dest + count, 0, 4 - (count & 3) );
731 
732  if (!physDev->path)
733  get_points_bounds( &emr->rclBounds, pts, count, 0 );
734  else
735  emr->rclBounds = empty_bounds;
736 
737  ret = EMFDRV_WriteRecord( dev, &emr->emr );
738  if (ret && !physDev->path) EMFDRV_UpdateBBox( dev, &emr->rclBounds );
739  HeapFree( GetProcessHeap(), 0, emr );
740  return ret;
741 }
static const RECTL empty_bounds
Definition: graphics.c:36
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
GLuint GLuint GLsizei count
Definition: gl.h:1545
POINTL aptl[1]
Definition: wingdi.h:2092
static EMFDRV_PDEVICE * get_emf_physdev(PHYSDEV dev)
static BOOL can_use_short_points(const POINT *pts, UINT count)
Definition: graphics.c:39
#define EMR_POLYDRAW
Definition: wingdi.h:130
static void * store_points(POINTL *dest, const POINT *pts, UINT count, BOOL short_points)
Definition: graphics.c:50
unsigned int BOOL
Definition: ntddk_ex.h:94
static struct list apts
Definition: compobj.c:78
#define offsetof(TYPE, MEMBER)
RECTL rclBounds
Definition: wingdi.h:2090
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
Definition: cmds.c:130
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect) DECLSPEC_HIDDEN
Definition: init.c:231
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
DWORD nSize
Definition: wingdi.h:1686
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
DWORD cptl
Definition: wingdi.h:2091
DWORD iType
Definition: wingdi.h:1685
#define EMR_POLYDRAW16
Definition: wingdi.h:165
static void get_points_bounds(RECTL *bounds, const POINT *pts, UINT count, DC *dc)
Definition: graphics.c:75
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ EMFDRV_Polygon()

BOOL EMFDRV_Polygon ( PHYSDEV  dev,
const POINT pt,
INT  count 
)

Definition at line 608 of file graphics.c.

609 {
610  if(count < 2) return FALSE;
612 }
#define pt(x, y)
Definition: drawing.c:79
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define EMR_POLYGON
Definition: wingdi.h:77
static BOOL EMFDRV_Polylinegon(PHYSDEV dev, const POINT *pt, INT count, DWORD iType)
Definition: graphics.c:552

◆ EMFDRV_Polyline()

BOOL EMFDRV_Polyline ( PHYSDEV  dev,
const POINT pt,
INT  count 
)

Definition at line 592 of file graphics.c.

593 {
595 }
#define EMR_POLYLINE
Definition: wingdi.h:78
#define pt(x, y)
Definition: drawing.c:79
GLuint GLuint GLsizei count
Definition: gl.h:1545
static BOOL EMFDRV_Polylinegon(PHYSDEV dev, const POINT *pt, INT count, DWORD iType)
Definition: graphics.c:552

◆ EMFDRV_Polylinegon()

static BOOL EMFDRV_Polylinegon ( PHYSDEV  dev,
const POINT pt,
INT  count,
DWORD  iType 
)
static

Definition at line 552 of file graphics.c.

553 {
554  EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
555 #ifndef __REACTOS__
556  DC *dc = get_physdev_dc( dev );
557 #endif
558  EMRPOLYLINE *emr;
559  DWORD size;
560  BOOL ret, use_small_emr = can_use_short_points( pt, count );
561 
562  size = use_small_emr ? offsetof( EMRPOLYLINE16, apts[count] ) : offsetof( EMRPOLYLINE, aptl[count] );
563 
564  emr = HeapAlloc( GetProcessHeap(), 0, size );
565  emr->emr.iType = use_small_emr ? iType + EMR_POLYLINE16 - EMR_POLYLINE : iType;
566  emr->emr.nSize = size;
567  emr->cptl = count;
568 
569  store_points( emr->aptl, pt, count, use_small_emr );
570 
571  if (!physDev->path)
573 #ifdef __REACTOS__
574  (iType == EMR_POLYBEZIERTO || iType == EMR_POLYLINETO) ? dev->hdc : 0 );
575 #else
576  (iType == EMR_POLYBEZIERTO || iType == EMR_POLYLINETO) ? dc : 0 );
577 #endif
578  else
579  emr->rclBounds = empty_bounds;
580 
581  ret = EMFDRV_WriteRecord( dev, &emr->emr );
582  if (ret && !physDev->path)
583  EMFDRV_UpdateBBox( dev, &emr->rclBounds );
584  HeapFree( GetProcessHeap(), 0, emr );
585  return ret;
586 }
static const RECTL empty_bounds
Definition: graphics.c:36
#define EMR_POLYLINE
Definition: wingdi.h:78
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
#define EMR_POLYLINE16
Definition: wingdi.h:160
#define pt(x, y)
Definition: drawing.c:79
_In_ ULONG iType
Definition: winddi.h:3748
GLuint GLuint GLsizei count
Definition: gl.h:1545
DWORD cptl
Definition: wingdi.h:2105
static EMFDRV_PDEVICE * get_emf_physdev(PHYSDEV dev)
#define EMR_POLYLINETO
Definition: wingdi.h:80
HDC dc
Definition: cylfrac.c:34
static BOOL can_use_short_points(const POINT *pts, UINT count)
Definition: graphics.c:39
static void * store_points(POINTL *dest, const POINT *pts, UINT count, BOOL short_points)
Definition: graphics.c:50
unsigned int BOOL
Definition: ntddk_ex.h:94
static struct list apts
Definition: compobj.c:78
#define offsetof(TYPE, MEMBER)
RECTL rclBounds
Definition: wingdi.h:2104
Definition: polytest.cpp:40
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect) DECLSPEC_HIDDEN
Definition: init.c:231
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
DWORD nSize
Definition: wingdi.h:1686
DWORD iType
Definition: wingdi.h:1685
POINTL aptl[1]
Definition: wingdi.h:2106
WINEDC * get_physdev_dc(PHYSDEV dev)
Definition: rosglue.c:191
static void get_points_bounds(RECTL *bounds, const POINT *pts, UINT count, DC *dc)
Definition: graphics.c:75
#define HeapFree(x, y, z)
Definition: compat.h:394
#define EMR_POLYBEZIERTO
Definition: wingdi.h:79

Referenced by EMFDRV_PolyBezier(), EMFDRV_PolyBezierTo(), EMFDRV_Polygon(), EMFDRV_Polyline(), and EMFDRV_PolylineTo().

◆ EMFDRV_PolylineTo()

BOOL EMFDRV_PolylineTo ( PHYSDEV  dev,
const POINT pt,
INT  count 
)

Definition at line 600 of file graphics.c.

601 {
603 }
#define pt(x, y)
Definition: drawing.c:79
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define EMR_POLYLINETO
Definition: wingdi.h:80
static BOOL EMFDRV_Polylinegon(PHYSDEV dev, const POINT *pt, INT count, DWORD iType)
Definition: graphics.c:552

◆ EMFDRV_PolyPolygon()

BOOL EMFDRV_PolyPolygon ( PHYSDEV  dev,
const POINT pt,
const INT counts,
UINT  polys 
)

Definition at line 701 of file graphics.c.

702 {
703  return EMFDRV_PolyPolylinegon( dev, pt, counts, polys, EMR_POLYPOLYGON );
704 }
#define pt(x, y)
Definition: drawing.c:79
static BOOL EMFDRV_PolyPolylinegon(PHYSDEV dev, const POINT *pt, const INT *counts, UINT polys, DWORD iType)
Definition: graphics.c:637
#define EMR_POLYPOLYGON
Definition: wingdi.h:82

◆ EMFDRV_PolyPolyline()

BOOL EMFDRV_PolyPolyline ( PHYSDEV  dev,
const POINT pt,
const DWORD counts,
DWORD  polys 
)

Definition at line 692 of file graphics.c.

693 {
694  return EMFDRV_PolyPolylinegon( dev, pt, (const INT *)counts, polys,
696 }
#define pt(x, y)
Definition: drawing.c:79
int32_t INT
Definition: typedefs.h:56
#define EMR_POLYPOLYLINE
Definition: wingdi.h:81
static BOOL EMFDRV_PolyPolylinegon(PHYSDEV dev, const POINT *pt, const INT *counts, UINT polys, DWORD iType)
Definition: graphics.c:637

◆ EMFDRV_PolyPolylinegon()

static BOOL EMFDRV_PolyPolylinegon ( PHYSDEV  dev,
const POINT pt,
const INT counts,
UINT  polys,
DWORD  iType 
)
static

Definition at line 637 of file graphics.c.

639 {
640  EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
641  EMRPOLYPOLYLINE *emr;
642  DWORD cptl = 0, poly, size;
643  BOOL ret, use_small_emr, bounds_valid = TRUE;
644 
645  for(poly = 0; poly < polys; poly++) {
646  cptl += counts[poly];
647  if(counts[poly] < 2) bounds_valid = FALSE;
648  }
649  if(!cptl) bounds_valid = FALSE;
650  use_small_emr = can_use_short_points( pt, cptl );
651 
652  size = FIELD_OFFSET(EMRPOLYPOLYLINE, aPolyCounts[polys]);
653  if(use_small_emr)
654  size += cptl * sizeof(POINTS);
655  else
656  size += cptl * sizeof(POINTL);
657 
658  emr = HeapAlloc( GetProcessHeap(), 0, size );
659 
660  emr->emr.iType = iType;
661  if(use_small_emr) emr->emr.iType += EMR_POLYPOLYLINE16 - EMR_POLYPOLYLINE;
662 
663  emr->emr.nSize = size;
664  if(bounds_valid && !physDev->path)
665  get_points_bounds( &emr->rclBounds, pt, cptl, 0 );
666  else
667  emr->rclBounds = empty_bounds;
668  emr->nPolys = polys;
669  emr->cptl = cptl;
670 
671  if(polys)
672  {
673  memcpy( emr->aPolyCounts, counts, polys * sizeof(DWORD) );
674  store_points( (POINTL *)(emr->aPolyCounts + polys), pt, cptl, use_small_emr );
675  }
676 
677  ret = EMFDRV_WriteRecord( dev, &emr->emr );
678  if(ret && !bounds_valid)
679  {
680  ret = FALSE;
682  }
683  if(ret && !physDev->path)
684  EMFDRV_UpdateBBox( dev, &emr->rclBounds );
685  HeapFree( GetProcessHeap(), 0, emr );
686  return ret;
687 }
static const RECTL empty_bounds
Definition: graphics.c:36
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
#define pt(x, y)
Definition: drawing.c:79
_In_ ULONG iType
Definition: winddi.h:3748
struct tagPOINTS POINTS
static EMFDRV_PDEVICE * get_emf_physdev(PHYSDEV dev)
static BOOL can_use_short_points(const POINT *pts, UINT count)
Definition: graphics.c:39
static void * store_points(POINTL *dest, const POINT *pts, UINT count, BOOL short_points)
Definition: graphics.c:50
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EMR_POLYPOLYLINE
Definition: wingdi.h:81
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect) DECLSPEC_HIDDEN
Definition: init.c:231
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
struct _POINTL POINTL
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define EMR_POLYPOLYLINE16
Definition: wingdi.h:163
static void get_points_bounds(RECTL *bounds, const POINT *pts, UINT count, DC *dc)
Definition: graphics.c:75
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by EMFDRV_PolyPolygon(), and EMFDRV_PolyPolyline().

◆ EMFDRV_Rectangle()

BOOL EMFDRV_Rectangle ( PHYSDEV  dev,
INT  left,
INT  top,
INT  right,
INT  bottom 
)

Definition at line 447 of file graphics.c.

448 {
449  EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
450 #ifndef __REACTOS__
451  DC *dc = get_physdev_dc( dev );
452 #endif
453  EMRRECTANGLE emr;
454  INT temp;
455 
456  TRACE("%d,%d - %d,%d\n", left, top, right, bottom);
457 
458  if(left == right || top == bottom) return FALSE;
459 
460  if(left > right) {temp = left; left = right; right = temp;}
461  if(top > bottom) {temp = top; top = bottom; bottom = temp;}
462 #ifdef __REACTOS__
463  if(GetGraphicsMode(dev->hdc) == GM_COMPATIBLE) {
464 #else
465  if(dc->GraphicsMode == GM_COMPATIBLE) {
466 #endif
467  right--;
468  bottom--;
469  }
470 
471  emr.emr.iType = EMR_RECTANGLE;
472  emr.emr.nSize = sizeof(emr);
473  emr.rclBox.left = left;
474  emr.rclBox.top = top;
475  emr.rclBox.right = right;
476  emr.rclBox.bottom = bottom;
477 
478  if(!physDev->path)
479  EMFDRV_UpdateBBox( dev, &emr.rclBox );
480  return EMFDRV_WriteRecord( dev, &emr.emr );
481 }
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
static EMFDRV_PDEVICE * get_emf_physdev(PHYSDEV dev)
long bottom
Definition: polytest.cpp:53
HDC dc
Definition: cylfrac.c:34
int32_t INT
Definition: typedefs.h:56
long right
Definition: polytest.cpp:53
RECTL rclBox
Definition: wingdi.h:1851
long top
Definition: polytest.cpp:53
GLint GLint bottom
Definition: glext.h:7726
long left
Definition: polytest.cpp:53
#define EMR_RECTANGLE
Definition: wingdi.h:117
#define TRACE(s)
Definition: solgame.cpp:4
Definition: polytest.cpp:40
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect) DECLSPEC_HIDDEN
Definition: init.c:231
int WINAPI GetGraphicsMode(_In_ HDC)
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
#define GM_COMPATIBLE
Definition: wingdi.h:863
DWORD nSize
Definition: wingdi.h:1686
DWORD iType
Definition: wingdi.h:1685
static calc_node_t temp
Definition: rpn_ieee.c:38
WINEDC * get_physdev_dc(PHYSDEV dev)
Definition: rosglue.c:191
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859

◆ EMFDRV_RoundRect()

BOOL EMFDRV_RoundRect ( PHYSDEV  dev,
INT  left,
INT  top,
INT  right,
INT  bottom,
INT  ell_width,
INT  ell_height 
)

Definition at line 486 of file graphics.c.

488 {
489  EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
490 #ifndef __REACTOS__
491  DC *dc = get_physdev_dc( dev );
492 #endif
493  EMRROUNDRECT emr;
494  INT temp;
495 
496  if(left == right || top == bottom) return FALSE;
497 
498  if(left > right) {temp = left; left = right; right = temp;}
499  if(top > bottom) {temp = top; top = bottom; bottom = temp;}
500 #ifdef __REACTOS__
501  if(GetGraphicsMode(dev->hdc) == GM_COMPATIBLE) {
502 #else
503  if(dc->GraphicsMode == GM_COMPATIBLE) {
504 #endif
505  right--;
506  bottom--;
507  }
508 
509  emr.emr.iType = EMR_ROUNDRECT;
510  emr.emr.nSize = sizeof(emr);
511  emr.rclBox.left = left;
512  emr.rclBox.top = top;
513  emr.rclBox.right = right;
514  emr.rclBox.bottom = bottom;
515  emr.szlCorner.cx = ell_width;
516  emr.szlCorner.cy = ell_height;
517 
518  if(!physDev->path)
519  EMFDRV_UpdateBBox( dev, &emr.rclBox );
520  return EMFDRV_WriteRecord( dev, &emr.emr );
521 }
#define EMR_ROUNDRECT
Definition: wingdi.h:118
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
static EMFDRV_PDEVICE * get_emf_physdev(PHYSDEV dev)
long bottom
Definition: polytest.cpp:53
HDC dc
Definition: cylfrac.c:34
int32_t INT
Definition: typedefs.h:56
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
LONG cx
Definition: windef.h:319
GLint GLint bottom
Definition: glext.h:7726
long left
Definition: polytest.cpp:53
Definition: polytest.cpp:40
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect) DECLSPEC_HIDDEN
Definition: init.c:231
int WINAPI GetGraphicsMode(_In_ HDC)
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
#define GM_COMPATIBLE
Definition: wingdi.h:863
DWORD nSize
Definition: wingdi.h:1686
RECTL rclBox
Definition: wingdi.h:2150
DWORD iType
Definition: wingdi.h:1685
static calc_node_t temp
Definition: rpn_ieee.c:38
WINEDC * get_physdev_dc(PHYSDEV dev)
Definition: rosglue.c:191
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
LONG cy
Definition: windef.h:320
SIZEL szlCorner
Definition: wingdi.h:2151

◆ EMFDRV_SetPixel()

COLORREF EMFDRV_SetPixel ( PHYSDEV  dev,
INT  x,
INT  y,
COLORREF  color 
)

Definition at line 526 of file graphics.c.

527 {
528  EMRSETPIXELV emr;
529 
530  emr.emr.iType = EMR_SETPIXELV;
531  emr.emr.nSize = sizeof(emr);
532  emr.ptlPixel.x = x;
533  emr.ptlPixel.y = y;
534  emr.crColor = color;
535 
536  if (EMFDRV_WriteRecord( dev, &emr.emr )) {
537  RECTL bounds;
538  bounds.left = bounds.right = x;
539  bounds.top = bounds.bottom = y;
540  EMFDRV_UpdateBBox( dev, &bounds );
541  return color;
542  }
543  return -1;
544 }
COLORREF crColor
Definition: wingdi.h:2217
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
long bottom
Definition: polytest.cpp:53
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
POINTL ptlPixel
Definition: wingdi.h:2216
LONG y
Definition: windef.h:315
long right
Definition: polytest.cpp:53
GLuint color
Definition: glext.h:6243
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
#define EMR_SETPIXELV
Definition: wingdi.h:89
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect) DECLSPEC_HIDDEN
Definition: init.c:231
LONG x
Definition: windef.h:314
DWORD nSize
Definition: wingdi.h:1686
DWORD iType
Definition: wingdi.h:1685
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ emfdrv_stroke_and_fill_path()

static BOOL emfdrv_stroke_and_fill_path ( PHYSDEV  dev,
INT  type 
)
static

Definition at line 144 of file graphics.c.

145 {
146  DC *dc = get_physdev_dc( dev );
148  struct gdi_path *path;
149  POINT *points;
150  BYTE *flags;
151 
152  emr.emr.iType = type;
153  emr.emr.nSize = sizeof(emr);
154 
155  if ((path = get_gdi_flat_path( dc, NULL )))
156  {
157  int count = get_gdi_path_data( path, &points, &flags );
159  free_gdi_path( path );
160  }
161  else emr.rclBounds = empty_bounds;
162 
163  if (!EMFDRV_WriteRecord( dev, &emr.emr )) return FALSE;
164  if (!path) return FALSE;
166  return TRUE;
167 }
static const RECTL empty_bounds
Definition: graphics.c:36
#define TRUE
Definition: types.h:120
BOOL EMFDRV_WriteRecord(PHYSDEV dev, EMR *emr) DECLSPEC_HIDDEN
Definition: init.c:194
GLsizei const GLchar ** path
Definition: glext.h:7234
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
HDC dc
Definition: cylfrac.c:34
smooth NULL
Definition: ftsmooth.c:416
Definition: polytest.cpp:40
void EMFDRV_UpdateBBox(PHYSDEV dev, RECTL *rect) DECLSPEC_HIDDEN
Definition: init.c:231
GLbitfield flags
Definition: glext.h:7161
GLsizei const GLfloat * points
Definition: glext.h:8112
DWORD nSize
Definition: wingdi.h:1686
unsigned char BYTE
Definition: mem.h:68
DWORD iType
Definition: wingdi.h:1685
WINEDC * get_physdev_dc(PHYSDEV dev)
Definition: rosglue.c:191
Definition: services.c:325
RECTL rclBounds
Definition: wingdi.h:1984
static void get_points_bounds(RECTL *bounds, const POINT *pts, UINT count, DC *dc)
Definition: graphics.c:75

Referenced by EMFDRV_FillPath(), EMFDRV_StrokeAndFillPath(), and EMFDRV_StrokePath().

◆ EMFDRV_StrokeAndFillPath()

BOOL EMFDRV_StrokeAndFillPath ( PHYSDEV  dev)

Definition at line 1095 of file graphics.c.

1096 {
1098 }
#define EMR_STROKEANDFILLPATH
Definition: wingdi.h:137
static BOOL emfdrv_stroke_and_fill_path(PHYSDEV dev, INT type)
Definition: graphics.c:144

◆ EMFDRV_StrokePath()

BOOL EMFDRV_StrokePath ( PHYSDEV  dev)

Definition at line 1103 of file graphics.c.

1104 {
1106 }
#define EMR_STROKEPATH
Definition: wingdi.h:138
static BOOL emfdrv_stroke_and_fill_path(PHYSDEV dev, INT type)
Definition: graphics.c:144

◆ get_points_bounds()

static void get_points_bounds ( RECTL bounds,
const POINT pts,
UINT  count,
DC dc 
)
static

Definition at line 75 of file graphics.c.

77 {
78  UINT i;
79 #ifdef __REACTOS__
80  if (hdc)
81  {
82  POINT cur_pt;
83  GetCurrentPositionEx( hdc, &cur_pt );
84  bounds->left = bounds->right = cur_pt.x;
85  bounds->top = bounds->bottom = cur_pt.y;
86  }
87 #else
88  if (dc)
89  {
90  bounds->left = bounds->right = dc->cur_pos.x;
91  bounds->top = bounds->bottom = dc->cur_pos.y;
92  }
93 #endif
94  else if (count)
95  {
96  bounds->left = bounds->right = pts[0].x;
97  bounds->top = bounds->bottom = pts[0].y;
98  }
99  else *bounds = empty_bounds;
100 
101  for (i = 0; i < count; i++)
102  {
103  bounds->left = min( bounds->left, pts[i].x );
104  bounds->right = max( bounds->right, pts[i].x );
105  bounds->top = min( bounds->top, pts[i].y );
106  bounds->bottom = max( bounds->bottom, pts[i].y );
107  }
108 }
static const RECTL empty_bounds
Definition: graphics.c:36
BOOL WINAPI GetCurrentPositionEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:241
#define max(a, b)
Definition: svc.c:63
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
GLuint GLuint GLsizei count
Definition: gl.h:1545
long bottom
Definition: polytest.cpp:53
HDC dc
Definition: cylfrac.c:34
long right
Definition: polytest.cpp:53
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
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
HDC hdc
Definition: main.c:9
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50

Referenced by EMFDRV_PolyDraw(), EMFDRV_Polylinegon(), EMFDRV_PolyPolylinegon(), and emfdrv_stroke_and_fill_path().

◆ store_points()

static void* store_points ( POINTL dest,
const POINT pts,
UINT  count,
BOOL  short_points 
)
static

Definition at line 50 of file graphics.c.

51 {
52  if (short_points)
53  {
54  UINT i;
55  POINTS *dest_short = (POINTS *)dest;
56 
57  for (i = 0; i < count; i++)
58  {
59  dest_short[i].x = pts[i].x;
60  dest_short[i].y = pts[i].y;
61  }
62  return dest_short + count;
63  }
64  else
65  {
66  memcpy( dest, pts, count * sizeof(*dest) );
67  return dest + count;
68  }
69 }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
SHORT x
Definition: windef.h:327
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
SHORT y
Definition: windef.h:328
unsigned int UINT
Definition: ndis.h:50
static char * dest
Definition: rtl.c:135

Referenced by EMFDRV_PolyDraw(), EMFDRV_Polylinegon(), and EMFDRV_PolyPolylinegon().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( enhmetafile  )

Variable Documentation

◆ empty_bounds

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