ReactOS  0.4.15-dev-5131-g311fcc6
path.c File Reference
#include <win32k.h>
#include <suppress.h>
Include dependency graph for path.c:

Go to the source code of this file.

Macros

#define NUM_ENTRIES_INITIAL   16 /* Initial size of points / flags arrays */
 
#define GROW_FACTOR_NUMER   2 /* Numerator of grow factor for the array */
 
#define GROW_FACTOR_DENOM   1 /* Denominator of grow factor */
 
#define round(x)   ((int)((x)>0?(x)+0.5:(x)-0.5))
 

Functions

 DBG_DEFAULT_CHANNEL (GdiPath)
 
PPATH FASTCALL PATH_CreatePath (int count)
 
VOID FASTCALL PATH_DestroyGdiPath (PPATH pPath)
 
BOOL FASTCALL PATH_Delete (HPATH hPath)
 
VOID FASTCALL IntGdiCloseFigure (PPATH pPath)
 
BOOL FASTCALL GdiPathDPtoLP (PDC pdc, PPOINT ppt, INT count)
 
VOID FASTCALL PATH_InitGdiPath (PPATH pPath)
 
BOOL FASTCALL PATH_AssignGdiPath (PPATH pPathDest, const PPATH pPathSrc)
 
BOOL PATH_SavePath (DC *dst, DC *src)
 
BOOL PATH_RestorePath (DC *dst, DC *src)
 
VOID FASTCALL PATH_EmptyPath (PPATH pPath)
 
BOOL FASTCALL PATH_AddEntry (PPATH pPath, const POINT *pPoint, BYTE flags)
 
BOOL FASTCALL PATH_ReserveEntries (PPATH pPath, INT numEntries)
 
static BOOLEAN PATH_ScaleNormalizedPoint (POINT corners[], FLOATL x, FLOATL y, POINT *pPoint)
 
static VOID PATH_NormalizePoint (POINTL corners[], const POINTL *pPoint, FLOATL *pX, FLOATL *pY)
 
static BOOL PATH_CheckRect (DC *dc, RECTL *rect, INT x1, INT y1, INT x2, INT y2)
 
static BYTEadd_log_points (DC *dc, PPATH path, const POINT *points, DWORD count, BYTE type)
 
static BYTEadd_points (PPATH path, const POINT *points, DWORD count, BYTE type)
 
static void reverse_points (POINT *points, UINT count)
 
static BOOL start_new_stroke (PPATH path)
 
static void update_current_pos (PPATH path)
 
static void close_figure (PPATH path)
 
static BOOL add_log_points_new_stroke (DC *dc, PPATH path, const POINT *points, DWORD count, BYTE type)
 
BOOL FASTCALL PATH_MoveTo (PDC dc, PPATH pPath)
 
BOOL FASTCALL PATH_LineTo (PDC dc, INT x, INT y)
 
BOOL FASTCALL PATH_Rectangle (PDC dc, INT x1, INT y1, INT x2, INT y2)
 
BOOL PATH_RoundRect (DC *dc, INT x1, INT y1, INT x2, INT y2, INT ell_width, INT ell_height)
 
BOOL PATH_Ellipse (PDC dc, INT x1, INT y1, INT x2, INT y2)
 
static BOOL PATH_DoArcPart (PPATH pPath, POINT corners[], double angleStart, double angleEnd, BYTE startEntryType)
 
BOOL FASTCALL PATH_Arc (PDC dc, INT x1, INT y1, INT x2, INT y2, INT xStart, INT yStart, INT xEnd, INT yEnd, INT direction, INT lines)
 
BOOL FASTCALL PATH_PolyBezierTo (PDC dc, const POINT *pts, DWORD cbPoints)
 
BOOL FASTCALL PATH_PolyBezier (PDC dc, const POINT *pts, DWORD cbPoints)
 
BOOL FASTCALL PATH_PolyDraw (PDC dc, const POINT *pts, const BYTE *types, DWORD cbPoints)
 
BOOL FASTCALL PATH_PolylineTo (PDC dc, const POINT *pts, DWORD cbPoints)
 
BOOL FASTCALL PATH_PolyPolygon (PDC dc, const POINT *pts, const INT *counts, UINT polygons)
 
BOOL FASTCALL PATH_PolyPolyline (PDC dc, const POINT *pts, const DWORD *counts, DWORD polylines)
 
BOOL FASTCALL PATH_AddFlatBezier (PPATH pPath, POINT *pt, BOOL closed)
 
PPATH FASTCALL PATH_FlattenPath (PPATH pPath)
 
BOOL FASTCALL PATH_PathToRegion (PPATH pPath, INT Mode, PREGION Rgn)
 
BOOL FASTCALL PATH_FillPath (PDC dc, PPATH pPath)
 
BOOL FASTCALL PATH_FillPathEx (PDC dc, PPATH pPath, PBRUSH pbrFill)
 
BOOL FASTCALL PATH_StrokePath (DC *dc, PPATH pPath)
 
PPATH FASTCALL IntGdiWidenPath (PPATH pPath, UINT penWidth, UINT penStyle, FLOAT eMiterLimit)
 
static PPATH FASTCALL PATH_WidenPath (DC *dc)
 
PPATH FASTCALL PATH_WidenPathEx (DC *dc, PPATH pPath)
 
static INT int_from_fixed (FIXED f)
 
static VOID FASTCALL PATH_BezierTo (PPATH pPath, POINT *lppt, INT n)
 
static BOOL FASTCALL PATH_add_outline (PDC dc, PPATH pPath, INT x, INT y, TTPOLYGONHEADER *header, DWORD size)
 
BOOL FASTCALL PATH_ExtTextOut (PDC dc, INT x, INT y, UINT flags, const RECTL *lprc, LPCWSTR str, UINT count, const INT *dx)
 
BOOL APIENTRY NtGdiAbortPath (HDC hDC)
 
BOOL APIENTRY NtGdiBeginPath (HDC hDC)
 
BOOL APIENTRY NtGdiCloseFigure (HDC hDC)
 
BOOL APIENTRY NtGdiEndPath (HDC hDC)
 
BOOL APIENTRY NtGdiFillPath (HDC hDC)
 
BOOL APIENTRY NtGdiFlattenPath (HDC hDC)
 
 _Success_ (return !=FALSE)
 
INT APIENTRY NtGdiGetPath (HDC hDC, LPPOINT Points, LPBYTE Types, INT nSize)
 
HRGN APIENTRY NtGdiPathToRegion (HDC hDC)
 
BOOL APIENTRY NtGdiSetMiterLimit (IN HDC hdc, IN DWORD dwNew, IN OUT OPTIONAL PDWORD pdwOut)
 
BOOL APIENTRY NtGdiStrokeAndFillPath (HDC hDC)
 
BOOL APIENTRY NtGdiStrokePath (HDC hDC)
 
BOOL APIENTRY NtGdiWidenPath (HDC hDC)
 

Macro Definition Documentation

◆ GROW_FACTOR_DENOM

#define GROW_FACTOR_DENOM   1 /* Denominator of grow factor */

Definition at line 24 of file path.c.

◆ GROW_FACTOR_NUMER

#define GROW_FACTOR_NUMER   2 /* Numerator of grow factor for the array */

Definition at line 23 of file path.c.

◆ NUM_ENTRIES_INITIAL

#define NUM_ENTRIES_INITIAL   16 /* Initial size of points / flags arrays */

Definition at line 21 of file path.c.

◆ round

#define round (   x)    ((int)((x)>0?(x)+0.5:(x)-0.5))

Definition at line 1787 of file path.c.

Function Documentation

◆ _Success_()

_Success_ ( return = FALSE)

Definition at line 2727 of file path.c.

2733 {
2734  DC *pDc;
2735  BOOL bResult = TRUE;
2736 
2737  if (!(pDc = DC_LockDc(hdc)))
2738  {
2740  return FALSE;
2741  }
2742 
2743  _SEH2_TRY
2744  {
2745  ProbeForWrite(pdwOut, sizeof(DWORD), 1);
2746  *pdwOut = pDc->dclevel.laPath.eMiterLimit;
2747  }
2749  {
2751  bResult = FALSE;
2752  }
2753  _SEH2_END;
2754 
2755  DC_UnlockDc(pDc);
2756  return bResult;
2757 
2758 }
_SEH2_TRY
Definition: create.c:4226
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:217
#define TRUE
Definition: types.h:120
_SEH2_END
Definition: create.c:4400
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: polytest.cpp:40
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:37
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:235
_Out_ PDWORD pdwOut
Definition: ntgdi.h:1813
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

◆ add_log_points()

static BYTE* add_log_points ( DC dc,
PPATH  path,
const POINT points,
DWORD  count,
BYTE  type 
)
static

Definition at line 463 of file path.c.

465 {
466  BYTE *ret;
467 
468  if (!PATH_ReserveEntries( path, path->numEntriesUsed + count )) return NULL;
469 
470  ret = &path->pFlags[path->numEntriesUsed];
471  memcpy( &path->pPoints[path->numEntriesUsed], points, count * sizeof(*points) );
472  IntLPtoDP( dc, &path->pPoints[path->numEntriesUsed], count );
473  memset( ret, type, count );
474  path->numEntriesUsed += count;
475  return ret;
476 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
DWORD ret
Definition: path.c:47
GLsizei const GLfloat * points
Definition: glext.h:8112
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: xxhash.c:193
#define NULL
Definition: types.h:112
BOOL FASTCALL PATH_ReserveEntries(PPATH pPath, INT numEntries)
Definition: path.c:296
static const WCHAR dc[]
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define memset(x, y, z)
Definition: compat.h:39
static BOOLEAN IntLPtoDP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:182

Referenced by add_log_points_new_stroke(), PATH_PolyBezier(), and PATH_PolyPolygon().

◆ add_log_points_new_stroke()

static BOOL add_log_points_new_stroke ( DC dc,
PPATH  path,
const POINT points,
DWORD  count,
BYTE  type 
)
static

Definition at line 533 of file path.c.

535 {
536  if (!start_new_stroke( path )) return FALSE;
537  if (!add_log_points( dc, path, points, count, type )) return FALSE;
539 
540  TRACE("ALPNS : Pos X %d Y %d\n",path->pos.x, path->pos.y);
541  IntGdiMoveToEx(dc, path->pos.x, path->pos.y, NULL);
542 
543  return TRUE;
544 }
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FALSE
Definition: types.h:117
static void update_current_pos(PPATH path)
Definition: path.c:519
#define TRACE(s)
Definition: solgame.cpp:4
GLsizei const GLfloat * points
Definition: glext.h:8112
static BOOL start_new_stroke(PPATH path)
Definition: path.c:506
#define NULL
Definition: types.h:112
BOOL FASTCALL IntGdiMoveToEx(DC *dc, int X, int Y, LPPOINT Point)
Definition: line.c:78
static const WCHAR dc[]
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static BYTE * add_log_points(DC *dc, PPATH path, const POINT *points, DWORD count, BYTE type)
Definition: path.c:463

Referenced by PATH_LineTo(), PATH_PolyBezierTo(), PATH_PolyDraw(), and PATH_PolylineTo().

◆ add_points()

static BYTE* add_points ( PPATH  path,
const POINT points,
DWORD  count,
BYTE  type 
)
static

Definition at line 480 of file path.c.

481 {
482  BYTE *ret;
483 
484  if (!PATH_ReserveEntries( path, path->numEntriesUsed + count )) return NULL;
485 
486  ret = &path->pFlags[path->numEntriesUsed];
487  memcpy( &path->pPoints[path->numEntriesUsed], points, count * sizeof(*points) );
488  memset( ret, type, count );
489  path->numEntriesUsed += count;
490  return ret;
491 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
DWORD ret
Definition: path.c:47
GLsizei const GLfloat * points
Definition: glext.h:8112
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: xxhash.c:193
#define NULL
Definition: types.h:112
BOOL FASTCALL PATH_ReserveEntries(PPATH pPath, INT numEntries)
Definition: path.c:296
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define memset(x, y, z)
Definition: compat.h:39

Referenced by IntGdiWidenPath(), PATH_BezierTo(), PATH_DoArcPart(), PATH_Ellipse(), PATH_Rectangle(), PATH_RoundRect(), and start_new_stroke().

◆ close_figure()

static void close_figure ( PPATH  path)
static

Definition at line 526 of file path.c.

527 {
528  ASSERT(path->numEntriesUsed);
529  path->pFlags[path->numEntriesUsed - 1] |= PT_CLOSEFIGURE;
530 }
#define ASSERT(a)
Definition: mode.c:44
#define PT_CLOSEFIGURE
Definition: wingdi.h:887

Referenced by PATH_PolyDraw().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( GdiPath  )

◆ GdiPathDPtoLP()

BOOL FASTCALL GdiPathDPtoLP ( PDC  pdc,
PPOINT  ppt,
INT  count 
)

Definition at line 125 of file path.c.

129 {
130  XFORMOBJ xo;
131 
132  XFORMOBJ_vInit(&xo, &pdc->pdcattr->mxDeviceToWorld);
133  return XFORMOBJ_bApplyXform(&xo, XF_LTOL, count, (PPOINTL)ppt, (PPOINTL)ppt);
134 }
#define XFORMOBJ_bApplyXform
Definition: xformobj.h:11
GLuint GLuint GLsizei count
Definition: gl.h:1545
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
#define XF_LTOL
Definition: winddi.h:3109

Referenced by NtGdiGetPath().

◆ int_from_fixed()

static INT int_from_fixed ( FIXED  f)
inlinestatic

Definition at line 2202 of file path.c.

2203 {
2204  return (f.fract >= 0x8000) ? (f.value + 1) : f.value;
2205 }
GLfloat f
Definition: glext.h:7540

Referenced by PATH_add_outline().

◆ IntGdiCloseFigure()

VOID FASTCALL IntGdiCloseFigure ( PPATH  pPath)

Definition at line 108 of file path.c.

109 {
110  ASSERT(pPath->state == PATH_Open);
111 
112  // FIXME: Shouldn't we draw a line to the beginning of the figure?
113  // Set PT_CLOSEFIGURE on the last entry and start a new stroke
114  if (pPath->numEntriesUsed)
115  {
116  pPath->pFlags[pPath->numEntriesUsed - 1] |= PT_CLOSEFIGURE;
117  pPath->newStroke = TRUE;
118  }
119 }
#define TRUE
Definition: types.h:120
int numEntriesUsed
Definition: path.h:55
BYTE * pFlags
Definition: path.h:54
#define ASSERT(a)
Definition: mode.c:44
Definition: path.h:19
BOOL newStroke
Definition: path.h:57
#define PT_CLOSEFIGURE
Definition: wingdi.h:887
FLONG state
Definition: path.h:52

Referenced by NtGdiCloseFigure(), PATH_add_outline(), PATH_Arc(), PATH_Ellipse(), PATH_Rectangle(), and PATH_RoundRect().

◆ IntGdiWidenPath()

PPATH FASTCALL IntGdiWidenPath ( PPATH  pPath,
UINT  penWidth,
UINT  penStyle,
FLOAT  eMiterLimit 
)

Definition at line 1790 of file path.c.

1791 {
1792  INT i, j, numStrokes, numOldStrokes, penWidthIn, penWidthOut;
1793  PPATH flat_path, pNewPath, *pStrokes = NULL, *pOldStrokes, pUpPath, pDownPath;
1794  BYTE *type;
1795  DWORD joint, endcap;
1796 
1797  endcap = (PS_ENDCAP_MASK & penStyle);
1798  joint = (PS_JOIN_MASK & penStyle);
1799 
1800  if (!(flat_path = PATH_FlattenPath(pPath)))
1801  {
1802  ERR("PATH_FlattenPath\n");
1803  return NULL;
1804  }
1805 
1806  penWidthIn = penWidth / 2;
1807  penWidthOut = penWidth / 2;
1808  if (penWidthIn + penWidthOut < penWidth)
1809  penWidthOut++;
1810 
1811  numStrokes = 0;
1812 
1813  for (i = 0, j = 0; i < flat_path->numEntriesUsed; i++, j++)
1814  {
1815  POINT point;
1816  if ((i == 0 || (flat_path->pFlags[i - 1] & PT_CLOSEFIGURE)) &&
1817  (flat_path->pFlags[i] != PT_MOVETO))
1818  {
1819  ERR("Expected PT_MOVETO %s, got path flag %c\n",
1820  i == 0 ? "as first point" : "after PT_CLOSEFIGURE",
1821  flat_path->pFlags[i]);
1822  if (pStrokes)
1823  ExFreePoolWithTag(pStrokes, TAG_PATH);
1824  PATH_UnlockPath(flat_path);
1825  PATH_Delete(flat_path->BaseObject.hHmgr);
1826  return NULL;
1827  }
1828  switch(flat_path->pFlags[i])
1829  {
1830  case PT_MOVETO:
1831  if (numStrokes > 0)
1832  {
1833  pStrokes[numStrokes - 1]->state = PATH_Closed;
1834  }
1835  numOldStrokes = numStrokes;
1836  numStrokes++;
1837  j = 0;
1838  if (numStrokes == 1)
1839  pStrokes = ExAllocatePoolWithTag(PagedPool, sizeof(*pStrokes), TAG_PATH);
1840  else
1841  {
1842  pOldStrokes = pStrokes; // Save old pointer.
1843  pStrokes = ExAllocatePoolWithTag(PagedPool, numStrokes * sizeof(*pStrokes), TAG_PATH);
1844  if (!pStrokes)
1845  {
1846  ExFreePoolWithTag(pOldStrokes, TAG_PATH);
1847  PATH_UnlockPath(flat_path);
1848  PATH_Delete(flat_path->BaseObject.hHmgr);
1849  return NULL;
1850  }
1851  RtlCopyMemory(pStrokes, pOldStrokes, numOldStrokes * sizeof(PPATH));
1852  ExFreePoolWithTag(pOldStrokes, TAG_PATH); // Free old pointer.
1853  }
1854  if (!pStrokes)
1855  {
1856  PATH_UnlockPath(flat_path);
1857  PATH_Delete(flat_path->BaseObject.hHmgr);
1858  return NULL;
1859  }
1860  pStrokes[numStrokes - 1] = ExAllocatePoolWithTag(PagedPool, sizeof(PATH), TAG_PATH);
1861  if (!pStrokes[numStrokes - 1])
1862  {
1863  ASSERT(FALSE); // FIXME
1864  }
1865  PATH_InitGdiPath(pStrokes[numStrokes - 1]);
1866  pStrokes[numStrokes - 1]->state = PATH_Open;
1867  case PT_LINETO:
1868  case (PT_LINETO | PT_CLOSEFIGURE):
1869  point.x = flat_path->pPoints[i].x;
1870  point.y = flat_path->pPoints[i].y;
1871  PATH_AddEntry(pStrokes[numStrokes - 1], &point, flat_path->pFlags[i]);
1872  break;
1873  case PT_BEZIERTO:
1874  /* Should never happen because of the FlattenPath call */
1875  ERR("Should never happen\n");
1876  break;
1877  default:
1878  ERR("Got path flag %c\n", flat_path->pFlags[i]);
1879  if (pStrokes)
1880  ExFreePoolWithTag(pStrokes, TAG_PATH);
1881  PATH_UnlockPath(flat_path);
1882  PATH_Delete(flat_path->BaseObject.hHmgr);
1883  return NULL;
1884  }
1885  }
1886 
1887  pNewPath = PATH_CreatePath( flat_path->numEntriesUsed );
1888 
1889  for (i = 0; i < numStrokes; i++)
1890  {
1891  pUpPath = ExAllocatePoolWithTag(PagedPool, sizeof(PATH), TAG_PATH);
1892  PATH_InitGdiPath(pUpPath);
1893  pUpPath->state = PATH_Open;
1894  pDownPath = ExAllocatePoolWithTag(PagedPool, sizeof(PATH), TAG_PATH);
1895  PATH_InitGdiPath(pDownPath);
1896  pDownPath->state = PATH_Open;
1897 
1898  for (j = 0; j < pStrokes[i]->numEntriesUsed; j++)
1899  {
1900  /* Beginning or end of the path if not closed */
1901  if ((!(pStrokes[i]->pFlags[pStrokes[i]->numEntriesUsed - 1] & PT_CLOSEFIGURE)) && (j == 0 || j == pStrokes[i]->numEntriesUsed - 1))
1902  {
1903  /* Compute segment angle */
1904  INT xo, yo, xa, ya;
1905  double theta;
1906  POINT pt;
1907  POINT corners[2];
1908  if (j == 0)
1909  {
1910  xo = pStrokes[i]->pPoints[j].x;
1911  yo = pStrokes[i]->pPoints[j].y;
1912  xa = pStrokes[i]->pPoints[1].x;
1913  ya = pStrokes[i]->pPoints[1].y;
1914  }
1915  else
1916  {
1917  xa = pStrokes[i]->pPoints[j - 1].x;
1918  ya = pStrokes[i]->pPoints[j - 1].y;
1919  xo = pStrokes[i]->pPoints[j].x;
1920  yo = pStrokes[i]->pPoints[j].y;
1921  }
1922  theta = atan2(ya - yo, xa - xo);
1923  switch(endcap)
1924  {
1925  case PS_ENDCAP_SQUARE :
1926  pt.x = xo + round(sqrt(2) * penWidthOut * cos(M_PI_4 + theta));
1927  pt.y = yo + round(sqrt(2) * penWidthOut * sin(M_PI_4 + theta));
1928  PATH_AddEntry(pUpPath, &pt, (j == 0 ? PT_MOVETO : PT_LINETO));
1929  pt.x = xo + round(sqrt(2) * penWidthIn * cos(- M_PI_4 + theta));
1930  pt.y = yo + round(sqrt(2) * penWidthIn * sin(- M_PI_4 + theta));
1931  PATH_AddEntry(pUpPath, &pt, PT_LINETO);
1932  break;
1933  case PS_ENDCAP_FLAT :
1934  pt.x = xo + round(penWidthOut * cos(theta + M_PI_2));
1935  pt.y = yo + round(penWidthOut * sin(theta + M_PI_2));
1936  PATH_AddEntry(pUpPath, &pt, (j == 0 ? PT_MOVETO : PT_LINETO));
1937  pt.x = xo - round(penWidthIn * cos(theta + M_PI_2));
1938  pt.y = yo - round(penWidthIn * sin(theta + M_PI_2));
1939  PATH_AddEntry(pUpPath, &pt, PT_LINETO);
1940  break;
1941  case PS_ENDCAP_ROUND :
1942  default :
1943  corners[0].x = xo - penWidthIn;
1944  corners[0].y = yo - penWidthIn;
1945  corners[1].x = xo + penWidthOut;
1946  corners[1].y = yo + penWidthOut;
1947  PATH_DoArcPart(pUpPath , corners, theta + M_PI_2 , theta + 3 * M_PI_4, (j == 0 ? PT_MOVETO : FALSE));
1948  PATH_DoArcPart(pUpPath , corners, theta + 3 * M_PI_4 , theta + M_PI, FALSE);
1949  PATH_DoArcPart(pUpPath , corners, theta + M_PI, theta + 5 * M_PI_4, FALSE);
1950  PATH_DoArcPart(pUpPath , corners, theta + 5 * M_PI_4 , theta + 3 * M_PI_2, FALSE);
1951  break;
1952  }
1953  }
1954  /* Corpse of the path */
1955  else
1956  {
1957  /* Compute angle */
1958  INT previous, next;
1959  double xa, ya, xb, yb, xo, yo;
1960  double alpha, theta, miterWidth;
1961  DWORD _joint = joint;
1962  POINT pt;
1963  PPATH pInsidePath, pOutsidePath;
1964  if (j > 0 && j < pStrokes[i]->numEntriesUsed - 1)
1965  {
1966  previous = j - 1;
1967  next = j + 1;
1968  }
1969  else if (j == 0)
1970  {
1971  previous = pStrokes[i]->numEntriesUsed - 1;
1972  next = j + 1;
1973  }
1974  else
1975  {
1976  previous = j - 1;
1977  next = 0;
1978  }
1979  xo = pStrokes[i]->pPoints[j].x;
1980  yo = pStrokes[i]->pPoints[j].y;
1981  xa = pStrokes[i]->pPoints[previous].x;
1982  ya = pStrokes[i]->pPoints[previous].y;
1983  xb = pStrokes[i]->pPoints[next].x;
1984  yb = pStrokes[i]->pPoints[next].y;
1985  theta = atan2(yo - ya, xo - xa);
1986  alpha = atan2(yb - yo, xb - xo) - theta;
1987  if (alpha > 0) alpha -= M_PI;
1988  else alpha += M_PI;
1989  if (_joint == PS_JOIN_MITER && eMiterLimit < fabs(1 / sin(alpha / 2)))
1990  {
1991  _joint = PS_JOIN_BEVEL;
1992  }
1993  if (alpha > 0)
1994  {
1995  pInsidePath = pUpPath;
1996  pOutsidePath = pDownPath;
1997  }
1998  else if (alpha < 0)
1999  {
2000  pInsidePath = pDownPath;
2001  pOutsidePath = pUpPath;
2002  }
2003  else
2004  {
2005  continue;
2006  }
2007  /* Inside angle points */
2008  if (alpha > 0)
2009  {
2010  pt.x = xo - round(penWidthIn * cos(theta + M_PI_2));
2011  pt.y = yo - round(penWidthIn * sin(theta + M_PI_2));
2012  }
2013  else
2014  {
2015  pt.x = xo + round(penWidthIn * cos(theta + M_PI_2));
2016  pt.y = yo + round(penWidthIn * sin(theta + M_PI_2));
2017  }
2018  PATH_AddEntry(pInsidePath, &pt, PT_LINETO);
2019  if (alpha > 0)
2020  {
2021  pt.x = xo + round(penWidthIn * cos(M_PI_2 + alpha + theta));
2022  pt.y = yo + round(penWidthIn * sin(M_PI_2 + alpha + theta));
2023  }
2024  else
2025  {
2026  pt.x = xo - round(penWidthIn * cos(M_PI_2 + alpha + theta));
2027  pt.y = yo - round(penWidthIn * sin(M_PI_2 + alpha + theta));
2028  }
2029  PATH_AddEntry(pInsidePath, &pt, PT_LINETO);
2030  /* Outside angle point */
2031  switch(_joint)
2032  {
2033  case PS_JOIN_MITER :
2034  miterWidth = fabs(penWidthOut / cos(M_PI_2 - fabs(alpha) / 2));
2035  pt.x = xo + round(miterWidth * cos(theta + alpha / 2));
2036  pt.y = yo + round(miterWidth * sin(theta + alpha / 2));
2037  PATH_AddEntry(pOutsidePath, &pt, PT_LINETO);
2038  break;
2039  case PS_JOIN_BEVEL :
2040  if (alpha > 0)
2041  {
2042  pt.x = xo + round(penWidthOut * cos(theta + M_PI_2));
2043  pt.y = yo + round(penWidthOut * sin(theta + M_PI_2));
2044  }
2045  else
2046  {
2047  pt.x = xo - round(penWidthOut * cos(theta + M_PI_2));
2048  pt.y = yo - round(penWidthOut * sin(theta + M_PI_2));
2049  }
2050  PATH_AddEntry(pOutsidePath, &pt, PT_LINETO);
2051  if (alpha > 0)
2052  {
2053  pt.x = xo - round(penWidthOut * cos(M_PI_2 + alpha + theta));
2054  pt.y = yo - round(penWidthOut * sin(M_PI_2 + alpha + theta));
2055  }
2056  else
2057  {
2058  pt.x = xo + round(penWidthOut * cos(M_PI_2 + alpha + theta));
2059  pt.y = yo + round(penWidthOut * sin(M_PI_2 + alpha + theta));
2060  }
2061  PATH_AddEntry(pOutsidePath, &pt, PT_LINETO);
2062  break;
2063  case PS_JOIN_ROUND :
2064  default :
2065  if (alpha > 0)
2066  {
2067  pt.x = xo + round(penWidthOut * cos(theta + M_PI_2));
2068  pt.y = yo + round(penWidthOut * sin(theta + M_PI_2));
2069  }
2070  else
2071  {
2072  pt.x = xo - round(penWidthOut * cos(theta + M_PI_2));
2073  pt.y = yo - round(penWidthOut * sin(theta + M_PI_2));
2074  }
2075  PATH_AddEntry(pOutsidePath, &pt, PT_BEZIERTO);
2076  pt.x = xo + round(penWidthOut * cos(theta + alpha / 2));
2077  pt.y = yo + round(penWidthOut * sin(theta + alpha / 2));
2078  PATH_AddEntry(pOutsidePath, &pt, PT_BEZIERTO);
2079  if (alpha > 0)
2080  {
2081  pt.x = xo - round(penWidthOut * cos(M_PI_2 + alpha + theta));
2082  pt.y = yo - round(penWidthOut * sin(M_PI_2 + alpha + theta));
2083  }
2084  else
2085  {
2086  pt.x = xo + round(penWidthOut * cos(M_PI_2 + alpha + theta));
2087  pt.y = yo + round(penWidthOut * sin(M_PI_2 + alpha + theta));
2088  }
2089  PATH_AddEntry(pOutsidePath, &pt, PT_BEZIERTO);
2090  break;
2091  }
2092  }
2093  }
2094  type = add_points( pNewPath, pUpPath->pPoints, pUpPath->numEntriesUsed, PT_LINETO );
2095  type[0] = PT_MOVETO;
2096  reverse_points( pDownPath->pPoints, pDownPath->numEntriesUsed );
2097  type = add_points( pNewPath, pDownPath->pPoints, pDownPath->numEntriesUsed, PT_LINETO );
2098  if (pStrokes[i]->pFlags[pStrokes[i]->numEntriesUsed - 1] & PT_CLOSEFIGURE) type[0] = PT_MOVETO;
2099 
2100  PATH_DestroyGdiPath(pStrokes[i]);
2101  ExFreePoolWithTag(pStrokes[i], TAG_PATH);
2102  PATH_DestroyGdiPath(pUpPath);
2103  ExFreePoolWithTag(pUpPath, TAG_PATH);
2104  PATH_DestroyGdiPath(pDownPath);
2105  ExFreePoolWithTag(pDownPath, TAG_PATH);
2106  }
2107  if (pStrokes) ExFreePoolWithTag(pStrokes, TAG_PATH);
2108 
2109  PATH_UnlockPath(flat_path);
2110  PATH_Delete(flat_path->BaseObject.hHmgr);
2111  pNewPath->state = PATH_Closed;
2112  PATH_UnlockPath(pNewPath);
2113  return pNewPath;
2114 }
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
Definition: complex.cpp:188
#define M_PI_4
Definition: port.h:153
BOOL FASTCALL PATH_AddEntry(PPATH pPath, const POINT *pPoint, BYTE flags)
Definition: path.c:262
#define PS_ENDCAP_SQUARE
Definition: wingdi.h:595
valarray< _Tp > atan2(const valarray< _Tp > &__x, const valarray< _Tp > &__y)
Definition: _valarray.h:928
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define pt(x, y)
Definition: drawing.c:79
PPATH FASTCALL PATH_CreatePath(int count)
Definition: path.c:35
Definition: path.h:34
#define round(x)
Definition: path.c:1787
#define PS_JOIN_BEVEL
Definition: wingdi.h:597
static void reverse_points(POINT *points, UINT count)
Definition: path.c:494
#define PS_JOIN_MITER
Definition: wingdi.h:598
int32_t INT
Definition: typedefs.h:58
POINTL point
Definition: edittest.c:50
LONG y
Definition: windef.h:330
#define FALSE
Definition: types.h:117
PPATH FASTCALL PATH_FlattenPath(PPATH pPath)
Definition: path.c:1407
#define TAG_PATH
Definition: tags.h:25
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
POINT * pPoints
Definition: path.h:53
#define PATH_UnlockPath(pPath)
Definition: path.h:71
int numEntriesUsed
Definition: path.h:55
#define PS_ENDCAP_ROUND
Definition: wingdi.h:594
static BYTE * add_points(PPATH path, const POINT *points, DWORD count, BYTE type)
Definition: path.c:480
BYTE * pFlags
Definition: path.h:54
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 GLint GLint j
Definition: glfuncs.h:250
#define ASSERT(a)
Definition: mode.c:44
VOID FASTCALL PATH_DestroyGdiPath(PPATH pPath)
Definition: path.c:80
#define PS_JOIN_ROUND
Definition: wingdi.h:599
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG x
Definition: windef.h:329
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define M_PI
Definition: dib.cpp:249
#define M_PI_2
Definition: port.h:185
unsigned char BYTE
Definition: xxhash.c:193
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
Definition: fabs.c:17
#define ERR(fmt,...)
Definition: debug.h:110
static unsigned __int64 next
Definition: rand_nt.c:6
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
Definition: path.h:19
#define PS_ENDCAP_FLAT
Definition: wingdi.h:596
#define PS_ENDCAP_MASK
Definition: wingdi.h:602
#define PS_JOIN_MASK
Definition: wingdi.h:600
#define NULL
Definition: types.h:112
VOID FASTCALL PATH_InitGdiPath(PPATH pPath)
Definition: path.c:142
#define PT_CLOSEFIGURE
Definition: wingdi.h:887
#define PT_LINETO
Definition: wingdi.h:885
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
#define PT_MOVETO
Definition: wingdi.h:884
BASEOBJECT BaseObject
Definition: path.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
FLONG state
Definition: path.h:52
static BOOL PATH_DoArcPart(PPATH pPath, POINT corners[], double angleStart, double angleEnd, BYTE startEntryType)
Definition: path.c:890
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define PT_BEZIERTO
Definition: wingdi.h:886
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
BOOL FASTCALL PATH_Delete(HPATH hPath)
Definition: path.c:90

Referenced by PATH_WidenPathEx().

◆ NtGdiAbortPath()

BOOL APIENTRY NtGdiAbortPath ( HDC  hDC)

Definition at line 2460 of file path.c.

2461 {
2462  PDC dc = DC_LockDc(hDC);
2463  if (!dc)
2464  {
2466  return FALSE;
2467  }
2468 
2469  if (!dc->dclevel.hPath)
2470  {
2471  DC_UnlockDc(dc);
2472  return TRUE;
2473  }
2474 
2475  if (!PATH_Delete(dc->dclevel.hPath))
2476  {
2477  DC_UnlockDc(dc);
2478  return FALSE;
2479  }
2480 
2481  dc->dclevel.hPath = 0;
2482  dc->dclevel.flPath &= ~DCPATH_ACTIVE;
2483 
2484  DC_UnlockDc(dc);
2485  return TRUE;
2486 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:217
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define FALSE
Definition: types.h:117
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:235
static const WCHAR dc[]
BOOL FASTCALL PATH_Delete(HPATH hPath)
Definition: path.c:90
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by AbortPath().

◆ NtGdiBeginPath()

BOOL APIENTRY NtGdiBeginPath ( HDC  hDC)

Definition at line 2490 of file path.c.

2491 {
2492  PPATH pPath;
2493  PDC dc;
2494 
2495  dc = DC_LockDc(hDC);
2496  if (!dc)
2497  {
2499  return FALSE;
2500  }
2501 
2502  /* If path is already open, do nothing. Check if not Save DC state */
2503  if ((dc->dclevel.flPath & DCPATH_ACTIVE) && !(dc->dclevel.flPath & DCPATH_SAVE))
2504  {
2505  DC_UnlockDc(dc);
2506  return TRUE;
2507  }
2508 
2509  if (dc->dclevel.hPath)
2510  {
2511  TRACE("BeginPath 1 0x%p\n", dc->dclevel.hPath);
2512  if (!(dc->dclevel.flPath & DCPATH_SAVE))
2513  {
2514  // Remove previous handle.
2515  if (!PATH_Delete(dc->dclevel.hPath))
2516  {
2517  DC_UnlockDc(dc);
2518  return FALSE;
2519  }
2520  }
2521  else
2522  {
2523  // Clear flags and Handle.
2524  dc->dclevel.flPath &= ~(DCPATH_SAVE | DCPATH_ACTIVE);
2525  dc->dclevel.hPath = NULL;
2526  }
2527  }
2529  dc->dclevel.flPath |= DCPATH_ACTIVE; // Set active ASAP!
2530  dc->dclevel.hPath = pPath->BaseObject.hHmgr;
2531  IntGetCurrentPositionEx(dc, &pPath->pos);
2532  IntLPtoDP( dc, &pPath->pos, 1 );
2533  TRACE("BP : Current pos X %d Y %d\n",pPath->pos.x, pPath->pos.y);
2534  PATH_UnlockPath(pPath);
2535  DC_UnlockDc(dc);
2536 
2537  if (!pPath)
2538  {
2539  return FALSE;
2540  }
2541  return TRUE;
2542 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:217
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
PPATH FASTCALL PATH_CreatePath(int count)
Definition: path.c:35
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
Definition: path.h:34
#define FALSE
Definition: types.h:117
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define PATH_UnlockPath(pPath)
Definition: path.h:71
VOID FASTCALL IntGetCurrentPositionEx(PDC dc, LPPOINT pt)
Definition: line.c:128
POINT pos
Definition: path.h:58
#define TRACE(s)
Definition: solgame.cpp:4
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:235
#define NULL
Definition: types.h:112
#define NUM_ENTRIES_INITIAL
Definition: path.c:21
BASEOBJECT BaseObject
Definition: path.h:36
static const WCHAR dc[]
BOOL FASTCALL PATH_Delete(HPATH hPath)
Definition: path.c:90
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
static BOOLEAN IntLPtoDP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:182

Referenced by BeginPath().

◆ NtGdiCloseFigure()

BOOL APIENTRY NtGdiCloseFigure ( HDC  hDC)

Definition at line 2546 of file path.c.

2547 {
2548  BOOL Ret = FALSE; // Default to failure
2549  PDC pDc;
2550  PPATH pPath;
2551 
2552  TRACE("Enter %s\n", __FUNCTION__);
2553 
2554  pDc = DC_LockDc(hDC);
2555  if (!pDc)
2556  {
2558  return FALSE;
2559  }
2560 
2561  pPath = PATH_LockPath(pDc->dclevel.hPath);
2562  if (!pPath)
2563  {
2564  DC_UnlockDc(pDc);
2565  return FALSE;
2566  }
2567 
2568  if (pPath->state == PATH_Open)
2569  {
2570  IntGdiCloseFigure(pPath);
2571  Ret = TRUE;
2572  }
2573  else
2574  {
2576  }
2577 
2578  PATH_UnlockPath(pPath);
2579  DC_UnlockDc(pDc);
2580  return Ret;
2581 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:217
#define TRUE
Definition: types.h:120
Definition: path.h:34
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ERROR_CAN_NOT_COMPLETE
Definition: winerror.h:582
VOID FASTCALL IntGdiCloseFigure(PPATH pPath)
Definition: path.c:108
#define PATH_UnlockPath(pPath)
Definition: path.h:71
#define TRACE(s)
Definition: solgame.cpp:4
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:235
Definition: path.h:19
FLONG state
Definition: path.h:52
#define __FUNCTION__
Definition: types.h:112
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by CloseFigure().

◆ NtGdiEndPath()

BOOL APIENTRY NtGdiEndPath ( HDC  hDC)

Definition at line 2585 of file path.c.

2586 {
2587  BOOL ret = TRUE;
2588  PPATH pPath;
2589  PDC dc;
2590 
2591  dc = DC_LockDc(hDC);
2592  if (!dc)
2593  {
2595  return FALSE;
2596  }
2597 
2598  pPath = PATH_LockPath(dc->dclevel.hPath);
2599  if (!pPath)
2600  {
2601  DC_UnlockDc(dc);
2602  return FALSE;
2603  }
2604 
2605  /* Check that path is currently being constructed */
2606  if ((pPath->state != PATH_Open) || !(dc->dclevel.flPath & DCPATH_ACTIVE))
2607  {
2608  TRACE("EndPath ERROR! 0x%p\n", dc->dclevel.hPath);
2610  ret = FALSE;
2611  }
2612  /* Set flag to indicate that path is finished */
2613  else
2614  {
2615  TRACE("EndPath 0x%p\n", dc->dclevel.hPath);
2616  pPath->state = PATH_Closed;
2617  dc->dclevel.flPath &= ~DCPATH_ACTIVE;
2618  }
2619 
2620  PATH_UnlockPath(pPath);
2621  DC_UnlockDc(dc);
2622  return ret;
2623 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:217
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
Definition: path.h:34
DWORD ret
Definition: path.c:47
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ERROR_CAN_NOT_COMPLETE
Definition: winerror.h:582
#define PATH_UnlockPath(pPath)
Definition: path.h:71
#define TRACE(s)
Definition: solgame.cpp:4
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:235
Definition: path.h:19
static const WCHAR dc[]
FLONG state
Definition: path.h:52
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by EndPath().

◆ NtGdiFillPath()

BOOL APIENTRY NtGdiFillPath ( HDC  hDC)

Definition at line 2627 of file path.c.

2628 {
2629  BOOL ret = FALSE;
2630  PPATH pPath, pNewPath;
2631  PDC_ATTR pdcattr;
2632  PDC dc;
2633 
2634  dc = DC_LockDc(hDC);
2635  if (!dc)
2636  {
2638  return FALSE;
2639  }
2640 
2641  pPath = PATH_LockPath(dc->dclevel.hPath);
2642  if (!pPath)
2643  {
2644  DC_UnlockDc(dc);
2645  return FALSE;
2646  }
2647 
2649 
2650  pdcattr = dc->pdcattr;
2651 
2652  if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
2654 
2655  if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
2657 
2658  pNewPath = PATH_FlattenPath(pPath);
2659 
2660  if (pNewPath->state != PATH_Closed)
2661  {
2663  }
2664  else if (pNewPath->numEntriesUsed)
2665  {
2666  ret = PATH_FillPath(dc, pNewPath);
2667  }
2668  else ret = TRUE;
2669 
2670  PATH_UnlockPath(pNewPath);
2671  PATH_Delete(pNewPath->BaseObject.hHmgr);
2672 
2673  PATH_UnlockPath(pPath);
2674  PATH_Delete(pPath->BaseObject.hHmgr);
2675  dc->dclevel.hPath = 0;
2676  dc->dclevel.flPath &= ~DCPATH_ACTIVE;
2677 
2679  DC_UnlockDc(dc);
2680  return ret;
2681 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc)
Definition: dcobjs.c:62
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:217
#define TRUE
Definition: types.h:120
#define DC_PEN_DIRTY
Definition: ntgdihdl.h:136
Definition: path.h:34
DWORD ret
Definition: path.c:47
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ERROR_CAN_NOT_COMPLETE
Definition: winerror.h:582
PPATH FASTCALL PATH_FlattenPath(PPATH pPath)
Definition: path.c:1407
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define PATH_UnlockPath(pPath)
Definition: path.h:71
int numEntriesUsed
Definition: path.h:55
ULONG ulDirty_
Definition: ntgdihdl.h:290
Definition: polytest.cpp:40
#define DIRTY_FILL
Definition: ntgdihdl.h:123
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:235
#define NULL
Definition: types.h:112
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:135
VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdcDest, const RECT *rcDest, PDC pdcSrc, const RECT *rcSrc)
Definition: dclife.c:505
VOID FASTCALL DC_vFinishBlit(PDC pdc1, PDC pdc2)
Definition: dclife.c:614
BASEOBJECT BaseObject
Definition: path.h:36
#define DIRTY_LINE
Definition: ntgdihdl.h:124
static const WCHAR dc[]
FLONG state
Definition: path.h:52
BOOL FASTCALL PATH_Delete(HPATH hPath)
Definition: path.c:90
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
BOOL FASTCALL PATH_FillPath(PDC dc, PPATH pPath)
Definition: path.c:1506
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16

Referenced by FillPath().

◆ NtGdiFlattenPath()

BOOL APIENTRY NtGdiFlattenPath ( HDC  hDC)

Definition at line 2685 of file path.c.

2686 {
2687  BOOL Ret = FALSE;
2688  DC *pDc;
2689  PPATH pPath, pNewPath = NULL;
2690 
2691  TRACE("Enter %s\n", __FUNCTION__);
2692 
2693  pDc = DC_LockDc(hDC);
2694  if (!pDc)
2695  {
2697  return FALSE;
2698  }
2699 
2700  pPath = PATH_LockPath(pDc->dclevel.hPath);
2701  if (!pPath)
2702  {
2704  DC_UnlockDc(pDc);
2705  return FALSE;
2706  }
2707 
2708  if (pPath->state == PATH_Closed)
2709  {
2710  pNewPath = PATH_FlattenPath(pPath);
2711  }
2712 
2713  PATH_UnlockPath(pPath);
2714 
2715  if (pNewPath)
2716  {
2717  PATH_Delete(pDc->dclevel.hPath);
2718  pDc->dclevel.hPath = pNewPath->BaseObject.hHmgr;
2719  PATH_UnlockPath(pNewPath);
2720  Ret = TRUE;
2721  }
2722 
2723  DC_UnlockDc(pDc);
2724  return Ret;
2725 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:217
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
Definition: path.h:34
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ERROR_CAN_NOT_COMPLETE
Definition: winerror.h:582
PPATH FASTCALL PATH_FlattenPath(PPATH pPath)
Definition: path.c:1407
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define PATH_UnlockPath(pPath)
Definition: path.h:71
#define TRACE(s)
Definition: solgame.cpp:4
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:235
#define NULL
Definition: types.h:112
BASEOBJECT BaseObject
Definition: path.h:36
FLONG state
Definition: path.h:52
#define __FUNCTION__
Definition: types.h:112
BOOL FASTCALL PATH_Delete(HPATH hPath)
Definition: path.c:90
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by FlattenPath().

◆ NtGdiGetPath()

INT APIENTRY NtGdiGetPath ( HDC  hDC,
LPPOINT  Points,
LPBYTE  Types,
INT  nSize 
)

Definition at line 2762 of file path.c.

2767 {
2768  INT ret = -1;
2769  PPATH pPath;
2770  DC *dc;
2771 
2772  _SEH2_TRY
2773  {
2774  ProbeForWrite(Points, nSize * sizeof(*Points), sizeof(ULONG));
2775  ProbeForWrite(Types, nSize, 1);
2776  }
2778  {
2780  _SEH2_YIELD(return -1);
2781  }
2782  _SEH2_END
2783 
2784  dc = DC_LockDc(hDC);
2785  TRACE("NtGdiGetPath start\n");
2786  if (!dc)
2787  {
2788  ERR("Can't lock dc!\n");
2790  return -1;
2791  }
2792 
2793  pPath = PATH_LockPath(dc->dclevel.hPath);
2794  if (!pPath)
2795  {
2796  DC_UnlockDc(dc);
2797  return -1;
2798  }
2799 
2800  if (pPath->state != PATH_Closed)
2801  {
2803  goto done;
2804  }
2805 
2806  if (nSize == 0)
2807  {
2808  ret = pPath->numEntriesUsed;
2809  }
2810  else if (nSize < pPath->numEntriesUsed)
2811  {
2813  goto done;
2814  }
2815  else
2816  {
2817  _SEH2_TRY
2818  {
2819  memcpy(Points, pPath->pPoints, sizeof(POINT)*pPath->numEntriesUsed);
2820  memcpy(Types, pPath->pFlags, sizeof(BYTE)*pPath->numEntriesUsed);
2821 
2822  /* Convert the points to logical coordinates */
2823  if (!GdiPathDPtoLP(dc, Points, pPath->numEntriesUsed))
2824  {
2826  _SEH2_LEAVE;
2827  }
2828 
2829  ret = pPath->numEntriesUsed;
2830  }
2832  {
2834  }
2835  _SEH2_END
2836  }
2837 
2838 done:
2839  TRACE("NtGdiGetPath exit %d\n",ret);
2840  PATH_UnlockPath(pPath);
2841  DC_UnlockDc(dc);
2842  return ret;
2843 }
_SEH2_TRY
Definition: create.c:4226
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:217
char ACPI_OBJECT_TYPE * Types
Definition: acdebug.h:353
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2058
Definition: path.h:34
_SEH2_END
Definition: create.c:4400
int32_t INT
Definition: typedefs.h:58
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
DWORD ret
Definition: path.c:47
#define PATH_LockPath(hPath)
Definition: path.h:70
#define ERROR_CAN_NOT_COMPLETE
Definition: winerror.h:582
POINT * pPoints
Definition: path.h:53
#define PATH_UnlockPath(pPath)
Definition: path.h:71
int numEntriesUsed
Definition: path.h:55
#define ERROR_ARITHMETIC_OVERFLOW
Definition: winerror.h:351
BYTE * pFlags
Definition: path.h:54
#define TRACE(s)
Definition: solgame.cpp:4
Definition: polytest.cpp:40
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:37
unsigned char BYTE
Definition: xxhash.c:193
#define ERR(fmt,...)
Definition: debug.h:110
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:235
BOOL FASTCALL GdiPathDPtoLP(PDC pdc, PPOINT ppt, INT count)
Definition: path.c:125
unsigned int ULONG
Definition: retypes.h:1
static const WCHAR dc[]
FLONG state
Definition: path.h:52
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
#define _SEH2_LEAVE
Definition: filesup.c:20
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by GetPath().

◆ NtGdiPathToRegion()

HRGN APIENTRY NtGdiPathToRegion ( HDC  hDC)

Definition at line 2847 of file path.c.

2848 {
2849  PPATH pPath, pNewPath;
2850  HRGN hrgnRval = 0;
2851  int Ret;
2852  PREGION Rgn;
2853  DC *pDc;
2854  PDC_ATTR pdcattr;
2855 
2856  TRACE("Enter %s\n", __FUNCTION__);
2857 
2858  pDc = DC_LockDc(hDC);
2859  if (!pDc)
2860  {
2861  ERR("Failed to lock DC %p\n", hDC);
2863  return NULL;
2864  }
2865 
2866  pdcattr = pDc->pdcattr;
2867 
2868  pPath = PATH_LockPath(pDc->dclevel.hPath);
2869  if (!pPath)
2870  {
2871  ERR("Failed to lock DC path %p\n", pDc->dclevel.hPath);
2872  DC_UnlockDc(pDc);
2873  return NULL;
2874  }
2875 
2876  if (pPath->state != PATH_Closed)
2877  {
2878  // FIXME: Check that setlasterror is being called correctly
2879  ERR("Path is not closed!\n");
2881  }
2882  else
2883  {
2884  /* Create the region and fill it with the path strokes */
2886  if (!Rgn)
2887  {
2888  ERR("Failed to allocate a region\n");
2889  PATH_UnlockPath(pPath);
2890  DC_UnlockDc(pDc);
2891  return NULL;
2892  }
2893  hrgnRval = Rgn->BaseObject.hHmgr;
2894 
2895  pNewPath = PATH_FlattenPath(pPath);
2896 
2897  Ret = PATH_PathToRegion(pNewPath, pdcattr->jFillMode, Rgn);
2898 
2899  PATH_UnlockPath(pNewPath);
2900  PATH_Delete(pNewPath->BaseObject.hHmgr);
2901 
2902  if (!Ret)
2903  {
2904  ERR("PATH_PathToRegion failed\n");
2905  REGION_Delete(Rgn);
2906  hrgnRval = NULL;
2907  }
2908  else
2909  REGION_UnlockRgn(Rgn);
2910  }
2911 
2912  PATH_UnlockPath(pPath);
2913  PATH_Delete(pDc->dclevel.hPath);
2914  pDc->dclevel.hPath = NULL;
2915  pDc->dclevel.flPath &= ~DCPATH_ACTIVE;
2916 
2917  DC_UnlockDc(pDc);
2918  return hrgnRval;
2919 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
BASEOBJECT BaseObject
Definition: region.h:11
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:217
Definition: path.h:34
#define PATH_LockPath(hPath)
Definition: path.h:70
#define ERROR_CAN_NOT_COMPLETE
Definition: winerror.h:582
BOOL FASTCALL PATH_PathToRegion(PPATH pPath, INT Mode, PREGION Rgn)
Definition: path.c:1451
PPATH FASTCALL PATH_FlattenPath(PPATH pPath)
Definition: path.c:1407
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define PATH_UnlockPath(pPath)
Definition: path.h:71
Definition: region.h:7
#define TRACE(s)
Definition: solgame.cpp:4
Definition: polytest.cpp:40
BYTE jFillMode
Definition: ntgdihdl.h:305
#define ERR(fmt,...)
Definition: debug.h:110
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:235
#define NULL
Definition: types.h:112
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2392
BASEOBJECT BaseObject
Definition: path.h:36
FLONG state
Definition: path.h:52
PREGION FASTCALL REGION_AllocUserRgnWithHandle(INT nRgn)
Definition: region.c:2313
#define __FUNCTION__
Definition: types.h:112
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2468
BOOL FASTCALL PATH_Delete(HPATH hPath)
Definition: path.c:90
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by PathToRegion().

◆ NtGdiSetMiterLimit()

BOOL APIENTRY NtGdiSetMiterLimit ( IN HDC  hdc,
IN DWORD  dwNew,
IN OUT OPTIONAL PDWORD  pdwOut 
)

Definition at line 2923 of file path.c.

2927 {
2928  DC *pDc;
2929  gxf_long worker, worker1;
2930  BOOL bResult = TRUE;
2931 
2932  if (!(pDc = DC_LockDc(hdc)))
2933  {
2935  return FALSE;
2936  }
2937 
2938  worker.l = dwNew;
2939  worker1.f = pDc->dclevel.laPath.eMiterLimit;
2940  pDc->dclevel.laPath.eMiterLimit = worker.f;
2941 
2942  if (pdwOut)
2943  {
2944  _SEH2_TRY
2945  {
2946  ProbeForWrite(pdwOut, sizeof(DWORD), 1);
2947  *pdwOut = worker1.l;
2948  }
2950  {
2952  bResult = FALSE;
2953  }
2954  _SEH2_END;
2955  }
2956 
2957  DC_UnlockDc(pDc);
2958  return bResult;
2959 }
_SEH2_TRY
Definition: create.c:4226
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
FLOAT f
Definition: ntgdityp.h:426
ULONG l
Definition: ntgdityp.h:427
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:217
#define TRUE
Definition: types.h:120
_SEH2_END
Definition: create.c:4400
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: polytest.cpp:40
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:37
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:235
_Out_ PDWORD pdwOut
Definition: ntgdi.h:1813
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by SetMiterLimit().

◆ NtGdiStrokeAndFillPath()

BOOL APIENTRY NtGdiStrokeAndFillPath ( HDC  hDC)

Definition at line 2963 of file path.c.

2964 {
2965  DC *pDc;
2966  PDC_ATTR pdcattr;
2967  PPATH pPath, pNewPath;
2968  BOOL bRet = FALSE;
2969 
2970  TRACE("Enter %s\n", __FUNCTION__);
2971 
2972  if (!(pDc = DC_LockDc(hDC)))
2973  {
2975  return FALSE;
2976  }
2977  pPath = PATH_LockPath(pDc->dclevel.hPath);
2978  if (!pPath)
2979  {
2980  DC_UnlockDc(pDc);
2981  return FALSE;
2982  }
2983 
2985 
2986  pdcattr = pDc->pdcattr;
2987 
2988  if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
2989  DC_vUpdateFillBrush(pDc);
2990 
2991  if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
2992  DC_vUpdateLineBrush(pDc);
2993 
2994  pNewPath = PATH_FlattenPath(pPath);
2995 
2996  if (pNewPath->state != PATH_Closed)
2997  {
2999  }
3000  else if (pNewPath->numEntriesUsed)
3001  {
3002  bRet = PATH_FillPath(pDc, pNewPath);
3003  if (bRet) bRet = PATH_StrokePath(pDc, pNewPath);
3004  }
3005  else bRet = TRUE;
3006 
3007  PATH_UnlockPath(pNewPath);
3008  PATH_Delete(pNewPath->BaseObject.hHmgr);
3009 
3010  PATH_UnlockPath(pPath);
3011  PATH_Delete(pPath->BaseObject.hHmgr);
3012  pDc->dclevel.hPath = 0;
3013  pDc->dclevel.flPath &= ~DCPATH_ACTIVE;
3014 
3015  DC_vFinishBlit(pDc, NULL);
3016  DC_UnlockDc(pDc);
3017  return bRet;
3018 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc)
Definition: dcobjs.c:62
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:217
BOOL FASTCALL PATH_StrokePath(DC *dc, PPATH pPath)
Definition: path.c:1598
#define TRUE
Definition: types.h:120
#define DC_PEN_DIRTY
Definition: ntgdihdl.h:136
Definition: path.h:34
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ERROR_CAN_NOT_COMPLETE
Definition: winerror.h:582
PPATH FASTCALL PATH_FlattenPath(PPATH pPath)
Definition: path.c:1407
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define PATH_UnlockPath(pPath)
Definition: path.h:71
int numEntriesUsed
Definition: path.h:55
ULONG ulDirty_
Definition: ntgdihdl.h:290
#define TRACE(s)
Definition: solgame.cpp:4
Definition: polytest.cpp:40
#define DIRTY_FILL
Definition: ntgdihdl.h:123
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:235
#define NULL
Definition: types.h:112
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:135
VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdcDest, const RECT *rcDest, PDC pdcSrc, const RECT *rcSrc)
Definition: dclife.c:505
VOID FASTCALL DC_vFinishBlit(PDC pdc1, PDC pdc2)
Definition: dclife.c:614
BASEOBJECT BaseObject
Definition: path.h:36
#define DIRTY_LINE
Definition: ntgdihdl.h:124
FLONG state
Definition: path.h:52
#define __FUNCTION__
Definition: types.h:112
BOOL FASTCALL PATH_Delete(HPATH hPath)
Definition: path.c:90
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
BOOL FASTCALL PATH_FillPath(PDC dc, PPATH pPath)
Definition: path.c:1506
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16

Referenced by StrokeAndFillPath().

◆ NtGdiStrokePath()

BOOL APIENTRY NtGdiStrokePath ( HDC  hDC)

Definition at line 3022 of file path.c.

3023 {
3024  DC *pDc;
3025  PDC_ATTR pdcattr;
3026  PPATH pPath, pNewPath;
3027  BOOL bRet = FALSE;
3028 
3029  TRACE("Enter %s\n", __FUNCTION__);
3030 
3031  if (!(pDc = DC_LockDc(hDC)))
3032  {
3034  return FALSE;
3035  }
3036 
3037  pPath = PATH_LockPath(pDc->dclevel.hPath);
3038  if (!pPath)
3039  {
3040  DC_UnlockDc(pDc);
3041  return FALSE;
3042  }
3043 
3045 
3046  pdcattr = pDc->pdcattr;
3047 
3048  if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
3049  DC_vUpdateLineBrush(pDc);
3050 
3051  pNewPath = PATH_FlattenPath(pPath);
3052 
3053  if (pNewPath->state != PATH_Closed)
3054  {
3056  }
3057  else bRet = PATH_StrokePath(pDc, pNewPath);
3058 
3059  PATH_UnlockPath(pNewPath);
3060  PATH_Delete(pNewPath->BaseObject.hHmgr);
3061 
3062  DC_vFinishBlit(pDc, NULL);
3063 
3064  PATH_UnlockPath(pPath);
3065  PATH_Delete(pPath->BaseObject.hHmgr);
3066  pDc->dclevel.hPath = 0;
3067  pDc->dclevel.flPath &= ~DCPATH_ACTIVE;
3068 
3069  DC_UnlockDc(pDc);
3070  return bRet;
3071 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc)
Definition: dcobjs.c:62
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:217
BOOL FASTCALL PATH_StrokePath(DC *dc, PPATH pPath)
Definition: path.c:1598
#define DC_PEN_DIRTY
Definition: ntgdihdl.h:136
Definition: path.h:34
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ERROR_CAN_NOT_COMPLETE
Definition: winerror.h:582
PPATH FASTCALL PATH_FlattenPath(PPATH pPath)
Definition: path.c:1407
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define PATH_UnlockPath(pPath)
Definition: path.h:71
ULONG ulDirty_
Definition: ntgdihdl.h:290
#define TRACE(s)
Definition: solgame.cpp:4
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:235
#define NULL
Definition: types.h:112
VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdcDest, const RECT *rcDest, PDC pdcSrc, const RECT *rcSrc)
Definition: dclife.c:505
VOID FASTCALL DC_vFinishBlit(PDC pdc1, PDC pdc2)
Definition: dclife.c:614
BASEOBJECT BaseObject
Definition: path.h:36
#define DIRTY_LINE
Definition: ntgdihdl.h:124
FLONG state
Definition: path.h:52
#define __FUNCTION__
Definition: types.h:112
BOOL FASTCALL PATH_Delete(HPATH hPath)
Definition: path.c:90
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by StrokePath().

◆ NtGdiWidenPath()

BOOL APIENTRY NtGdiWidenPath ( HDC  hDC)

Definition at line 3075 of file path.c.

3076 {
3077  PPATH pPath;
3078  BOOL Ret = FALSE;
3079  PDC pdc = DC_LockDc(hDC);
3080  TRACE("NtGdiWidenPat Enter\n");
3081  if (!pdc)
3082  {
3084  return FALSE;
3085  }
3086 
3087  pPath = PATH_WidenPath(pdc);
3088  if (pPath)
3089  {
3090  TRACE("WindenPath New Path\n");
3091  PATH_Delete(pdc->dclevel.hPath);
3092  pdc->dclevel.hPath = pPath->BaseObject.hHmgr;
3093  Ret = TRUE;
3094  }
3095  DC_UnlockDc(pdc);
3096  TRACE("NtGdiWidenPat Ret %d\n",Ret);
3097  return Ret;
3098 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:217
#define TRUE
Definition: types.h:120
Definition: path.h:34
static PPATH FASTCALL PATH_WidenPath(DC *dc)
Definition: path.c:2119
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define TRACE(s)
Definition: solgame.cpp:4
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:235
BASEOBJECT BaseObject
Definition: path.h:36
BOOL FASTCALL PATH_Delete(HPATH hPath)
Definition: path.c:90
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by WidenPath().

◆ PATH_add_outline()

static BOOL FASTCALL PATH_add_outline ( PDC  dc,
PPATH  pPath,
INT  x,
INT  y,
TTPOLYGONHEADER header,
DWORD  size 
)
static

Definition at line 2259 of file path.c.

2266 {
2268  POINT pt;
2269  BOOL bResult = FALSE;
2270 
2271  start = header;
2272 
2273  while ((char *)header < (char *)start + size)
2274  {
2275  TTPOLYCURVE *curve;
2276 
2277  if (header->dwType != TT_POLYGON_TYPE)
2278  {
2279  ERR("Unknown header type %lu\n", header->dwType);
2280  goto cleanup;
2281  }
2282 
2283  pt.x = x + int_from_fixed(header->pfxStart.x);
2284  pt.y = y - int_from_fixed(header->pfxStart.y);
2285  PATH_AddEntry(pPath, &pt, PT_MOVETO);
2286 
2287  curve = (TTPOLYCURVE *)(header + 1);
2288 
2289  while ((char *)curve < (char *)header + header->cb)
2290  {
2291  TRACE("curve->wType %d\n", curve->wType);
2292 
2293  switch(curve->wType)
2294  {
2295  case TT_PRIM_LINE:
2296  {
2297  WORD i;
2298 
2299  for (i = 0; i < curve->cpfx; i++)
2300  {
2301  pt.x = x + int_from_fixed(curve->apfx[i].x);
2302  pt.y = y - int_from_fixed(curve->apfx[i].y);
2303  PATH_AddEntry(pPath, &pt, PT_LINETO);
2304  }
2305  break;
2306  }
2307 
2308  case TT_PRIM_QSPLINE:
2309  case TT_PRIM_CSPLINE:
2310  {
2311  WORD i;
2312  POINTFX ptfx;
2313  POINT *pts = ExAllocatePoolWithTag(PagedPool, (curve->cpfx + 1) * sizeof(POINT), TAG_PATH);
2314 
2315  if (!pts) goto cleanup;
2316 
2317  ptfx = *(POINTFX *)((char *)curve - sizeof(POINTFX));
2318 
2319  pts[0].x = x + int_from_fixed(ptfx.x);
2320  pts[0].y = y - int_from_fixed(ptfx.y);
2321 
2322  for (i = 0; i < curve->cpfx; i++)
2323  {
2324  pts[i + 1].x = x + int_from_fixed(curve->apfx[i].x);
2325  pts[i + 1].y = y - int_from_fixed(curve->apfx[i].y);
2326  }
2327 
2328  PATH_BezierTo(pPath, pts, curve->cpfx + 1);
2329 
2331  break;
2332  }
2333 
2334  default:
2335  ERR("Unknown curve type %04x\n", curve->wType);
2336  goto cleanup;
2337  }
2338 
2339  curve = (TTPOLYCURVE *)&curve->apfx[curve->cpfx];
2340  }
2341  header = (TTPOLYGONHEADER *)((char *)header + header->cb);
2342  }
2343 
2344  bResult = TRUE;
2345 
2346 cleanup:
2347  IntGdiCloseFigure(pPath);
2348  return bResult;
2349 }
BOOL FASTCALL PATH_AddEntry(PPATH pPath, const POINT *pPoint, BYTE flags)
Definition: path.c:262
long y
Definition: polytest.cpp:48
static VOID FASTCALL PATH_BezierTo(PPATH pPath, POINT *lppt, INT n)
Definition: path.c:2215
long x
Definition: polytest.cpp:48
#define TT_POLYGON_TYPE
Definition: wingdi.h:1318
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
FIXED y
Definition: wingdi.h:2709
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
VOID FASTCALL IntGdiCloseFigure(PPATH pPath)
Definition: path.c:108
struct tagPOINTFX POINTFX
#define TAG_PATH
Definition: tags.h:25
#define TT_PRIM_CSPLINE
Definition: wingdi.h:1321
#define TT_PRIM_QSPLINE
Definition: wingdi.h:1320
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
POINTFX apfx[1]
Definition: wingdi.h:2714
unsigned short WORD
Definition: ntddk_ex.h:93
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
static INT int_from_fixed(FIXED f)
Definition: path.c:2202
#define ERR(fmt,...)
Definition: debug.h:110
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
GLuint start
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define PT_LINETO
Definition: wingdi.h:885
#define PT_MOVETO
Definition: wingdi.h:884
char * cleanup(char *str)
Definition: wpickclick.c:99
#define TT_PRIM_LINE
Definition: wingdi.h:1319
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
struct CFHEADER header
Definition: fdi.c:101
FIXED x
Definition: wingdi.h:2708

Referenced by PATH_ExtTextOut().

◆ PATH_AddEntry()

BOOL FASTCALL PATH_AddEntry ( PPATH  pPath,
const POINT pPoint,
BYTE  flags 
)

Definition at line 262 of file path.c.

266 {
267  ASSERT(pPath != NULL);
268 
269  /* FIXME: If newStroke is true, perhaps we want to check that we're
270  * getting a PT_MOVETO
271  */
272  TRACE("(%d,%d) - %d\n", pPoint->x, pPoint->y, flags);
273 
274  /* Reserve enough memory for an extra path entry */
275  if (!PATH_ReserveEntries(pPath, pPath->numEntriesUsed + 1))
276  return FALSE;
277 
278  /* Store information in path entry */
279  pPath->pPoints[pPath->numEntriesUsed] = *pPoint;
280  pPath->pFlags[pPath->numEntriesUsed] = flags;
281 
282  /* Increment entry count */
283  pPath->numEntriesUsed++;
284 
285  return TRUE;
286 }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
POINT * pPoints
Definition: path.h:53
int numEntriesUsed
Definition: path.h:55
BYTE * pFlags
Definition: path.h:54
#define TRACE(s)
Definition: solgame.cpp:4
#define ASSERT(a)
Definition: mode.c:44
GLbitfield flags
Definition: glext.h:7161
#define NULL
Definition: types.h:112
BOOL FASTCALL PATH_ReserveEntries(PPATH pPath, INT numEntries)
Definition: path.c:296

Referenced by IntGdiWidenPath(), PATH_add_outline(), PATH_AddFlatBezier(), PATH_Arc(), PATH_BezierTo(), PATH_FlattenPath(), PATH_LineTo(), and PATH_PolyPolyline().

◆ PATH_AddFlatBezier()

BOOL FASTCALL PATH_AddFlatBezier ( PPATH  pPath,
POINT pt,
BOOL  closed 
)

Definition at line 1378 of file path.c.

1382 {
1383  POINT *pts;
1384  BOOL ret = FALSE;
1385  INT no, i;
1386 
1387  pts = GDI_Bezier(pt, 4, &no);
1388  if (!pts) return FALSE;
1389 
1390  for (i = 1; i < no; i++)
1391  {
1392  if (!(ret = PATH_AddEntry(pPath, &pts[i], (i == no - 1 && closed) ? PT_LINETO | PT_CLOSEFIGURE : PT_LINETO)))
1393  break;
1394  }
1395 
1397  return ret;
1398 }
BOOL FASTCALL PATH_AddEntry(PPATH pPath, const POINT *pPoint, BYTE flags)
Definition: path.c:262
#define pt(x, y)
Definition: drawing.c:79
int32_t INT
Definition: typedefs.h:58
DWORD ret
Definition: path.c:47
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TAG_BEZIER
Definition: tags.h:13
static WCHAR no[MAX_STRING_RESOURCE_LEN]
Definition: object.c:2340
POINT * GDI_Bezier(const POINT *Points, INT count, INT *nPtsOut)
Definition: bezier.c:189
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 PT_CLOSEFIGURE
Definition: wingdi.h:887
#define PT_LINETO
Definition: wingdi.h:885
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

Referenced by PATH_FlattenPath().

◆ PATH_Arc()

BOOL FASTCALL PATH_Arc ( PDC  dc,
INT  x1,
INT  y1,
INT  x2,
INT  y2,
INT  xStart,
INT  yStart,
INT  xEnd,
INT  yEnd,
INT  direction,
INT  lines 
)

Definition at line 955 of file path.c.

967 {
968  double angleStart, angleEnd, angleStartQuadrant, angleEndQuadrant = 0.0;
969  /* Initialize angleEndQuadrant to silence gcc's warning */
970  FLOATL x, y;
971  POINT corners[2], pointStart, pointEnd;
972  POINT centre, pointCurPos;
973  BOOL start, end, Ret = TRUE;
974  INT temp;
975  BOOL clockwise;
976  PPATH pPath;
977 
978  /* FIXME: This function should check for all possible error returns */
979  /* FIXME: Do we have to respect newStroke? */
980 
981  ASSERT(dc);
982 
983  pPath = PATH_LockPath(dc->dclevel.hPath);
984  if (!pPath) return FALSE;
985 
986  if (direction)
987  clockwise = ((direction == AD_CLOCKWISE) !=0 );
988  else
989  clockwise = ((dc->dclevel.flPath & DCPATH_CLOCKWISE) != 0);
990 
991  /* Check for zero height / width */
992  /* FIXME: Only in GM_COMPATIBLE? */
993  if (x1 == x2 || y1 == y2)
994  {
995  Ret = TRUE;
996  goto ArcExit;
997  }
998  /* Convert points to device coordinates */
999  corners[0].x = x1; corners[0].y = y1;
1000  corners[1].x = x2; corners[1].y = y2;
1001  pointStart.x = xStart; pointStart.y = yStart;
1002  pointEnd.x = xEnd; pointEnd.y = yEnd;
1003  INTERNAL_LPTODP(dc, corners, 2);
1004  INTERNAL_LPTODP(dc, &pointStart, 1);
1005  INTERNAL_LPTODP(dc, &pointEnd, 1);
1006 
1007  /* Make sure first corner is top left and second corner is bottom right */
1008  if (corners[0].x > corners[1].x)
1009  {
1010  temp = corners[0].x;
1011  corners[0].x = corners[1].x;
1012  corners[1].x = temp;
1013  }
1014  if (corners[0].y > corners[1].y)
1015  {
1016  temp = corners[0].y;
1017  corners[0].y = corners[1].y;
1018  corners[1].y = temp;
1019  }
1020 
1021  /* Compute start and end angle */
1022  PATH_NormalizePoint(corners, &pointStart, &x, &y);
1023  angleStart = atan2(*(FLOAT*)&y, *(FLOAT*)&x);
1024  PATH_NormalizePoint(corners, &pointEnd, &x, &y);
1025  angleEnd = atan2(*(FLOAT*)&y, *(FLOAT*)&x);
1026 
1027  /* Make sure the end angle is "on the right side" of the start angle */
1028  if (clockwise)
1029  {
1030  if (angleEnd <= angleStart)
1031  {
1032  angleEnd += 2 * M_PI;
1033  ASSERT(angleEnd >= angleStart);
1034  }
1035  }
1036  else
1037  {
1038  if (angleEnd >= angleStart)
1039  {
1040  angleEnd -= 2 * M_PI;
1041  ASSERT(angleEnd <= angleStart);
1042  }
1043  }
1044 
1045  /* In GM_COMPATIBLE, don't include bottom and right edges */
1046  if (dc->pdcattr->iGraphicsMode == GM_COMPATIBLE)
1047  {
1048  corners[1].x--;
1049  corners[1].y--;
1050  }
1051 
1052  /* arcto: Add a PT_MOVETO only if this is the first entry in a stroke */
1053  if (lines == GdiTypeArcTo && pPath->newStroke) // -1
1054  {
1055  pPath->newStroke = FALSE;
1056  IntGetCurrentPositionEx(dc, &pointCurPos);
1057  CoordLPtoDP(dc, &pointCurPos);
1058  if (!PATH_AddEntry(pPath, &pointCurPos, PT_MOVETO))
1059  {
1060  Ret = FALSE;
1061  goto ArcExit;
1062  }
1063  }
1064 
1065  /* Add the arc to the path with one Bezier spline per quadrant that the
1066  * arc spans */
1067  start = TRUE;
1068  end = FALSE;
1069  do
1070  {
1071  /* Determine the start and end angles for this quadrant */
1072  if (start)
1073  {
1074  angleStartQuadrant = angleStart;
1075  if (clockwise)
1076  angleEndQuadrant = (floor(angleStart / M_PI_2) + 1.0) * M_PI_2;
1077  else
1078  angleEndQuadrant = (ceil(angleStart / M_PI_2) - 1.0) * M_PI_2;
1079  }
1080  else
1081  {
1082  angleStartQuadrant = angleEndQuadrant;
1083  if (clockwise)
1084  angleEndQuadrant += M_PI_2;
1085  else
1086  angleEndQuadrant -= M_PI_2;
1087  }
1088 
1089  /* Have we reached the last part of the arc? */
1090  if ((clockwise && angleEnd < angleEndQuadrant) ||
1091  (!clockwise && angleEnd > angleEndQuadrant))
1092  {
1093  /* Adjust the end angle for this quadrant */
1094  angleEndQuadrant = angleEnd;
1095  end = TRUE;
1096  }
1097 
1098  /* Add the Bezier spline to the path */
1099  PATH_DoArcPart(pPath,
1100  corners,
1101  angleStartQuadrant,
1102  angleEndQuadrant,
1103  start ? (lines == GdiTypeArcTo ? PT_LINETO : PT_MOVETO) : FALSE); // -1
1104  start = FALSE;
1105  }
1106  while (!end);
1107 
1108  if (lines == GdiTypeArcTo)
1109  {
1110  update_current_pos( pPath );
1111  }
1112  else /* chord: close figure. pie: add line and close figure */
1113  if (lines == GdiTypeChord) // 1
1114  {
1115  IntGdiCloseFigure(pPath);
1116  }
1117  else if (lines == GdiTypePie) // 2
1118  {
1119  centre.x = (corners[0].x + corners[1].x) / 2;
1120  centre.y = (corners[0].y + corners[1].y) / 2;
1121  if (!PATH_AddEntry(pPath, &centre, PT_LINETO | PT_CLOSEFIGURE))
1122  Ret = FALSE;
1123  }
1124 ArcExit:
1125  PATH_UnlockPath(pPath);
1126  return Ret;
1127 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
_Check_return_ _CRTIMP double __cdecl ceil(_In_ double x)
BOOL FASTCALL PATH_AddEntry(PPATH pPath, const POINT *pPoint, BYTE flags)
Definition: path.c:262
valarray< _Tp > atan2(const valarray< _Tp > &__x, const valarray< _Tp > &__y)
Definition: _valarray.h:928
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
Definition: path.h:34
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int32_t INT
Definition: typedefs.h:58
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
VOID FASTCALL IntGdiCloseFigure(PPATH pPath)
Definition: path.c:108
#define AD_CLOCKWISE
Definition: wingdi.h:668
static void update_current_pos(PPATH path)
Definition: path.c:519
#define PATH_UnlockPath(pPath)
Definition: path.h:71
VOID FASTCALL IntGetCurrentPositionEx(PDC dc, LPPOINT pt)
Definition: line.c:128
eMaj lines
Definition: tritemp.h:206
#define ASSERT(a)
Definition: mode.c:44
#define GM_COMPATIBLE
Definition: wingdi.h:864
GLuint GLuint end
Definition: gl.h:1545
#define M_PI
Definition: dib.cpp:249
#define M_PI_2
Definition: port.h:185
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
FLOAT FLOATL
Definition: winddi.h:114
static calc_node_t temp
Definition: rpn_ieee.c:38
GLuint start
Definition: gl.h:1545
BOOL newStroke
Definition: path.h:57
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
#define CoordLPtoDP(pdc, ppt)
Definition: coord.h:187
#define PT_CLOSEFIGURE
Definition: wingdi.h:887
#define PT_LINETO
Definition: wingdi.h:885
float FLOAT
Definition: typedefs.h:69
#define PT_MOVETO
Definition: wingdi.h:884
static const WCHAR dc[]
static BOOL PATH_DoArcPart(PPATH pPath, POINT corners[], double angleStart, double angleEnd, BYTE startEntryType)
Definition: path.c:890
_Check_return_ _CRTIMP double __cdecl floor(_In_ double x)
static VOID PATH_NormalizePoint(POINTL corners[], const POINTL *pPoint, FLOATL *pX, FLOATL *pY)
Definition: path.c:401
static BOOLEAN INTERNAL_LPTODP(DC *dc, LPPOINT points, UINT count)
Definition: coord.h:47

Referenced by IntGdiArcInternal().

◆ PATH_AssignGdiPath()

BOOL FASTCALL PATH_AssignGdiPath ( PPATH  pPathDest,
const PPATH  pPathSrc 
)

Definition at line 166 of file path.c.

169 {
170  ASSERT(pPathDest != NULL && pPathSrc != NULL);
171 
172  /* Make sure destination arrays are big enough */
173  if (!PATH_ReserveEntries(pPathDest, pPathSrc->numEntriesUsed))
174  return FALSE;
175 
176  /* Perform the copy operation */
177  memcpy(pPathDest->pPoints, pPathSrc->pPoints, sizeof(POINT)*pPathSrc->numEntriesUsed);
178  memcpy(pPathDest->pFlags, pPathSrc->pFlags, sizeof(BYTE)*pPathSrc->numEntriesUsed);
179 
180  pPathDest->pos = pPathSrc->pos;
181  pPathDest->state = pPathSrc->state;
182  pPathDest->numEntriesUsed = pPathSrc->numEntriesUsed;
183  pPathDest->newStroke = pPathSrc->newStroke;
184  return TRUE;
185 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
POINT * pPoints
Definition: path.h:53
int numEntriesUsed
Definition: path.h:55
BYTE * pFlags
Definition: path.h:54
POINT pos
Definition: path.h:58
#define ASSERT(a)
Definition: mode.c:44
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: xxhash.c:193
BOOL newStroke
Definition: path.h:57
#define NULL
Definition: types.h:112
BOOL FASTCALL PATH_ReserveEntries(PPATH pPath, INT numEntries)
Definition: path.c:296
FLONG state
Definition: path.h:52

Referenced by PATH_RestorePath(), and PATH_SavePath().

◆ PATH_BezierTo()

static VOID FASTCALL PATH_BezierTo ( PPATH  pPath,
POINT lppt,
INT  n 
)
static

Definition at line 2215 of file path.c.

2219 {
2220  if (n < 2) return;
2221 
2222  if (n == 2)
2223  {
2224  PATH_AddEntry(pPath, &lppt[1], PT_LINETO);
2225  }
2226  else if (n == 3)
2227  {
2228  add_points( pPath, lppt, 3, PT_BEZIERTO );
2229  }
2230  else
2231  {
2232  POINT pt[3];
2233  INT i = 0;
2234 
2235  pt[2] = lppt[0];
2236  n--;
2237 
2238  while (n > 2)
2239  {
2240  pt[0] = pt[2];
2241  pt[1] = lppt[i + 1];
2242  pt[2].x = (lppt[i + 2].x + lppt[i + 1].x) / 2;
2243  pt[2].y = (lppt[i + 2].y + lppt[i + 1].y) / 2;
2244  add_points( pPath, pt, 3, PT_BEZIERTO );
2245  n--;
2246  i++;
2247  }
2248 
2249  pt[0] = pt[2];
2250  pt[1] = lppt[i + 1];
2251  pt[2] = lppt[i + 2];
2252  add_points( pPath, pt, 3, PT_BEZIERTO );
2253  }
2254 }
BOOL FASTCALL PATH_AddEntry(PPATH pPath, const POINT *pPoint, BYTE flags)
Definition: path.c:262
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define pt(x, y)
Definition: drawing.c:79
GLdouble n
Definition: glext.h:7729
int32_t INT
Definition: typedefs.h:58
static BYTE * add_points(PPATH path, const POINT *points, DWORD count, BYTE type)
Definition: path.c:480
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 PT_LINETO
Definition: wingdi.h:885
#define PT_BEZIERTO
Definition: wingdi.h:886

Referenced by PATH_add_outline().

◆ PATH_CheckRect()

static BOOL PATH_CheckRect ( DC dc,
RECTL rect,
INT  x1,
INT  y1,
INT  x2,
INT  y2 
)
static

Definition at line 433 of file path.c.

440 {
441  PDC_ATTR pdcattr = dc->pdcattr;
442 
443  /* Convert points to device coordinates */
444  RECTL_vSetRect(rect, x1, y1, x2, y2);
445  IntLPtoDP(dc, (PPOINT)rect, 2);
446 
447  /* Make sure first corner is top left and second corner is bottom right */
449 
450  /* In GM_COMPATIBLE, don't include bottom and right edges */
451  if (pdcattr->iGraphicsMode == GM_COMPATIBLE)
452  {
453  if (rect->left == rect->right) return FALSE;
454  if (rect->top == rect->bottom) return FALSE;
455  rect->right--;
456  rect->bottom--;
457  }
458  return TRUE;
459 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
#define TRUE
Definition: types.h:120
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
& rect
Definition: startmenu.cpp:1413
#define FALSE
Definition: types.h:117
#define GM_COMPATIBLE
Definition: wingdi.h:864
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
FORCEINLINE VOID RECTL_vSetRect(_Out_ RECTL *prcl, _In_ LONG left, _In_ LONG top, _In_ LONG right, _In_ LONG bottom)
Definition: rect.h:5
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
static const WCHAR dc[]
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
static BOOLEAN IntLPtoDP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:182
INT iGraphicsMode
Definition: ntgdihdl.h:302

Referenced by PATH_Ellipse(), PATH_Rectangle(), and PATH_RoundRect().

◆ PATH_CreatePath()

PPATH FASTCALL PATH_CreatePath ( int  count)

Definition at line 35 of file path.c.

36 {
38 
39  if (!pPath)
40  {
42  return NULL;
43  }
44 
45  TRACE("CreatePath p 0x%p\n", pPath);
46  // Path handles are shared. Also due to recursion with in the same thread.
47  GDIOBJ_vUnlockObject((POBJ)pPath); // Unlock
48  pPath = PATH_LockPath(pPath->BaseObject.hHmgr); // Share Lock.
49 
50  /* Make sure that path is empty */
51  PATH_EmptyPath(pPath);
52 
54 
55  pPath->numEntriesAllocated = count;
56 
58  RtlZeroMemory( pPath->pPoints, count * sizeof(POINT));
59  pPath->pFlags = (BYTE *)ExAllocatePoolWithTag(PagedPool, count * sizeof(BYTE), TAG_PATH);
60  RtlZeroMemory( pPath->pFlags, count * sizeof(BYTE));
61 
62  /* Initialize variables for new path */
63  pPath->numEntriesUsed = 0;
64  pPath->newStroke = TRUE;
65  pPath->state = PATH_Open;
66  pPath->pos.x = pPath->pos.y = 0;
67 #if DBG
68  PathCount++;
69  TRACE("Create Path %d\n",PathCount);
70 #endif
71  return pPath;
72 }
int numEntriesAllocated
Definition: path.h:56
#define max(a, b)
Definition: svc.c:63
VOID FASTCALL PATH_EmptyPath(PPATH pPath)
Definition: path.c:246
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei count
Definition: gl.h:1545
Definition: path.h:34
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define PATH_LockPath(hPath)
Definition: path.h:70
#define TAG_PATH
Definition: tags.h:25
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
POINT * pPoints
Definition: path.h:53
int numEntriesUsed
Definition: path.h:55
BYTE * pFlags
Definition: path.h:54
POINT pos
Definition: path.h:58
#define TRACE(s)
Definition: solgame.cpp:4
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
VOID NTAPI GDIOBJ_vUnlockObject(POBJ pobj)
Definition: gdiobj.c:880
unsigned char BYTE
Definition: xxhash.c:193
Definition: path.h:19
BOOL newStroke
Definition: path.h:57
#define NULL
Definition: types.h:112
#define NUM_ENTRIES_INITIAL
Definition: path.c:21
#define PATH_AllocPathWithHandle()
Definition: path.h:69
BASEOBJECT BaseObject
Definition: path.h:36
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
FLONG state
Definition: path.h:52
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by IntGdiLineTo(), IntGdiPolygon(), IntGdiPolyline(), IntGdiWidenPath(), IntRectangle(), NtGdiBeginPath(), PATH_FlattenPath(), PATH_RestorePath(), and PATH_SavePath().

◆ PATH_Delete()

BOOL FASTCALL PATH_Delete ( HPATH  hPath)

Definition at line 90 of file path.c.

91 {
92  PPATH pPath;
93  if (!hPath) return FALSE;
94  pPath = PATH_LockPath(hPath);
95  if (!pPath) return FALSE;
96  PATH_DestroyGdiPath(pPath);
98 #if DBG
99  PathCount--;
100  TRACE("Delete Path %d\n",PathCount);
101 #endif
102  return TRUE;
103 }
#define TRUE
Definition: types.h:120
Definition: path.h:34
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
VOID NTAPI GDIOBJ_vDeleteObject(POBJ pobj)
Definition: gdiobj.c:1111
VOID FASTCALL PATH_DestroyGdiPath(PPATH pPath)
Definition: path.c:80
BASEOBJECT BaseObject
Definition: path.h:36

Referenced by DC_vCleanup(), IntGdiCleanDC(), IntGdiLineTo(), IntGdiPolygon(), IntGdiPolyline(), IntGdiWidenPath(), IntRectangle(), NtGdiAbortPath(), NtGdiBeginPath(), NtGdiFillPath(), NtGdiFlattenPath(), NtGdiPathToRegion(), NtGdiSelectClipPath(), NtGdiStrokeAndFillPath(), NtGdiStrokePath(), NtGdiWidenPath(), PATH_FlattenPath(), and PATH_StrokePath().

◆ PATH_DestroyGdiPath()

VOID FASTCALL PATH_DestroyGdiPath ( PPATH  pPath)

Definition at line 80 of file path.c.

81 {
82  ASSERT(pPath != NULL);
83 
84  if (pPath->pPoints) ExFreePoolWithTag(pPath->pPoints, TAG_PATH);
85  if (pPath->pFlags) ExFreePoolWithTag(pPath->pFlags, TAG_PATH);
86 }
#define TAG_PATH
Definition: tags.h:25
POINT * pPoints
Definition: path.h:53
BYTE * pFlags
Definition: path.h:54
#define ASSERT(a)
Definition: mode.c:44
#define NULL
Definition: types.h:112
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

Referenced by IntGdiWidenPath(), and PATH_Delete().

◆ PATH_DoArcPart()

static BOOL PATH_DoArcPart ( PPATH  pPath,
POINT  corners[],
double  angleStart,
double  angleEnd,
BYTE  startEntryType 
)
static

Definition at line 890 of file path.c.

896 {
897  double halfAngle, a;
898  float xNorm[4], yNorm[4];
899  POINT points[4];
900  BYTE *type;
901  int i, start;
902 
903  ASSERT(fabs(angleEnd - angleStart) <= M_PI_2);
904 
905  /* FIXME: Is there an easier way of computing this? */
906 
907  /* Compute control points */
908  halfAngle = (angleEnd - angleStart) / 2.0;
909  if (fabs(halfAngle) > 1e-8)
910  {
911  a = 4.0 / 3.0 * (1 - cos(halfAngle)) / sin(halfAngle);
912  xNorm[0] = cos(angleStart);
913  yNorm[0] = sin(angleStart);
914  xNorm[1] = xNorm[0] - a * yNorm[0];
915  yNorm[1] = yNorm[0] + a * xNorm[0];
916  xNorm[3] = cos(angleEnd);
917  yNorm[3] = sin(angleEnd);
918  xNorm[2] = xNorm[3] + a * yNorm[3];
919  yNorm[2] = yNorm[3] - a * xNorm[3];
920  }
921  else
922  for (i = 0; i < 4; i++)
923  {
924  xNorm[i] = cos(angleStart);
925  yNorm[i] = sin(angleStart);
926  }
927 
928  /* Add starting point to path if desired */
929  start = !startEntryType;
930 
931  /* Add remaining control points */
932  for (i = start; i < 4; i++)
933  {
934  if (!PATH_ScaleNormalizedPoint(corners, *(FLOATL*)&xNorm[i], *(FLOATL*)&yNorm[i], &points[i]))
935  return FALSE;
936  }
937  if (!(type = add_points( pPath, points + start, 4 - start, PT_BEZIERTO ))) return FALSE;
938  if (!start) type[0] = startEntryType;
939 
940  return TRUE;
941 }
static BOOLEAN PATH_ScaleNormalizedPoint(POINT corners[], FLOATL x, FLOATL y, POINT *pPoint)
Definition: path.c:363
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define a
Definition: ke_i.h:78
#define e
Definition: ke_i.h:82
_STLP_DECLSPEC complex< float > _STLP_CALL cos(const complex< float > &)
static BYTE * add_points(PPATH path, const POINT *points, DWORD count, BYTE type)
Definition: path.c:480
#define ASSERT(a)
Definition: mode.c:44
GLsizei const GLfloat * points
Definition: glext.h:8112
#define M_PI_2
Definition: port.h:185
unsigned char BYTE
Definition: xxhash.c:193
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
Definition: fabs.c:17
FLOAT FLOATL
Definition: winddi.h:114
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
GLuint start
Definition: gl.h:1545
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define PT_BEZIERTO
Definition: wingdi.h:886

Referenced by IntGdiWidenPath(), and PATH_Arc().

◆ PATH_Ellipse()

BOOL PATH_Ellipse ( PDC  dc,
INT  x1,
INT  y1,
INT  x2,
INT  y2 
)

Definition at line 782 of file path.c.

788 {
789  PPATH pPath;
790  POINT points[13];
791  RECTL rect;
792  BYTE *type;
793  LONG xRadius, yRadius, xOffset, yOffset;
795 
796  TRACE("PATH_Ellipse: %p -> (%d, %d) - (%d, %d)\n",
797  dc, x1, y1, x2, y2);
798 
799  if (!PATH_CheckRect(dc, &rect, x1, y1, x2, y2))
800  {
801  return TRUE;
802  }
803 
804  xRadius = RECTL_lGetWidth(&rect) / 2;
805  yRadius = RECTL_lGetHeight(&rect) / 2;
806 
807  /* Get the four points which box our ellipse */
808  left.x = rect.left; left.y = rect.top + yRadius;
809  top.x = rect.left + xRadius; top.y = rect.top;
810  right.x = rect.right; right.y = rect.bottom - yRadius;
811  bottom.x = rect.right - xRadius; bottom.y = rect.bottom;
812 
813  /*
814  * See here to understand what's happening
815  * https://stackoverflow.com/questions/1734745/how-to-create-circle-with-b%C3%A9zier-curves
816  */
817  xOffset = EngMulDiv(RECTL_lGetWidth(&rect), 55428475, 200000000); /* w * 0.55428475 / 2 */
818  yOffset = EngMulDiv(RECTL_lGetHeight(&rect), 55428475, 200000000); /* h * 0.55428475 / 2 */
819  TRACE("xOffset %d, yOffset %d, Rect WxH: %dx%d.\n",
821 
822  pPath = PATH_LockPath(dc->dclevel.hPath);
823  if (!pPath)
824  return FALSE;
825 
826  /* Starting point: Right */
827  points[0] = right;
828 
829  /* first curve - going up, left */
830  points[1] = right;
831  points[1].y -= yOffset;
832  points[2] = top;
833  points[2].x += xOffset;
834 
835  /* top */
836  points[3] = top;
837 
838  /* second curve - going left, down*/
839  points[4] = top;
840  points[4].x -= xOffset;
841  points[5] = left;
842  points[5].y -= yOffset;
843 
844  /* Left */
845  points[6] = left;
846 
847  /* Third curve - going down, right */
848  points[7] = left;
849  points[7].y += yOffset;
850  points[8] = bottom;
851  points[8].x -= xOffset;
852 
853  /* bottom */
854  points[9] = bottom;
855 
856  /* Fourth curve - Going right, up */
857  points[10] = bottom;
858  points[10].x += xOffset;
859  points[11] = right;
860  points[11].y += yOffset;
861 
862  /* Back to starting point */
863  points[12] = right;
864 
865  if (dc->dclevel.flPath & DCPATH_CLOCKWISE) reverse_points( points, 13 );
866  if (!(type = add_points( pPath, points, 13, PT_BEZIERTO )))
867  {
868  ERR("PATH_Ellipse No add\n");
869  PATH_UnlockPath(pPath);
870  return FALSE;
871  }
872  type[0] = PT_MOVETO;
873 
874  IntGdiCloseFigure(pPath);
875  PATH_UnlockPath(pPath);
876  return TRUE;
877 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
#define TRUE
Definition: types.h:120
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
Definition: path.h:34
static void reverse_points(POINT *points, UINT count)
Definition: path.c:494
& rect
Definition: startmenu.cpp:1413
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
VOID FASTCALL IntGdiCloseFigure(PPATH pPath)
Definition: path.c:108
GLint GLint bottom
Definition: glext.h:7726
FORCEINLINE LONG RECTL_lGetWidth(_In_ const RECTL *prcl)
Definition: rect.h:93
#define PATH_UnlockPath(pPath)
Definition: path.h:71
static BYTE * add_points(PPATH path, const POINT *points, DWORD count, BYTE type)
Definition: path.c:480
#define TRACE(s)
Definition: solgame.cpp:4
GLint left
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
GLsizei const GLfloat * points
Definition: glext.h:8112
static BOOL PATH_CheckRect(DC *dc, RECTL *rect, INT x1, INT y1, INT x2, INT y2)
Definition: path.c:433
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
unsigned char BYTE
Definition: xxhash.c:193
#define ERR(fmt,...)
Definition: debug.h:110
int xOffset
Definition: appswitch.c:59
ENGAPI INT APIENTRY EngMulDiv(_In_ INT a, _In_ INT b, _In_ INT c)
Definition: math.c:26
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
FORCEINLINE LONG RECTL_lGetHeight(_In_ const RECTL *prcl)
Definition: rect.h:86
#define PT_MOVETO
Definition: wingdi.h:884
static const WCHAR dc[]
int yOffset
Definition: appswitch.c:59
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define PT_BEZIERTO
Definition: wingdi.h:886

Referenced by NtGdiEllipse().

◆ PATH_EmptyPath()

VOID FASTCALL PATH_EmptyPath ( PPATH  pPath)

Definition at line 246 of file path.c.

247 {
248  ASSERT(pPath != NULL);
249 
250  pPath->state = PATH_Null;
251  pPath->numEntriesUsed = 0;
252 }
Definition: path.h:18
int numEntriesUsed
Definition: path.h:55
#define ASSERT(a)
Definition: mode.c:44
#define NULL
Definition: types.h:112
FLONG state
Definition: path.h:52

Referenced by PATH_CreatePath().

◆ PATH_ExtTextOut()

BOOL FASTCALL PATH_ExtTextOut ( PDC  dc,
INT  x,
INT  y,
UINT  flags,
const RECTL lprc,
LPCWSTR  str,
UINT  count,
const INT dx 
)

Definition at line 2356 of file path.c.

2365 {
2366  PPATH pPath;
2367  unsigned int idx, ggo_flags = GGO_NATIVE;
2368  POINT offset = {0, 0};
2369 
2370  pPath = PATH_LockPath(dc->dclevel.hPath);
2371  if (!pPath)
2372  {
2373  return FALSE;
2374  }
2375 
2376  if (pPath->state != PATH_Open)
2377  {
2378  ERR("PATH_ExtTextOut not open\n");
2379  return FALSE;
2380  }
2381 
2382  if (!count) return TRUE;
2383  if (flags & ETO_GLYPH_INDEX) ggo_flags |= GGO_GLYPH_INDEX;
2384 
2385  for (idx = 0; idx < count; idx++)
2386  {
2387  MAT2 identity = { {0, 1}, {0, 0}, {0, 0}, {0, 1} };
2388  GLYPHMETRICS gm;
2389  DWORD dwSize;
2390  void *outline;
2391 
2393  str[idx],
2394  ggo_flags,
2395  &gm,
2396  0,
2397  NULL,
2398  &identity,
2399  TRUE);
2400  if (dwSize == GDI_ERROR)
2401  {
2402  // With default DC font,,, bitmap font?
2403  // ExtTextOut on a path with bitmap font selected shouldn't fail.
2404  // This just leads to empty path generated.
2405  // Ref : test_emf_ExtTextOut_on_path
2406  continue;
2407  }
2408 
2409  /* Add outline only if char is printable */
2410  if (dwSize)
2411  {
2413  if (!outline)
2414  {
2415  PATH_UnlockPath(pPath);
2416  return FALSE;
2417  }
2418 
2420  str[idx],
2421  ggo_flags,
2422  &gm,
2423  dwSize,
2424  outline,
2425  &identity,
2426  TRUE);
2427 
2428  PATH_add_outline(dc, pPath, x + offset.x, y + offset.y, outline, dwSize);
2429 
2431  }
2432 
2433  if (dx)
2434  {
2435  if (flags & ETO_PDY)
2436  {
2437  offset.x += dx[idx * 2];
2438  offset.y += dx[idx * 2 + 1];
2439  }
2440  else
2441  offset.x += dx[idx];
2442  }
2443  else
2444  {
2445  offset.x += gm.gmCellIncX;
2446  offset.y += gm.gmCellIncY;
2447  }
2448  }
2449  PATH_UnlockPath(pPath);
2450  return TRUE;
2451 }
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei count
Definition: gl.h:1545
Definition: path.h:34
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
short gmCellIncY
Definition: wingdi.h:2446
Definition: wingdi.h:2472
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
unsigned int idx
Definition: utils.c:41
#define TAG_PATH
Definition: tags.h:25
const WCHAR * str
#define GGO_NATIVE
Definition: wingdi.h:850
#define PATH_UnlockPath(pPath)
Definition: path.h:71
GLintptr offset
Definition: glext.h:5920
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define GGO_GLYPH_INDEX
Definition: wingdi.h:855
Definition: mesh.c:5329
short gmCellIncX
Definition: wingdi.h:2445
#define ERR(fmt,...)
Definition: debug.h:110
static BOOL FASTCALL PATH_add_outline(PDC dc, PPATH pPath, INT x, INT y, TTPOLYGONHEADER *header, DWORD size)
Definition: path.c:2259
Definition: path.h:19
ULONG FASTCALL ftGdiGetGlyphOutline(PDC dc, WCHAR wch, UINT iFormat, LPGLYPHMETRICS pgm, ULONG cjBuf, PVOID pvBuf, LPMAT2 pmat2, BOOL bIgnoreRotation)
Definition: freetype.c:3761
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97
#define ETO_PDY
Definition: wingdi.h:657
static const WCHAR dc[]
FLONG state
Definition: path.h:52
#define GDI_ERROR
Definition: wingdi.h:1309
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56

Referenced by IntExtTextOutW().

◆ PATH_FillPath()

BOOL FASTCALL PATH_FillPath ( PDC  dc,
PPATH  pPath 
)

Definition at line 1506 of file path.c.

1509 {
1510  return PATH_FillPathEx(dc, pPath, NULL);
1511 }
BOOL FASTCALL PATH_FillPathEx(PDC dc, PPATH pPath, PBRUSH pbrFill)
Definition: path.c:1515
#define NULL
Definition: types.h:112
static const WCHAR dc[]

Referenced by NtGdiFillPath(), and NtGdiStrokeAndFillPath().

◆ PATH_FillPathEx()

BOOL FASTCALL PATH_FillPathEx ( PDC  dc,
PPATH  pPath,
PBRUSH  pbrFill 
)

Definition at line 1515 of file path.c.

1519 {
1520  INT mapMode, graphicsMode;
1521  SIZE ptViewportExt, ptWindowExt;
1522  POINTL ptViewportOrg, ptWindowOrg;
1523  XFORML xform;
1524  PREGION Rgn;
1525  PDC_ATTR pdcattr = dc->pdcattr;
1526 
1527  /* Allocate a temporary region */
1528  Rgn = IntSysCreateRectpRgn(0, 0, 0, 0);
1529  if (!Rgn)
1530  {
1532  return FALSE;
1533  }
1534 
1535  if (!PATH_PathToRegion(pPath, pdcattr->jFillMode, Rgn))
1536  {
1537  TRACE("PFP : Fail P2R\n");
1538  /* EngSetLastError ? */
1539  REGION_Delete(Rgn);
1540  return FALSE;
1541  }
1542 
1543  /* Since PaintRgn interprets the region as being in logical coordinates
1544  * but the points we store for the path are already in device
1545  * coordinates, we have to set the mapping mode to MM_TEXT temporarily.
1546  * Using SaveDC to save information about the mapping mode / world
1547  * transform would be easier but would require more overhead, especially
1548  * now that SaveDC saves the current path.
1549  */
1550 
1551  /* Save the information about the old mapping mode */
1552  mapMode = pdcattr->iMapMode;
1553  ptViewportExt = pdcattr->szlViewportExt;
1554  ptViewportOrg = pdcattr->ptlViewportOrg;
1555  ptWindowExt = pdcattr->szlWindowExt;
1556  ptWindowOrg = pdcattr->ptlWindowOrg;
1557 
1558  /* Save world transform
1559  * NB: The Windows documentation on world transforms would lead one to
1560  * believe that this has to be done only in GM_ADVANCED; however, my
1561  * tests show that resetting the graphics mode to GM_COMPATIBLE does
1562  * not reset the world transform.
1563  */
1564  MatrixS2XForm(&xform, &dc->pdcattr->mxWorldToPage);
1565 
1566  /* Set MM_TEXT */
1568  pdcattr->ptlViewportOrg.x = 0;
1569  pdcattr->ptlViewportOrg.y = 0;
1570  pdcattr->ptlWindowOrg.x = 0;
1571  pdcattr->ptlWindowOrg.y = 0;
1572 
1573  graphicsMode = pdcattr->iGraphicsMode;
1574  pdcattr->iGraphicsMode = GM_ADVANCED;
1576  pdcattr->iGraphicsMode = graphicsMode;
1577 
1578  /* Paint the region */
1579  IntGdiFillRgn(dc, Rgn, pbrFill);
1580  REGION_Delete(Rgn);
1581  /* Restore the old mapping mode */
1582  IntGdiSetMapMode(dc, mapMode);
1583  pdcattr->szlViewportExt = ptViewportExt;
1584  pdcattr->ptlViewportOrg = ptViewportOrg;
1585  pdcattr->szlWindowExt = ptWindowExt;
1586  pdcattr->ptlWindowOrg = ptWindowOrg;
1587 
1588  /* Go to GM_ADVANCED temporarily to restore the world transform */
1589  graphicsMode = pdcattr->iGraphicsMode;
1590  pdcattr->iGraphicsMode = GM_ADVANCED;
1592  pdcattr->iGraphicsMode = graphicsMode;
1593  return TRUE;
1594 }
BOOL NTAPI GreModifyWorldTransform(PDC pdc, const XFORML *pxform, DWORD dwMode)
Definition: coord.c:461
int APIENTRY IntGdiSetMapMode(PDC dc, int MapMode)
Definition: coord.c:828
POINTL ptlViewportOrg
Definition: ntgdihdl.h:339
#define MWT_SET
Definition: ntgdityp.h:180
#define TRUE
Definition: types.h:120
INT iMapMode
Definition: ntgdihdl.h:334
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
int32_t INT
Definition: typedefs.h:58
LONG y
Definition: windef.h:330
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2426
#define FALSE
Definition: types.h:117
BOOL FASTCALL PATH_PathToRegion(PPATH pPath, INT Mode, PREGION Rgn)
Definition: path.c:1451
Definition: region.h:7
#define TRACE(s)
Definition: solgame.cpp:4
LONG x
Definition: windef.h:329
BYTE jFillMode
Definition: ntgdihdl.h:305
#define MatrixS2XForm(x, m)
Definition: coord.h:200
SIZEL szlWindowExt
Definition: ntgdihdl.h:338
BOOL IntGdiFillRgn(_In_ PDC pdc, _In_ PREGION prgn, _In_opt_ PBRUSH pbrFill)
Definition: bitblt.c:1186
#define MWT_IDENTITY
Definition: wingdi.h:944
#define MM_TEXT
Definition: wingdi.h:873
SIZEL szlViewportExt
Definition: ntgdihdl.h:340
static const WCHAR dc[]
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2468
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
POINTL ptlWindowOrg
Definition: ntgdihdl.h:337
#define GM_ADVANCED
Definition: wingdi.h:865
INT iGraphicsMode
Definition: ntgdihdl.h:302

Referenced by PATH_FillPath(), and PATH_StrokePath().

◆ PATH_FlattenPath()

PPATH FASTCALL PATH_FlattenPath ( PPATH  pPath)

Definition at line 1407 of file path.c.

1408 {
1409  PPATH newPath;
1410  INT srcpt;
1411  TRACE("PATH_FlattenPath\n");
1412  if (!(newPath = PATH_CreatePath(pPath->numEntriesUsed))) return NULL;
1413 
1414  for (srcpt = 0; srcpt < pPath->numEntriesUsed; srcpt++)
1415  {
1416  switch(pPath->pFlags[srcpt] & ~PT_CLOSEFIGURE)
1417  {
1418  case PT_MOVETO:
1419  case PT_LINETO:
1420  if (!PATH_AddEntry(newPath, &pPath->pPoints[srcpt], pPath->pFlags[srcpt]))
1421  {
1422  PATH_UnlockPath(newPath);
1423  PATH_Delete(newPath->BaseObject.hHmgr);
1424  return NULL;
1425  }
1426  break;
1427  case PT_BEZIERTO:
1428  if(!PATH_AddFlatBezier(newPath, &pPath->pPoints[srcpt - 1], pPath->pFlags[srcpt + 2] & PT_CLOSEFIGURE))
1429  {
1430  PATH_UnlockPath(newPath);
1431  PATH_Delete(newPath->BaseObject.hHmgr);
1432  return NULL;
1433  }
1434  srcpt += 2;
1435  break;
1436  }
1437  }
1438  TRACE("PATH_FlattenPath good\n");
1439  newPath->state = pPath->state;
1440  return newPath;
1441 }
BOOL FASTCALL PATH_AddEntry(PPATH pPath, const POINT *pPoint, BYTE flags)
Definition: path.c:262
PPATH FASTCALL PATH_CreatePath(int count)
Definition: path.c:35
Definition: path.h:34
int32_t INT
Definition: typedefs.h:58
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
POINT * pPoints
Definition: path.h:53
#define PATH_UnlockPath(pPath)
Definition: path.h:71
int numEntriesUsed
Definition: path.h:55
BYTE * pFlags
Definition: path.h:54
#define TRACE(s)
Definition: solgame.cpp:4
#define NULL
Definition: types.h:112
BOOL FASTCALL PATH_AddFlatBezier(PPATH pPath, POINT *pt, BOOL closed)
Definition: path.c:1378
#define PT_CLOSEFIGURE
Definition: wingdi.h:887
#define PT_LINETO
Definition: wingdi.h:885
#define PT_MOVETO
Definition: wingdi.h:884
BASEOBJECT BaseObject
Definition: path.h:36
FLONG state
Definition: path.h:52
#define PT_BEZIERTO
Definition: wingdi.h:886
BOOL FASTCALL PATH_Delete(HPATH hPath)
Definition: path.c:90

Referenced by IntGdiWidenPath(), NtGdiFillPath(), NtGdiFlattenPath(), NtGdiPathToRegion(), NtGdiSelectClipPath(), NtGdiStrokeAndFillPath(), and NtGdiStrokePath().

◆ PATH_InitGdiPath()

VOID FASTCALL PATH_InitGdiPath ( PPATH  pPath)

Definition at line 142 of file path.c.

144 {
145  ASSERT(pPath != NULL);
146 
147  pPath->state = PATH_Null;
148  pPath->pPoints = NULL;
149  pPath->pFlags = NULL;
150  pPath->numEntriesUsed = 0;
151  pPath->numEntriesAllocated = 0;
152 }
int numEntriesAllocated
Definition: path.h:56
Definition: path.h:18
POINT * pPoints
Definition: path.h:53
int numEntriesUsed
Definition: path.h:55
BYTE * pFlags
Definition: path.h:54
#define ASSERT(a)
Definition: mode.c:44
#define NULL
Definition: types.h:112
FLONG state
Definition: path.h:52

Referenced by IntGdiWidenPath().

◆ PATH_LineTo()

BOOL FASTCALL PATH_LineTo ( PDC  dc,
INT  x,
INT  y 
)

Definition at line 583 of file path.c.

587 {
588  BOOL Ret;
589  PPATH pPath;
590  POINT point, pointCurPos;
591 
592  pPath = PATH_LockPath(dc->dclevel.hPath);
593  if (!pPath) return FALSE;
594 
595  point.x = x;
596  point.y = y;
597 
598  // Coalesce a MoveTo point.
599  if ( !PATH_MoveTo(dc, pPath) )
600  {
601  /* Add a PT_MOVETO if necessary */
602  if (pPath->newStroke)
603  {
604  TRACE("Line To : New Stroke\n");
605  pPath->newStroke = FALSE;
606  IntGetCurrentPositionEx(dc, &pointCurPos);
607  CoordLPtoDP(dc, &pointCurPos);
608  if (!PATH_AddEntry(pPath, &pointCurPos, PT_MOVETO))
609  {
610  PATH_UnlockPath(pPath);
611  return FALSE;
612  }
613  }
614  }
615  Ret = add_log_points_new_stroke( dc, pPath, &point, 1, PT_LINETO );
616  PATH_UnlockPath(pPath);
617  return Ret;
618 }
BOOL FASTCALL PATH_AddEntry(PPATH pPath, const POINT *pPoint, BYTE flags)
Definition: path.c:262
BOOL FASTCALL PATH_MoveTo(PDC dc, PPATH pPath)
Definition: path.c:554
Definition: path.h:34
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
POINTL point
Definition: edittest.c:50
#define PATH_LockPath(hPath)
Definition: path.h:70
LONG y
Definition: windef.h:330
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PATH_UnlockPath(pPath)
Definition: path.h:71
VOID FASTCALL IntGetCurrentPositionEx(PDC dc, LPPOINT pt)
Definition: line.c:128
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL add_log_points_new_stroke(DC *dc, PPATH path, const POINT *points, DWORD count, BYTE type)
Definition: path.c:533
LONG x
Definition: windef.h:329
BOOL newStroke
Definition: path.h:57
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define CoordLPtoDP(pdc, ppt)
Definition: coord.h:187
#define PT_LINETO
Definition: wingdi.h:885
#define PT_MOVETO
Definition: wingdi.h:884
static const WCHAR dc[]

Referenced by IntGdiLineTo(), IntGdiPolygon(), IntGdiPolyline(), and IntRectangle().

◆ PATH_MoveTo()

BOOL FASTCALL PATH_MoveTo ( PDC  dc,
PPATH  pPath 
)

Definition at line 554 of file path.c.

557 {
558  if (!pPath) return FALSE;
559 
560  // GDI32 : Signal from user space of a change in position.
561  if (dc->pdcattr->ulDirty_ & DIRTY_STYLESTATE)
562  {
563  TRACE("MoveTo has changed\n");
564  pPath->newStroke = TRUE;
565  // Set position and clear the signal flag.
566  IntGetCurrentPositionEx(dc, &pPath->pos);
567  IntLPtoDP( dc, &pPath->pos, 1 );
568  return TRUE;
569  }
570 
571  return FALSE;
572 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
VOID FASTCALL IntGetCurrentPositionEx(PDC dc, LPPOINT pt)
Definition: line.c:128
#define DIRTY_STYLESTATE
Definition: ntgdihdl.h:133
POINT pos
Definition: path.h:58
#define TRACE(s)
Definition: solgame.cpp:4
BOOL newStroke
Definition: path.h:57
static const WCHAR dc[]
static BOOLEAN IntLPtoDP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:182

Referenced by IntGdiLineTo(), IntGdiPolygon(), IntGdiPolyline(), IntRectangle(), and PATH_LineTo().

◆ PATH_NormalizePoint()

static VOID PATH_NormalizePoint ( POINTL  corners[],
const POINTL pPoint,
FLOATL pX,
FLOATL pY 
)
static

Definition at line 401 of file path.c.

406 {
407  FLOATOBJ tmp;
408 
409  ASSERT(corners);
410  ASSERT(pPoint);
411  ASSERT(pX);
412  ASSERT(pY);
413 
414  /* *pX = (float)(pPoint->x - corners[0].x) / (float)(corners[1].x - corners[0].x) * 2.0 - 1.0; */
415  FLOATOBJ_SetLong(&tmp, (pPoint->x - corners[0].x) * 2);
416  FLOATOBJ_DivLong(&tmp, corners[1].x - corners[0].x);
417  FLOATOBJ_Sub(&tmp, (PFLOATOBJ)&gef1);
418  *pX = FLOATOBJ_GetFloat(&tmp);
419 
420  /* *pY = (float)(pPoint->y - corners[0].y) / (float)(corners[1].y - corners[0].y) * 2.0 - 1.0; */
421  FLOATOBJ_SetLong(&tmp, (pPoint->y - corners[0].y) * 2);
422  FLOATOBJ_DivLong(&tmp, corners[1].y - corners[0].y);
423  FLOATOBJ_Sub(&tmp, (PFLOATOBJ)&gef1);
424  *pY = FLOATOBJ_GetFloat(&tmp);
425 }
#define FLOATOBJ_DivLong(pf, l)
Definition: winddi.h:2829
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG y
Definition: windef.h:330
FLOAT * PFLOATOBJ
Definition: winddi.h:677
static const FLOATOBJ gef1
Definition: floatobj.h:114
#define ASSERT(a)
Definition: mode.c:44
FLOAT FLOATOBJ
Definition: winddi.h:677
LONG x
Definition: windef.h:329
#define FLOATOBJ_GetFloat(pf)
Definition: winddi.h:2816
#define FLOATOBJ_Sub(pf, pf1)
Definition: winddi.h:2821
#define FLOATOBJ_SetLong(pf, l)
Definition: winddi.h:2815
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by PATH_Arc().

◆ PATH_PathToRegion()

BOOL FASTCALL PATH_PathToRegion ( PPATH  pPath,
INT  Mode,
PREGION  Rgn 
)

Definition at line 1451 of file path.c.

1455 {
1456  int i, pos, polygons;
1457  PULONG counts;
1458  int Ret;
1459 
1460  if (!pPath->numEntriesUsed) return FALSE;
1461 
1462  counts = ExAllocatePoolWithTag(PagedPool, (pPath->numEntriesUsed / 2) * sizeof(counts), TAG_PATH);
1463  if (!counts)
1464  {
1465  ERR("Failed to allocate %lu strokes\n", (pPath->numEntriesUsed / 2) * sizeof(*counts));
1467  return FALSE;
1468  }
1469 
1470  pos = polygons = 0;
1471  ASSERT( pPath->pFlags[0] == PT_MOVETO );
1472  for (i = 1; i < pPath->numEntriesUsed; i++)
1473  {
1474  if (pPath->pFlags[i] != PT_MOVETO) continue;
1475  counts[polygons++] = i - pos;
1476  pos = i;
1477  }
1478  if (i > pos + 1) counts[polygons++] = i - pos;
1479 
1480  ASSERT( polygons <= pPath->numEntriesUsed / 2 );
1481 
1482  /* Fill the region with the strokes */
1483  Ret = REGION_SetPolyPolygonRgn(Rgn,
1484  pPath->pPoints,
1485  counts,
1486  polygons,
1487  Mode);
1488  if (!Ret)
1489  {
1490  ERR("REGION_SetPolyPolygonRgn failed\n");
1491  }
1492 
1493  ExFreePoolWithTag(counts, TAG_PATH);
1494 
1495  /* Success! */
1496  return Ret;
1497 }
BOOL FASTCALL REGION_SetPolyPolygonRgn(_Inout_ PREGION prgn, _In_ const POINT *ppt, _In_ const ULONG *pcPoints, _In_ ULONG cPolygons, _In_ INT iMode)
Definition: region.c:3275
_In_ ULONG Mode
Definition: hubbusif.h:303
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define FALSE
Definition: types.h:117
#define TAG_PATH
Definition: tags.h:25
POINT * pPoints
Definition: path.h:53
int numEntriesUsed
Definition: path.h:55
BYTE * pFlags
Definition: path.h:54
#define ASSERT(a)
Definition: mode.c:44
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define ERR(fmt,...)
Definition: debug.h:110
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 * PULONG
Definition: retypes.h:1
#define PT_MOVETO
Definition: wingdi.h:884
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by NtGdiPathToRegion(), NtGdiSelectClipPath(), and PATH_FillPathEx().

◆ PATH_PolyBezier()

BOOL FASTCALL PATH_PolyBezier ( PDC  dc,
const POINT pts,
DWORD  cbPoints 
)

Definition at line 1154 of file path.c.

1158 {
1159  PPATH pPath;
1160  BYTE *type;
1161 
1162  ASSERT(dc);
1163  ASSERT(pts);
1164  ASSERT(cbPoints);
1165 
1166  pPath = PATH_LockPath(dc->dclevel.hPath);
1167  if (!pPath) return FALSE;
1168 
1169  type = add_log_points( dc, pPath, pts, cbPoints, PT_BEZIERTO );
1170  if (!type) return FALSE;
1171 
1172  type[0] = PT_MOVETO;
1173 
1174  PATH_UnlockPath(pPath);
1175  return TRUE;
1176 }
#define TRUE
Definition: types.h:120
Definition: path.h:34
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
#define PATH_UnlockPath(pPath)
Definition: path.h:71
#define ASSERT(a)
Definition: mode.c:44
unsigned char BYTE
Definition: xxhash.c:193
#define PT_MOVETO
Definition: wingdi.h:884
static const WCHAR dc[]
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define PT_BEZIERTO
Definition: wingdi.h:886
static BYTE * add_log_points(DC *dc, PPATH path, const POINT *points, DWORD count, BYTE type)
Definition: path.c:463

Referenced by IntGdiPolyBezier().

◆ PATH_PolyBezierTo()

BOOL FASTCALL PATH_PolyBezierTo ( PDC  dc,
const POINT pts,
DWORD  cbPoints 
)

Definition at line 1131 of file path.c.

1135 {
1136  PPATH pPath;
1137  BOOL ret;
1138 
1139  ASSERT(dc);
1140  ASSERT(pts);
1141  ASSERT(cbPoints);
1142 
1143  pPath = PATH_LockPath(dc->dclevel.hPath);
1144  if (!pPath) return FALSE;
1145 
1146  ret = add_log_points_new_stroke( dc, pPath, pts, cbPoints, PT_BEZIERTO );
1147 
1148  PATH_UnlockPath(pPath);
1149  return ret;
1150 }
Definition: path.h:34
DWORD ret
Definition: path.c:47
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PATH_UnlockPath(pPath)
Definition: path.h:71
#define ASSERT(a)
Definition: mode.c:44
static BOOL add_log_points_new_stroke(DC *dc, PPATH path, const POINT *points, DWORD count, BYTE type)
Definition: path.c:533
static const WCHAR dc[]
#define PT_BEZIERTO
Definition: wingdi.h:886

Referenced by IntGdiPolyBezierTo().

◆ PATH_PolyDraw()

BOOL FASTCALL PATH_PolyDraw ( PDC  dc,
const POINT pts,
const BYTE types,
DWORD  cbPoints 
)

Definition at line 1180 of file path.c.

1185 {
1186  PPATH pPath;
1187  POINT orig_pos, cur_pos;
1188  ULONG i, lastmove = 0;
1189 
1190  pPath = PATH_LockPath(dc->dclevel.hPath);
1191  if (!pPath) return FALSE;
1192 
1193  if (pPath->state != PATH_Open)
1194  {
1195  PATH_UnlockPath(pPath);
1196  return FALSE;
1197  }
1198 
1199  for (i = 0; i < pPath->numEntriesUsed; i++) if (pPath->pFlags[i] == PT_MOVETO) lastmove = i;
1200  orig_pos = pPath->pos;
1201 
1202  IntGetCurrentPositionEx(dc, &cur_pos);
1203 
1204  TRACE("PPD : Current pos X %d Y %d\n",pPath->pos.x, pPath->pos.y);
1205  TRACE("PPD : last %d pos X %d Y %d\n",lastmove, pPath->pPoints[lastmove].x, pPath->pPoints[lastmove].y);
1206 
1207 
1208  for(i = 0; i < cbPoints; i++)
1209  {
1210  switch (types[i])
1211  {
1212  case PT_MOVETO:
1213  pPath->newStroke = TRUE;
1214  pPath->pos = pts[i];
1215  IntLPtoDP( dc, &pPath->pos, 1);
1216  lastmove = pPath->numEntriesUsed;
1217  break;
1218  case PT_LINETO:
1219  case PT_LINETO | PT_CLOSEFIGURE:
1220  if (!add_log_points_new_stroke( dc, pPath, &pts[i], 1, PT_LINETO ))
1221  {
1222  PATH_UnlockPath(pPath);
1223  return FALSE;
1224  }
1225  break;
1226  case PT_BEZIERTO:
1227  if ((i + 2 < cbPoints) && (types[i + 1] == PT_BEZIERTO) &&
1228  (types[i + 2] & ~PT_CLOSEFIGURE) == PT_BEZIERTO)
1229  {
1230  if (!add_log_points_new_stroke( dc, pPath, &pts[i], 3, PT_BEZIERTO ))
1231  {
1232  PATH_UnlockPath(pPath);
1233  return FALSE;
1234  }
1235  i += 2;
1236  break;
1237  }
1238  /* fall through */
1239  default:
1240  /* restore original position */
1241  pPath->pos = orig_pos;
1242 
1243  TRACE("PPD Bad : pos X %d Y %d\n",pPath->pos.x, pPath->pos.y);
1244 
1245  IntGdiMoveToEx(dc, cur_pos.x, cur_pos.y, NULL);
1246 
1247  PATH_UnlockPath(pPath);
1248  return FALSE;
1249  }
1250 
1251  if (types[i] & PT_CLOSEFIGURE)
1252  {
1253  close_figure( pPath );
1254  pPath->pos = pPath->pPoints[lastmove];
1255  TRACE("PPD close : pos X %d Y %d\n",pPath->pos.x, pPath->pos.y);
1256  }
1257  }
1258  PATH_UnlockPath(pPath);
1259  return TRUE;
1260 }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
Definition: path.h:34
#define PATH_LockPath(hPath)
Definition: path.h:70
static void close_figure(PPATH path)
Definition: path.c:526
#define FALSE
Definition: types.h:117
POINT * pPoints
Definition: path.h:53
#define PATH_UnlockPath(pPath)
Definition: path.h:71
int numEntriesUsed
Definition: path.h:55
BYTE * pFlags
Definition: path.h:54
VOID FASTCALL IntGetCurrentPositionEx(PDC dc, LPPOINT pt)
Definition: line.c:128
POINT pos
Definition: path.h:58
#define TRACE(s)
Definition: solgame.cpp:4
Definition: cmds.c:130
static BOOL add_log_points_new_stroke(DC *dc, PPATH path, const POINT *points, DWORD count, BYTE type)
Definition: path.c:533
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
Definition: path.h:19
BOOL newStroke
Definition: path.h:57
#define NULL
Definition: types.h:112
#define PT_CLOSEFIGURE
Definition: wingdi.h:887
#define PT_LINETO
Definition: wingdi.h:885
#define PT_MOVETO
Definition: wingdi.h:884
unsigned int ULONG
Definition: retypes.h:1
BOOL FASTCALL IntGdiMoveToEx(DC *dc, int X, int Y, LPPOINT Point)
Definition: line.c:78
static const WCHAR dc[]
FLONG state
Definition: path.h:52
#define PT_BEZIERTO
Definition: wingdi.h:886
static BOOLEAN IntLPtoDP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:182

Referenced by NtGdiPolyDraw().

◆ PATH_PolylineTo()

BOOL FASTCALL PATH_PolylineTo ( PDC  dc,
const POINT pts,
DWORD  cbPoints 
)

Definition at line 1264 of file path.c.

1268 {
1269  PPATH pPath;
1270  BOOL ret;
1271 
1272  ASSERT(dc);
1273  ASSERT(pts);
1274  ASSERT(cbPoints);
1275 
1276  if (cbPoints < 1) return FALSE;
1277 
1278  pPath = PATH_LockPath(dc->dclevel.hPath);
1279  if (!pPath) return FALSE;
1280 
1281  ret = add_log_points_new_stroke( dc, pPath, pts, cbPoints, PT_LINETO );
1282  PATH_UnlockPath(pPath);
1283  return ret;
1284 }
Definition: path.h:34
DWORD ret
Definition: path.c:47
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PATH_UnlockPath(pPath)
Definition: path.h:71
#define ASSERT(a)
Definition: mode.c:44
static BOOL add_log_points_new_stroke(DC *dc, PPATH path, const POINT *points, DWORD count, BYTE type)
Definition: path.c:533
#define PT_LINETO
Definition: wingdi.h:885
static const WCHAR dc[]

Referenced by IntGdiPolylineTo().

◆ PATH_PolyPolygon()

BOOL FASTCALL PATH_PolyPolygon ( PDC  dc,
const POINT pts,
const INT counts,
UINT  polygons 
)

Definition at line 1288 of file path.c.

1293 {
1294  UINT poly, count;
1295  BYTE *type;
1296  PPATH pPath;
1297 
1298  ASSERT(dc);
1299  ASSERT(pts);
1300  ASSERT(counts);
1301  ASSERT(polygons);
1302 
1303  if (!polygons) return FALSE;
1304 
1305  pPath = PATH_LockPath(dc->dclevel.hPath);
1306  if (!pPath) return FALSE;
1307 
1308 
1309  for (poly = count = 0; poly < polygons; poly++)
1310  {
1311  if (counts[poly] < 2)
1312  {
1313  PATH_UnlockPath(pPath);
1314  return FALSE;
1315  }
1316  count += counts[poly];
1317  }
1318 
1319  type = add_log_points( dc, pPath, pts, count, PT_LINETO );
1320  if (!type)
1321  {
1322  PATH_UnlockPath(pPath);
1323  return FALSE;
1324  }
1325 
1326  /* make the first point of each polyline a PT_MOVETO, and close the last one */
1327  for (poly = 0; poly < polygons; type += counts[poly++])
1328  {
1329  type[0] = PT_MOVETO;
1330  type[counts[poly] - 1] = PT_LINETO | PT_CLOSEFIGURE;
1331  }
1332  PATH_UnlockPath(pPath);
1333  return TRUE;
1334 }
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei count
Definition: gl.h:1545
Definition: path.h:34
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
#define PATH_UnlockPath(pPath)
Definition: path.h:71
#define ASSERT(a)
Definition: mode.c:44
unsigned char BYTE
Definition: xxhash.c:193
unsigned int UINT
Definition: ndis.h:50
#define PT_CLOSEFIGURE
Definition: wingdi.h:887
#define PT_LINETO
Definition: wingdi.h:885
#define PT_MOVETO
Definition: wingdi.h:884
static const WCHAR dc[]
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static BYTE * add_log_points(DC *dc, PPATH path, const POINT *points, DWORD count, BYTE type)
Definition: path.c:463

Referenced by IntGdiPolyPolygon().

◆ PATH_PolyPolyline()

BOOL FASTCALL PATH_PolyPolyline ( PDC  dc,
const POINT pts,
const DWORD counts,
DWORD  polylines 
)

Definition at line 1338 of file path.c.

1343 {
1344  POINT pt;
1345  ULONG poly, point, i;
1346  PPATH pPath;
1347 
1348  ASSERT(dc);
1349  ASSERT(pts);
1350  ASSERT(counts);
1351  ASSERT(polylines);
1352 
1353  pPath = PATH_LockPath(dc->dclevel.hPath);
1354  if (!pPath)
1355  {
1356  return FALSE;
1357  }
1358 
1359  for (i = 0, poly = 0; poly < polylines; poly++)
1360  {
1361  for (point = 0; point < counts[poly]; point++, i++)
1362  {
1363  pt = pts[i];
1364  CoordLPtoDP(dc, &pt);
1365  PATH_AddEntry(pPath, &pt, (point == 0) ? PT_MOVETO : PT_LINETO);
1366  }
1367  }
1368  TRACE("PATH_PolyPolyline end count %d\n",pPath->numEntriesUsed);
1369  PATH_UnlockPath(pPath);
1370  return TRUE;
1371 }
BOOL FASTCALL PATH_AddEntry(PPATH pPath, const POINT *pPoint, BYTE flags)
Definition: path.c:262
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
Definition: path.h:34
POINTL point
Definition: edittest.c:50
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
#define PATH_UnlockPath(pPath)
Definition: path.h:71
int numEntriesUsed
Definition: path.h:55
#define TRACE(s)
Definition: solgame.cpp:4
#define ASSERT(a)
Definition: mode.c:44
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 CoordLPtoDP(pdc, ppt)
Definition: coord.h:187
#define PT_LINETO
Definition: wingdi.h:885
#define PT_MOVETO
Definition: wingdi.h:884
unsigned int ULONG
Definition: retypes.h:1
static const WCHAR dc[]

Referenced by IntGdiPolyPolyline().

◆ PATH_Rectangle()

BOOL FASTCALL PATH_Rectangle ( PDC  dc,
INT  x1,
INT  y1,
INT  x2,
INT  y2 
)

Definition at line 627 of file path.c.

633 {
634  PPATH pPath;
635  RECTL rect;
636  POINTL points[4];
637  BYTE *type;
638 
639  pPath = PATH_LockPath(dc->dclevel.hPath);
640  if (!pPath) return FALSE;
641 
642  if (!PATH_CheckRect(dc, &rect, x1, y1, x2, y2))
643  {
644  PATH_UnlockPath(pPath);
645  return TRUE;
646  }
647 
648  points[0].x = rect.right; points[0].y = rect.top;
649  points[1].x = rect.left; points[1].y = rect.top;
650  points[2].x = rect.left; points[2].y = rect.bottom;
651  points[3].x = rect.right; points[3].y = rect.bottom;
652 
653  if (dc->dclevel.flPath & DCPATH_CLOCKWISE) reverse_points(points, 4 );
654 
655  if (!(type = add_points( pPath, points, 4, PT_LINETO )))
656  {
657  PATH_UnlockPath(pPath);
658  return FALSE;
659  }
660  type[0] = PT_MOVETO;
661 
662  /* Close the rectangle figure */
663  IntGdiCloseFigure(pPath) ;
664  PATH_UnlockPath(pPath);
665  return TRUE;
666 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
#define TRUE
Definition: types.h:120
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
Definition: path.h:34
static void reverse_points(POINT *points, UINT count)
Definition: path.c:494
& rect
Definition: startmenu.cpp:1413
#define PATH_LockPath(hPath)
Definition: path.h:70
#define FALSE
Definition: types.h:117
VOID FASTCALL IntGdiCloseFigure(PPATH pPath)
Definition: path.c:108
#define PATH_UnlockPath(pPath)
Definition: path.h:71
static BYTE * add_points(PPATH path, const POINT *points, DWORD count, BYTE type)
Definition: path.c:480
GLsizei const GLfloat * points
Definition: glext.h:8112
static BOOL PATH_CheckRect(DC *dc, RECTL *rect, INT x1, INT y1, INT x2, INT y2)
Definition: path.c:433
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
unsigned char BYTE
Definition: xxhash.c:193
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
#define PT_LINETO
Definition: wingdi.h:885
#define PT_MOVETO
Definition: wingdi.h:884
static const WCHAR dc[]
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by IntRectangle(), and PATH_RoundRect().

◆ PATH_ReserveEntries()

BOOL FASTCALL PATH_ReserveEntries ( PPATH  pPath,
INT  numEntries 
)

Definition at line 296 of file path.c.

299 {
300  INT numEntriesToAllocate;
301  POINT *pPointsNew;
302  BYTE *pFlagsNew;
303 
304  ASSERT(pPath != NULL);
305  ASSERT(numEntries >= 0);
306 
307  /* Do we have to allocate more memory? */
308  if (numEntries > pPath->numEntriesAllocated)
309  {
310  /* Find number of entries to allocate. We let the size of the array
311  * grow exponentially, since that will guarantee linear time
312  * complexity. */
313  if (pPath->numEntriesAllocated)
314  {
315  numEntriesToAllocate = pPath->numEntriesAllocated;
316  while (numEntriesToAllocate < numEntries)
317  numEntriesToAllocate = numEntriesToAllocate * GROW_FACTOR_NUMER / GROW_FACTOR_DENOM;
318  }
319  else
320  numEntriesToAllocate = numEntries;
321 
322  /* Allocate new arrays */
323  pPointsNew = (POINT *)ExAllocatePoolWithTag(PagedPool, numEntriesToAllocate * sizeof(POINT), TAG_PATH);
324  if (!pPointsNew)
325  return FALSE;
326 
327  pFlagsNew = (BYTE *)ExAllocatePoolWithTag(PagedPool, numEntriesToAllocate * sizeof(BYTE), TAG_PATH);
328  if (!pFlagsNew)
329  {
330  ExFreePoolWithTag(pPointsNew, TAG_PATH);
331  return FALSE;
332  }
333 
334  /* Copy old arrays to new arrays and discard old arrays */
335  if (pPath->pPoints)
336  {
337  ASSERT(pPath->pFlags);
338 
339  memcpy(pPointsNew, pPath->pPoints, sizeof(POINT)*pPath->numEntriesUsed);
340  memcpy(pFlagsNew, pPath->pFlags, sizeof(BYTE)*pPath->numEntriesUsed);
341 
344  }
345 
346  pPath->pPoints = pPointsNew;
347  pPath->pFlags = pFlagsNew;
348  pPath->numEntriesAllocated = numEntriesToAllocate;
349  }
350 
351  return TRUE;
352 }
int numEntriesAllocated