ReactOS  0.4.15-dev-980-ge160524
fillshap.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for fillshap.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define Rsin(d)   ((d) == 0.0 ? 0.0 : ((d) == 90.0 ? 1.0 : sin(d*M_PI/180.0)))
 
#define Rcos(d)   ((d) == 0.0 ? 1.0 : ((d) == 90.0 ? 0.0 : cos(d*M_PI/180.0)))
 

Functions

BOOL FASTCALL IntGdiPolygon (PDC dc, PPOINT Points, int Count)
 
BOOL FASTCALL IntGdiPolyPolygon (DC *dc, LPPOINT Points, PULONG PolyCounts, int Count)
 
BOOL FASTCALL IntPolygon (HDC hdc, POINT *Point, int Count)
 
BOOL APIENTRY NtGdiEllipse (HDC hDC, int Left, int Top, int Right, int Bottom)
 
ULONG_PTR APIENTRY NtGdiPolyPolyDraw (IN HDC hDC, IN PPOINT UnsafePoints, IN PULONG UnsafeCounts, IN ULONG Count, IN INT iFunc)
 
BOOL FASTCALL IntRectangle (PDC dc, int LeftRect, int TopRect, int RightRect, int BottomRect)
 
BOOL APIENTRY NtGdiRectangle (HDC hDC, int LeftRect, int TopRect, int RightRect, int BottomRect)
 
BOOL FASTCALL IntRoundRect (PDC dc, int Left, int Top, int Right, int Bottom, int xCurveDiameter, int yCurveDiameter)
 
BOOL APIENTRY NtGdiRoundRect (HDC hDC, int LeftRect, int TopRect, int RightRect, int BottomRect, int Width, int Height)
 
BOOL NTAPI GreGradientFill (HDC hdc, PTRIVERTEX pVertex, ULONG nVertex, PVOID pMesh, ULONG nMesh, ULONG ulMode)
 
BOOL APIENTRY NtGdiGradientFill (HDC hdc, PTRIVERTEX pVertex, ULONG nVertex, PVOID pMesh, ULONG nMesh, ULONG ulMode)
 
BOOL APIENTRY NtGdiExtFloodFill (HDC hDC, INT XStart, INT YStart, COLORREF Color, UINT FillType)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file fillshap.c.

◆ Rcos

#define Rcos (   d)    ((d) == 0.0 ? 1.0 : ((d) == 90.0 ? 0.0 : cos(d*M_PI/180.0)))

Definition at line 15 of file fillshap.c.

◆ Rsin

#define Rsin (   d)    ((d) == 0.0 ? 0.0 : ((d) == 90.0 ? 1.0 : sin(d*M_PI/180.0)))

Definition at line 14 of file fillshap.c.

Function Documentation

◆ GreGradientFill()

BOOL NTAPI GreGradientFill ( HDC  hdc,
PTRIVERTEX  pVertex,
ULONG  nVertex,
PVOID  pMesh,
ULONG  nMesh,
ULONG  ulMode 
)

Definition at line 871 of file fillshap.c.

878 {
879  PDC pdc;
880  SURFACE *psurf;
881  EXLATEOBJ exlo;
882  RECTL rclExtent;
883  POINTL ptlDitherOrg;
884  ULONG i;
885  BOOL bRet;
886 
887  /* Check parameters */
888  if (ulMode & GRADIENT_FILL_TRIANGLE)
889  {
891 
892  for (i = 0; i < nMesh; i++, pTriangle++)
893  {
894  if (pTriangle->Vertex1 >= nVertex ||
895  pTriangle->Vertex2 >= nVertex ||
896  pTriangle->Vertex3 >= nVertex)
897  {
899  return FALSE;
900  }
901  }
902  }
903  else
904  {
906  for (i = 0; i < nMesh; i++, pRect++)
907  {
908  if (pRect->UpperLeft >= nVertex || pRect->LowerRight >= nVertex)
909  {
911  return FALSE;
912  }
913  }
914  }
915 
916  /* Lock the output DC */
917  pdc = DC_LockDc(hdc);
918  if(!pdc)
919  {
921  return FALSE;
922  }
923 
924  if (!pdc->dclevel.pSurface)
925  {
926  /* Memory DC with no surface selected */
927  DC_UnlockDc(pdc);
928  return TRUE; // CHECKME
929  }
930 
931  /* Calculate extent */
932  rclExtent.left = rclExtent.right = pVertex->x;
933  rclExtent.top = rclExtent.bottom = pVertex->y;
934  for (i = 0; i < nVertex; i++)
935  {
936  rclExtent.left = min(rclExtent.left, (pVertex + i)->x);
937  rclExtent.right = max(rclExtent.right, (pVertex + i)->x);
938  rclExtent.top = min(rclExtent.top, (pVertex + i)->y);
939  rclExtent.bottom = max(rclExtent.bottom, (pVertex + i)->y);
940  }
941  IntLPtoDP(pdc, (LPPOINT)&rclExtent, 2);
942 
943  rclExtent.left += pdc->ptlDCOrig.x;
944  rclExtent.right += pdc->ptlDCOrig.x;
945  rclExtent.top += pdc->ptlDCOrig.y;
946  rclExtent.bottom += pdc->ptlDCOrig.y;
947 
948  if (RECTL_bIsEmptyRect(&rclExtent))
949  {
950  DC_UnlockDc(pdc);
951  return TRUE;
952  }
953 
954  ptlDitherOrg.x = ptlDitherOrg.y = 0;
955  IntLPtoDP(pdc, (LPPOINT)&ptlDitherOrg, 1);
956 
957  ptlDitherOrg.x += pdc->ptlDCOrig.x;
958  ptlDitherOrg.y += pdc->ptlDCOrig.y;
959 
960  if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
961  {
962  IntUpdateBoundsRect(pdc, &rclExtent);
963  }
964 
965  DC_vPrepareDCsForBlit(pdc, &rclExtent, NULL, NULL);
966 
967  psurf = pdc->dclevel.pSurface;
968 
969  EXLATEOBJ_vInitialize(&exlo, &gpalRGB, psurf->ppal, 0, 0, 0);
970 
971  bRet = IntEngGradientFill(&psurf->SurfObj,
972  (CLIPOBJ *)&pdc->co,
973  &exlo.xlo,
974  pVertex,
975  nVertex,
976  pMesh,
977  nMesh,
978  &rclExtent,
979  &ptlDitherOrg,
980  ulMode);
981 
982  EXLATEOBJ_vCleanup(&exlo);
983  DC_vFinishBlit(pdc, NULL);
984  DC_UnlockDc(pdc);
985 
986  return bRet;
987 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG _In_ PVOID _In_ ULONG nMesh
Definition: winddi.h:3649
ULONG UpperLeft
Definition: wingdi.h:2804
ULONG LowerRight
Definition: wingdi.h:2805
#define max(a, b)
Definition: svc.c:63
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG _In_ PVOID pMesh
Definition: winddi.h:3649
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
struct _PALETTE *const ppal
Definition: surface.h:11
long bottom
Definition: polytest.cpp:53
LONG y
Definition: windef.h:330
XLATEOBJ xlo
Definition: xlateobj.h:21
long right
Definition: polytest.cpp:53
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID NTAPI EXLATEOBJ_vInitialize(_Out_ PEXLATEOBJ pexlo, _In_opt_ PALETTE *ppalSrc, _In_opt_ PALETTE *ppalDst, _In_ COLORREF crSrcBackColor, _In_ COLORREF crDstBackColor, _In_ COLORREF crDstForeColor)
Definition: xlateobj.c:358
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long top
Definition: polytest.cpp:53
SURFOBJ SurfObj
Definition: surface.h:8
struct _GRADIENT_RECT * PGRADIENT_RECT
smooth NULL
Definition: ftsmooth.c:416
BOOL APIENTRY IntEngGradientFill(IN SURFOBJ *psoDest, IN CLIPOBJ *pco, IN XLATEOBJ *pxlo, IN TRIVERTEX *pVertex, IN ULONG nVertex, IN PVOID pMesh, IN ULONG nMesh, IN RECTL *prclExtents, IN POINTL *pptlDitherOrg, IN ULONG ulMode)
Definition: gradient.c:553
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649
long left
Definition: polytest.cpp:53
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX * pVertex
Definition: winddi.h:3649
Definition: polytest.cpp:40
LONG x
Definition: windef.h:329
#define IntLPtoDP(pdc, ppt, count)
Definition: coord.h:7
HDC hdc
Definition: main.c:9
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG _In_ PVOID _In_ ULONG _In_ RECTL _In_ POINTL _In_ ULONG ulMode
Definition: winddi.h:3649
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define min(a, b)
Definition: monoChain.cc:55
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
VOID FASTCALL IntUpdateBoundsRect(PDC, PRECTL)
Definition: dcutil.c:694
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
unsigned int ULONG
Definition: retypes.h:1
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG nVertex
Definition: winddi.h:3649
PALETTE gpalRGB
Definition: palette.c:20
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
struct _GRADIENT_TRIANGLE * PGRADIENT_TRIANGLE

Referenced by NtGdiGradientFill(), and UserDrawCaption().

◆ IntGdiPolygon()

BOOL FASTCALL IntGdiPolygon ( PDC  dc,
PPOINT  Points,
int  Count 
)

Definition at line 18 of file fillshap.c.

21 {
22  SURFACE *psurf;
23  PBRUSH pbrLine, pbrFill;
24  BOOL ret = FALSE; // Default to failure
25  RECTL DestRect;
26  int CurrentPoint;
27  PDC_ATTR pdcattr;
28  POINTL BrushOrigin;
29 // int Left;
30 // int Top;
31 
32  ASSERT(dc); // Caller's responsibility to pass a valid dc
33 
34  if (!Points || Count < 2 )
35  {
37  return FALSE;
38  }
39 
40 /*
41  // Find start x, y
42  Left = Points[0].x;
43  Top = Points[0].y;
44  for (CurrentPoint = 1; CurrentPoint < Count; ++CurrentPoint) {
45  Left = min(Left, Points[CurrentPoint].x);
46  Top = min(Top, Points[CurrentPoint].y);
47  }
48 */
49 
50  pdcattr = dc->pdcattr;
51 
52  /* Convert to screen coordinates */
53  IntLPtoDP(dc, Points, Count);
54  for (CurrentPoint = 0; CurrentPoint < Count; CurrentPoint++)
55  {
56  Points[CurrentPoint].x += dc->ptlDCOrig.x;
57  Points[CurrentPoint].y += dc->ptlDCOrig.y;
58  }
59  // No need to have path here.
60  {
61  DestRect.left = Points[0].x;
62  DestRect.right = Points[0].x;
63  DestRect.top = Points[0].y;
64  DestRect.bottom = Points[0].y;
65 
66  for (CurrentPoint = 1; CurrentPoint < Count; ++CurrentPoint)
67  {
68  DestRect.left = min(DestRect.left, Points[CurrentPoint].x);
69  DestRect.right = max(DestRect.right, Points[CurrentPoint].x);
70  DestRect.top = min(DestRect.top, Points[CurrentPoint].y);
71  DestRect.bottom = max(DestRect.bottom, Points[CurrentPoint].y);
72  }
73 
74  if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
76 
77  if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
79 
80  /* Special locking order to avoid lock-ups */
81  pbrFill = dc->dclevel.pbrFill;
82  pbrLine = dc->dclevel.pbrLine;
83  psurf = dc->dclevel.pSurface;
84  if (psurf == NULL)
85  {
86  /* Memory DC without a bitmap selected, nothing to do. */
87  return TRUE;
88  }
89 
90  /* Now fill the polygon with the current fill brush. */
91  if (!(pbrFill->flAttrs & BR_IS_NULL))
92  {
93  BrushOrigin = *((PPOINTL)&pbrFill->ptOrigin);
94  BrushOrigin.x += dc->ptlDCOrig.x;
95  BrushOrigin.y += dc->ptlDCOrig.y;
97  psurf,
98  &dc->eboFill.BrushObject,
99  Points,
100  Count,
101  DestRect,
102  &BrushOrigin);
103  }
104 
105  // Draw the Polygon Edges with the current pen ( if not a NULL pen )
106  if (!(pbrLine->flAttrs & BR_IS_NULL))
107  {
108  int i;
109 
110  for (i = 0; i < Count-1; i++)
111  {
112 
113 // DPRINT1("Polygon Making line from (%d,%d) to (%d,%d)\n",
114 // Points[0].x, Points[0].y,
115 // Points[1].x, Points[1].y );
116 
117  ret = IntEngLineTo(&psurf->SurfObj,
118  (CLIPOBJ *)&dc->co,
119  &dc->eboLine.BrushObject,
120  Points[i].x, /* From */
121  Points[i].y,
122  Points[i+1].x, /* To */
123  Points[i+1].y,
124  &DestRect,
125  ROP2_TO_MIX(pdcattr->jROP2)); /* MIX */
126  if (!ret) break;
127  }
128  /* Close the polygon */
129  if (ret)
130  {
131  ret = IntEngLineTo(&psurf->SurfObj,
132  (CLIPOBJ *)&dc->co,
133  &dc->eboLine.BrushObject,
134  Points[Count-1].x, /* From */
135  Points[Count-1].y,
136  Points[0].x, /* To */
137  Points[0].y,
138  &DestRect,
139  ROP2_TO_MIX(pdcattr->jROP2)); /* MIX */
140  }
141  }
142  }
143 
144  return ret;
145 }
#define ROP2_TO_MIX(Rop2)
Definition: inteng.h:40
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define max(a, b)
Definition: svc.c:63
struct _POINTL * PPOINTL
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc)
Definition: dcobjs.c:62
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
#define DC_PEN_DIRTY
Definition: ntgdihdl.h:158
long bottom
Definition: polytest.cpp:53
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1173
LONG y
Definition: windef.h:330
long right
Definition: polytest.cpp:53
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long top
Definition: polytest.cpp:53
BOOL FASTCALL IntFillPolygon(PDC dc, SURFACE *psurf, BRUSHOBJ *BrushObj, CONST PPOINT Points, int Count, RECTL DestRect, POINTL *BrushOrigin)
Definition: polyfill.c:590
SURFOBJ SurfObj
Definition: surface.h:8
smooth NULL
Definition: ftsmooth.c:416
long left
Definition: polytest.cpp:53
ULONG ulDirty_
Definition: ntgdihdl.h:298
Definition: types.h:100
BYTE jROP2
Definition: ntgdihdl.h:311
#define BR_IS_NULL
Definition: brush.h:101
LONG x
Definition: windef.h:329
void IntEngLineTo(SURFOBJ *, CLIPOBJ, PBRUSHOBJ, int x1, int y1, int x2, int y2, RECTL *, MIX mix)
Definition: polytest.cpp:107
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define IntLPtoDP(pdc, ppt, count)
Definition: coord.h:7
int ret
#define DIRTY_FILL
Definition: ntgdihdl.h:145
#define min(a, b)
Definition: monoChain.cc:55
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:157
#define DIRTY_LINE
Definition: ntgdihdl.h:146
static const WCHAR dc[]
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16

Referenced by IntGdiPolyPolygon(), and IntPolygon().

◆ IntGdiPolyPolygon()

BOOL FASTCALL IntGdiPolyPolygon ( DC dc,
LPPOINT  Points,
PULONG  PolyCounts,
int  Count 
)

Definition at line 148 of file fillshap.c.

152 {
153  if (PATH_IsPathOpen(dc->dclevel))
154  return PATH_PolyPolygon ( dc, Points, (PINT)PolyCounts, Count);
155 
156  while (--Count >=0)
157  {
158  if (!IntGdiPolygon ( dc, Points, *PolyCounts ))
159  return FALSE;
160  Points+=*PolyCounts++;
161  }
162  return TRUE;
163 }
#define TRUE
Definition: types.h:120
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1173
BOOL FASTCALL PATH_PolyPolygon(PDC dc, const POINT *pts, const INT *counts, UINT polygons)
Definition: path.c:1240
#define FALSE
Definition: types.h:117
BOOL FASTCALL IntGdiPolygon(PDC dc, PPOINT Points, int Count)
Definition: fillshap.c:18
#define PATH_IsPathOpen(dclevel)
Definition: path.h:74
int * PINT
Definition: windef.h:177
static const WCHAR dc[]

Referenced by NtGdiPolyPolyDraw(), and NtGdiRectangle().

◆ IntPolygon()

BOOL FASTCALL IntPolygon ( HDC  hdc,
POINT Point,
int  Count 
)

Definition at line 166 of file fillshap.c.

167 {
168  BOOL bResult;
169  PDC pdc;
170 
171  pdc = DC_LockDc(hdc);
172  if (pdc == NULL)
173  {
175  return FALSE;
176  }
177 
178  bResult = IntGdiPolygon(pdc, Point, Count);
179 
180  DC_UnlockDc(pdc);
181  return bResult;
182 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1173
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL FASTCALL IntGdiPolygon(PDC dc, PPOINT Points, int Count)
Definition: fillshap.c:18
Definition: polytest.cpp:40
HDC hdc
Definition: main.c:9
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by IntDrawDiagEdge().

◆ IntRectangle()

BOOL FASTCALL IntRectangle ( PDC  dc,
int  LeftRect,
int  TopRect,
int  RightRect,
int  BottomRect 
)

Definition at line 532 of file fillshap.c.

537 {
538  SURFACE *psurf = NULL;
539  PBRUSH pbrLine, pbrFill;
540  BOOL ret = FALSE; // Default to failure
541  RECTL DestRect;
542  MIX Mix;
543  PDC_ATTR pdcattr;
544  POINTL BrushOrigin;
545 
546  ASSERT ( dc ); // Caller's responsibility to set this up
547 
548  pdcattr = dc->pdcattr;
549 
550  // Rectangle Path only.
551  if ( PATH_IsPathOpen(dc->dclevel) )
552  {
553  return PATH_Rectangle ( dc, LeftRect, TopRect, RightRect, BottomRect );
554  }
555 
556  /* Make sure rectangle is not inverted */
557  DestRect.left = min(LeftRect, RightRect);
558  DestRect.right = max(LeftRect, RightRect);
559  DestRect.top = min(TopRect, BottomRect);
560  DestRect.bottom = max(TopRect, BottomRect);
561 
562  IntLPtoDP(dc, (LPPOINT)&DestRect, 2);
563 
564  DestRect.left += dc->ptlDCOrig.x;
565  DestRect.right += dc->ptlDCOrig.x;
566  DestRect.top += dc->ptlDCOrig.y;
567  DestRect.bottom += dc->ptlDCOrig.y;
568 
569  if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
570  {
571  IntUpdateBoundsRect(dc, &DestRect);
572  }
573 
574  /* In GM_COMPATIBLE, don't include bottom and right edges */
575  if (pdcattr->iGraphicsMode == GM_COMPATIBLE)
576  {
577  DestRect.right--;
578  DestRect.bottom--;
579  }
580 
581  DC_vPrepareDCsForBlit(dc, &DestRect, NULL, NULL);
582 
583  if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
585 
586  if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
588 
589  pbrFill = dc->dclevel.pbrFill;
590  pbrLine = dc->dclevel.pbrLine;
591  if (!pbrLine)
592  {
593  ret = FALSE;
594  goto cleanup;
595  }
596 
597  psurf = dc->dclevel.pSurface;
598  if (!psurf)
599  {
600  ret = TRUE;
601  goto cleanup;
602  }
603 
604  if (pbrFill)
605  {
606  if (!(pbrFill->flAttrs & BR_IS_NULL))
607  {
608  BrushOrigin = *((PPOINTL)&pbrFill->ptOrigin);
609  BrushOrigin.x += dc->ptlDCOrig.x;
610  BrushOrigin.y += dc->ptlDCOrig.y;
611  ret = IntEngBitBlt(&psurf->SurfObj,
612  NULL,
613  NULL,
614  (CLIPOBJ *)&dc->co,
615  NULL,
616  &DestRect,
617  NULL,
618  NULL,
619  &dc->eboFill.BrushObject,
620  &BrushOrigin,
622  }
623  }
624 
625  // Draw the rectangle with the current pen
626 
627  ret = TRUE; // Change default to success
628 
629  if (!(pbrLine->flAttrs & BR_IS_NULL))
630  {
631  Mix = ROP2_TO_MIX(pdcattr->jROP2);
632  ret = ret && IntEngLineTo(&psurf->SurfObj,
633  (CLIPOBJ *)&dc->co,
634  &dc->eboLine.BrushObject,
635  DestRect.left, DestRect.top, DestRect.right, DestRect.top,
636  &DestRect, // Bounding rectangle
637  Mix);
638 
639  ret = ret && IntEngLineTo(&psurf->SurfObj,
640  (CLIPOBJ *)&dc->co,
641  &dc->eboLine.BrushObject,
642  DestRect.right, DestRect.top, DestRect.right, DestRect.bottom,
643  &DestRect, // Bounding rectangle
644  Mix);
645 
646  ret = ret && IntEngLineTo(&psurf->SurfObj,
647  (CLIPOBJ *)&dc->co,
648  &dc->eboLine.BrushObject,
649  DestRect.right, DestRect.bottom, DestRect.left, DestRect.bottom,
650  &DestRect, // Bounding rectangle
651  Mix);
652 
653  ret = ret && IntEngLineTo(&psurf->SurfObj,
654  (CLIPOBJ *)&dc->co,
655  &dc->eboLine.BrushObject,
656  DestRect.left, DestRect.bottom, DestRect.left, DestRect.top,
657  &DestRect, // Bounding rectangle
658  Mix);
659  }
660 
661 cleanup:
663 
664  /* Move current position in DC?
665  MSDN: The current position is neither used nor updated by Rectangle. */
666 
667  return ret;
668 }
#define ROP2_TO_MIX(Rop2)
Definition: inteng.h:40
#define max(a, b)
Definition: svc.c:63
struct _POINTL * PPOINTL
BOOL FASTCALL PATH_Rectangle(PDC dc, INT x1, INT y1, INT x2, INT y2)
Definition: path.c:614
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc)
Definition: dcobjs.c:62
ULONG MIX
Definition: winddi.h:129
#define TRUE
Definition: types.h:120
#define DC_PEN_DIRTY
Definition: ntgdihdl.h:158
long bottom
Definition: polytest.cpp:53
LONG y
Definition: windef.h:330
long right
Definition: polytest.cpp:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long top
Definition: polytest.cpp:53
SURFOBJ SurfObj
Definition: surface.h:8
smooth NULL
Definition: ftsmooth.c:416
long left
Definition: polytest.cpp:53
ULONG ulDirty_
Definition: ntgdihdl.h:298
Definition: types.h:100
#define PATH_IsPathOpen(dclevel)
Definition: path.h:74
BYTE jROP2
Definition: ntgdihdl.h:311
#define BR_IS_NULL
Definition: brush.h:101
LONG x
Definition: windef.h:329
void IntEngLineTo(SURFOBJ *, CLIPOBJ, PBRUSHOBJ, int x1, int y1, int x2, int y2, RECTL *, MIX mix)
Definition: polytest.cpp:107
#define GM_COMPATIBLE
Definition: wingdi.h:863
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define IntLPtoDP(pdc, ppt, count)
Definition: coord.h:7
int ret
#define DIRTY_FILL
Definition: ntgdihdl.h:145
#define min(a, b)
Definition: monoChain.cc:55
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:157
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
VOID FASTCALL IntUpdateBoundsRect(PDC, PRECTL)
Definition: dcutil.c:694
#define DIRTY_LINE
Definition: ntgdihdl.h:146
char * cleanup(char *str)
Definition: wpickclick.c:99
static const WCHAR dc[]
#define ROP4_FROM_INDEX(index)
Definition: inteng.h:42
BOOL APIENTRY IntEngBitBlt(SURFOBJ *psoTrg, SURFOBJ *psoSrc, SURFOBJ *psoMask, CLIPOBJ *pco, XLATEOBJ *pxlo, RECTL *prclTrg, POINTL *pptlSrc, POINTL *pptlMask, BRUSHOBJ *pbo, POINTL *pptlBrush, ROP4 Rop4)
Definition: bitblt.c:604
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16
INT iGraphicsMode
Definition: ntgdihdl.h:310

Referenced by NtGdiRectangle().

◆ IntRoundRect()

BOOL FASTCALL IntRoundRect ( PDC  dc,
int  Left,
int  Top,
int  Right,
int  Bottom,
int  xCurveDiameter,
int  yCurveDiameter 
)

Definition at line 714 of file fillshap.c.

722 {
723  PDC_ATTR pdcattr;
724  PBRUSH pbrLine, pbrFill;
725  RECTL RectBounds;
726  LONG PenWidth, PenOrigWidth;
727  BOOL ret = TRUE; // Default to success
728  BRUSH brushTemp;
729 
730  ASSERT ( dc ); // Caller's responsibility to set this up
731 
732  if ( PATH_IsPathOpen(dc->dclevel) )
733  return PATH_RoundRect ( dc, Left, Top, Right, Bottom,
734  xCurveDiameter, yCurveDiameter );
735 
736  if ((Left == Right) || (Top == Bottom)) return TRUE;
737 
738  xCurveDiameter = max(abs( xCurveDiameter ), 1);
739  yCurveDiameter = max(abs( yCurveDiameter ), 1);
740 
741  if (Right < Left)
742  {
743  INT tmp = Right; Right = Left; Left = tmp;
744  }
745  if (Bottom < Top)
746  {
747  INT tmp = Bottom; Bottom = Top; Top = tmp;
748  }
749 
750  pdcattr = dc->pdcattr;
751 
752  if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
754 
755  if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
757 
758  pbrLine = PEN_ShareLockPen(pdcattr->hpen);
759  if (!pbrLine)
760  {
761  /* Nothing to do, as we don't have a bitmap */
763  return FALSE;
764  }
765 
766  PenOrigWidth = PenWidth = pbrLine->lWidth;
767  if (pbrLine->ulPenStyle == PS_NULL) PenWidth = 0;
768 
769  if (pbrLine->ulPenStyle == PS_INSIDEFRAME)
770  {
771  if (2*PenWidth > (Right - Left)) PenWidth = (Right -Left + 1)/2;
772  if (2*PenWidth > (Bottom - Top)) PenWidth = (Bottom -Top + 1)/2;
773  Left += PenWidth / 2;
774  Right -= (PenWidth - 1) / 2;
775  Top += PenWidth / 2;
776  Bottom -= (PenWidth - 1) / 2;
777  }
778 
779  if (!PenWidth) PenWidth = 1;
780  pbrLine->lWidth = PenWidth;
781 
782  RectBounds.left = Left;
783  RectBounds.top = Top;
784  RectBounds.right = Right;
785  RectBounds.bottom = Bottom;
786 
787  IntLPtoDP(dc, (LPPOINT)&RectBounds, 2);
788 
789  RectBounds.left += dc->ptlDCOrig.x;
790  RectBounds.top += dc->ptlDCOrig.y;
791  RectBounds.right += dc->ptlDCOrig.x;
792  RectBounds.bottom += dc->ptlDCOrig.y;
793 
794  pbrFill = BRUSH_ShareLockBrush(pdcattr->hbrush);
795  if (!pbrFill)
796  {
797  DPRINT1("FillRound Fail\n");
799  ret = FALSE;
800  }
801  else
802  {
803 
804  DC_vPrepareDCsForBlit(dc, &RectBounds, NULL, NULL);
805 
806  RtlCopyMemory(&brushTemp, pbrFill, sizeof(brushTemp));
807  brushTemp.ptOrigin.x += RectBounds.left - Left;
808  brushTemp.ptOrigin.y += RectBounds.top - Top;
810  RectBounds.left,
811  RectBounds.top,
812  RectBounds.right,
813  RectBounds.bottom,
814  xCurveDiameter,
815  yCurveDiameter,
816  &brushTemp);
817  BRUSH_ShareUnlockBrush(pbrFill);
818 
819  if (ret)
820  {
822  RectBounds.left,
823  RectBounds.top,
824  RectBounds.right,
825  RectBounds.bottom,
826  xCurveDiameter,
827  yCurveDiameter,
828  pbrLine);
829  }
830 
832  }
833 
834 
835  pbrLine->lWidth = PenOrigWidth;
836  PEN_ShareUnlockPen(pbrLine);
837  return ret;
838 }
#define BRUSH_ShareUnlockBrush(pBrush)
Definition: brush.h:114
#define abs(i)
Definition: fconv.c:206
#define max(a, b)
Definition: svc.c:63
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc)
Definition: dcobjs.c:62
long y
Definition: polytest.cpp:48
#define ERROR_INTERNAL_ERROR
Definition: winerror.h:840
long x
Definition: polytest.cpp:48
HANDLE hbrush
Definition: ntgdihdl.h:299
#define BRUSH_ShareLockBrush(hBrush)
Definition: brush.h:113
#define TRUE
Definition: types.h:120
HANDLE hpen
Definition: ntgdihdl.h:300
#define DC_PEN_DIRTY
Definition: ntgdihdl.h:158
BOOL FASTCALL IntDrawRoundRect(PDC dc, INT Left, INT Top, INT Right, INT Bottom, INT Wellipse, INT Hellipse, PBRUSH pbrushPen)
Definition: drawing.c:1454
long bottom
Definition: polytest.cpp:53
int32_t INT
Definition: typedefs.h:58
long right
Definition: polytest.cpp:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
long top
Definition: polytest.cpp:53
POINT ptOrigin
Definition: brush.h:24
BOOL FASTCALL PATH_RoundRect(DC *dc, INT x1, INT y1, INT x2, INT y2, INT ell_width, INT ell_height)
Definition: path.c:664
smooth NULL
Definition: ftsmooth.c:416
long left
Definition: polytest.cpp:53
ULONG ulDirty_
Definition: ntgdihdl.h:298
Definition: types.h:100
#define PATH_IsPathOpen(dclevel)
Definition: path.h:74
Definition: brush.hpp:15
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define IntLPtoDP(pdc, ppt, count)
Definition: coord.h:7
int ret
#define DIRTY_FILL
Definition: ntgdihdl.h:145
#define PEN_ShareUnlockPen(ppen)
Definition: pen.h:18
#define PS_INSIDEFRAME
Definition: wingdi.h:592
static LPHIST_ENTRY Bottom
Definition: history.c:54
#define PS_NULL
Definition: wingdi.h:590
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:157
VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdcDest, const RECT *rcDest, PDC pdcSrc, const RECT *rcSrc)
Definition: dclife.c:505
#define DPRINT1
Definition: precomp.h:8
VOID FASTCALL DC_vFinishBlit(PDC pdc1, PDC pdc2)
Definition: dclife.c:614
BOOL FASTCALL IntFillRoundRect(PDC dc, INT Left, INT Top, INT Right, INT Bottom, INT Wellipse, INT Hellipse, PBRUSH pbrush)
Definition: drawing.c:1388
#define DIRTY_LINE
Definition: ntgdihdl.h:146
static const WCHAR dc[]
PBRUSH FASTCALL PEN_ShareLockPen(HPEN hobj)
Definition: pen.c:61
static LPHIST_ENTRY Top
Definition: history.c:53
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16

Referenced by NtGdiRoundRect().

◆ NtGdiEllipse()

BOOL APIENTRY NtGdiEllipse ( HDC  hDC,
int  Left,
int  Top,
int  Right,
int  Bottom 
)

Definition at line 200 of file fillshap.c.

206 {
207  PDC dc;
208  PDC_ATTR pdcattr;
209  RECTL RectBounds;
210  PBRUSH pbrush;
211  BOOL ret = TRUE;
212  LONG PenWidth, PenOrigWidth;
213  LONG RadiusX, RadiusY, CenterX, CenterY;
214  PBRUSH pFillBrushObj;
215  BRUSH tmpFillBrushObj;
216 
217  dc = DC_LockDc(hDC);
218  if (dc == NULL)
219  {
221  return FALSE;
222  }
223 
224  if (PATH_IsPathOpen(dc->dclevel))
225  {
226  ret = PATH_Ellipse(dc, Left, Top, Right, Bottom);
227  DC_UnlockDc(dc);
228  return ret;
229  }
230 
234  if ((Left == Right) || (Top == Bottom))
235  {
236  DC_UnlockDc(dc);
237  return TRUE;
238  }
239 
240  if (Right < Left)
241  {
242  INT tmp = Right; Right = Left; Left = tmp;
243  }
244  if (Bottom < Top)
245  {
246  INT tmp = Bottom; Bottom = Top; Top = tmp;
247  }
249 
250  pdcattr = dc->pdcattr;
251 
252  if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
254 
255  if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
257 
258  pbrush = PEN_ShareLockPen(pdcattr->hpen);
259  if (!pbrush)
260  {
261  DPRINT1("Ellipse Fail 1\n");
262  DC_UnlockDc(dc);
264  return FALSE;
265  }
266 
267  PenOrigWidth = PenWidth = pbrush->lWidth;
268  if (pbrush->ulPenStyle == PS_NULL) PenWidth = 0;
269 
270  if (pbrush->ulPenStyle == PS_INSIDEFRAME)
271  {
272  if (2*PenWidth > (Right - Left)) PenWidth = (Right -Left + 1)/2;
273  if (2*PenWidth > (Bottom - Top)) PenWidth = (Bottom -Top + 1)/2;
274  Left += PenWidth / 2;
275  Right -= (PenWidth - 1) / 2;
276  Top += PenWidth / 2;
277  Bottom -= (PenWidth - 1) / 2;
278  }
279 
280  if (!PenWidth) PenWidth = 1;
281  pbrush->lWidth = PenWidth;
282 
283  RectBounds.left = Left;
284  RectBounds.right = Right;
285  RectBounds.top = Top;
286  RectBounds.bottom = Bottom;
287 
288  IntLPtoDP(dc, (LPPOINT)&RectBounds, 2);
289 
290  RectBounds.left += dc->ptlDCOrig.x;
291  RectBounds.right += dc->ptlDCOrig.x;
292  RectBounds.top += dc->ptlDCOrig.y;
293  RectBounds.bottom += dc->ptlDCOrig.y;
294 
295  // Setup for dynamic width and height.
296  RadiusX = max((RectBounds.right - RectBounds.left) / 2, 2); // Needs room
297  RadiusY = max((RectBounds.bottom - RectBounds.top) / 2, 2);
298  CenterX = (RectBounds.right + RectBounds.left) / 2;
299  CenterY = (RectBounds.bottom + RectBounds.top) / 2;
300 
301  DPRINT("Ellipse 1: Left: %d, Top: %d, Right: %d, Bottom: %d\n",
302  RectBounds.left,RectBounds.top,RectBounds.right,RectBounds.bottom);
303 
304  DPRINT("Ellipse 2: XLeft: %d, YLeft: %d, Width: %d, Height: %d\n",
305  CenterX - RadiusX, CenterY + RadiusY, RadiusX*2, RadiusY*2);
306 
307  pFillBrushObj = BRUSH_ShareLockBrush(pdcattr->hbrush);
308  if (NULL == pFillBrushObj)
309  {
310  DPRINT1("FillEllipse Fail\n");
312  ret = FALSE;
313  }
314  else
315  {
316  RtlCopyMemory(&tmpFillBrushObj, pFillBrushObj, sizeof(tmpFillBrushObj));
317  //tmpFillBrushObj.ptOrigin.x += RectBounds.left - Left;
318  //tmpFillBrushObj.ptOrigin.y += RectBounds.top - Top;
319  tmpFillBrushObj.ptOrigin.x += dc->ptlDCOrig.x;
320  tmpFillBrushObj.ptOrigin.y += dc->ptlDCOrig.y;
321 
322  DC_vPrepareDCsForBlit(dc, &RectBounds, NULL, NULL);
323 
324  ret = IntFillEllipse( dc,
325  CenterX - RadiusX,
326  CenterY - RadiusY,
327  RadiusX*2, // Width
328  RadiusY*2, // Height
329  &tmpFillBrushObj);
330  BRUSH_ShareUnlockBrush(pFillBrushObj);
331 
332  if (ret)
333  {
334  ret = IntDrawEllipse( dc,
335  CenterX - RadiusX,
336  CenterY - RadiusY,
337  RadiusX*2, // Width
338  RadiusY*2, // Height
339  pbrush);
340  }
341 
343  }
344 
345  pbrush->lWidth = PenOrigWidth;
346  PEN_ShareUnlockPen(pbrush);
347  DC_UnlockDc(dc);
348  DPRINT("Ellipse Exit.\n");
349  return ret;
350 }
#define BRUSH_ShareUnlockBrush(pBrush)
Definition: brush.h:114
#define max(a, b)
Definition: svc.c:63
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc)
Definition: dcobjs.c:62
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
long y
Definition: polytest.cpp:48
#define ERROR_INTERNAL_ERROR
Definition: winerror.h:840
long x
Definition: polytest.cpp:48
HANDLE hbrush
Definition: ntgdihdl.h:299
#define BRUSH_ShareLockBrush(hBrush)
Definition: brush.h:113
#define TRUE
Definition: types.h:120
HANDLE hpen
Definition: ntgdihdl.h:300
#define DC_PEN_DIRTY
Definition: ntgdihdl.h:158
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
long bottom
Definition: polytest.cpp:53
BOOL FASTCALL IntDrawEllipse(PDC dc, INT XLeft, INT YLeft, INT Width, INT Height, PBRUSH pbrush)
Definition: drawing.c:1364
int32_t INT
Definition: typedefs.h:58
BOOL FASTCALL PATH_Ellipse(PDC dc, INT x1, INT y1, INT x2, INT y2)
Definition: path.c:759
long right
Definition: polytest.cpp:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
long top
Definition: polytest.cpp:53
POINT ptOrigin
Definition: brush.h:24
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
long left
Definition: polytest.cpp:53
ULONG ulDirty_
Definition: ntgdihdl.h:298
Definition: types.h:100
#define PATH_IsPathOpen(dclevel)
Definition: path.h:74
Definition: polytest.cpp:40
Definition: brush.hpp:15
#define IntLPtoDP(pdc, ppt, count)
Definition: coord.h:7
int ret
#define DIRTY_FILL
Definition: ntgdihdl.h:145
#define PEN_ShareUnlockPen(ppen)
Definition: pen.h:18
#define PS_INSIDEFRAME
Definition: wingdi.h:592
static HDC hDC
Definition: 3dtext.c:33
BOOL FASTCALL IntFillEllipse(PDC dc, INT XLeft, INT YLeft, INT Width, INT Height, PBRUSH pbrush)
Definition: drawing.c:1376
static LPHIST_ENTRY Bottom
Definition: history.c:54
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define PS_NULL
Definition: wingdi.h:590
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:157
VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdcDest, const RECT *rcDest, PDC pdcSrc, const RECT *rcSrc)
Definition: dclife.c:505
#define DPRINT1
Definition: precomp.h:8
VOID FASTCALL DC_vFinishBlit(PDC pdc1, PDC pdc2)
Definition: dclife.c:614
#define DIRTY_LINE
Definition: ntgdihdl.h:146
static const WCHAR dc[]
PBRUSH FASTCALL PEN_ShareLockPen(HPEN hobj)
Definition: pen.c:61
static LPHIST_ENTRY Top
Definition: history.c:53
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16

◆ NtGdiExtFloodFill()

BOOL APIENTRY NtGdiExtFloodFill ( HDC  hDC,
INT  XStart,
INT  YStart,
COLORREF  Color,
UINT  FillType 
)

Definition at line 1067 of file fillshap.c.

1073 {
1074  PDC dc;
1075 #if 0
1076  PDC_ATTR pdcattr;
1077 #endif
1078  SURFACE *psurf;
1079  EXLATEOBJ exlo;
1080  BOOL Ret = FALSE;
1081  RECTL DestRect;
1082  POINTL Pt;
1083  ULONG ConvColor;
1084  PREGION prgn;
1085 
1086  dc = DC_LockDc(hDC);
1087  if (!dc)
1088  {
1090  return FALSE;
1091  }
1092 
1093  if (!dc->dclevel.pSurface)
1094  {
1095  Ret = TRUE;
1096  goto cleanup;
1097  }
1098 
1099 #if 0
1100  pdcattr = dc->pdcattr;
1101 #endif
1102 
1103  Pt.x = XStart;
1104  Pt.y = YStart;
1105  IntLPtoDP(dc, (LPPOINT)&Pt, 1);
1106 
1107  DC_vPrepareDCsForBlit(dc, &DestRect, NULL, NULL);
1108 
1109  psurf = dc->dclevel.pSurface;
1110 
1111  prgn = dc->prgnRao ? dc->prgnRao : dc->prgnVis;
1112  if (prgn)
1113  {
1114  Ret = REGION_PtInRegion(prgn, Pt.x, Pt.y);
1115  if (Ret)
1116  REGION_GetRgnBox(prgn, (LPRECT)&DestRect);
1117  else
1118  {
1120  goto cleanup;
1121  }
1122  }
1123  else
1124  {
1125  RECTL_vSetRect(&DestRect, 0, 0, psurf->SurfObj.sizlBitmap.cx, psurf->SurfObj.sizlBitmap.cy);
1126  }
1127 
1128  if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
1129  {
1130  IntUpdateBoundsRect(dc, &DestRect);
1131  }
1132 
1133  EXLATEOBJ_vInitialize(&exlo, &gpalRGB, psurf->ppal, 0, 0xffffff, 0);
1134 
1135  /* Only solid fills supported for now
1136  * How to support pattern brushes and non standard surfaces (not offering dib functions):
1137  * Version a (most likely slow): call DrvPatBlt for every pixel
1138  * Version b: create a flood mask and let MaskBlt blit a masked brush */
1139  ConvColor = XLATEOBJ_iXlate(&exlo.xlo, Color);
1140  Ret = DIB_XXBPP_FloodFillSolid(&psurf->SurfObj, &dc->eboFill.BrushObject, &DestRect, &Pt, ConvColor, FillType);
1141 
1143 
1144  EXLATEOBJ_vCleanup(&exlo);
1145 
1146 cleanup:
1147  DC_UnlockDc(dc);
1148  return Ret;
1149 }
SIZEL sizlBitmap
Definition: winddi.h:1209
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
struct _PALETTE *const ppal
Definition: surface.h:11
LONG y
Definition: windef.h:330
XLATEOBJ xlo
Definition: xlateobj.h:21
VOID NTAPI EXLATEOBJ_vInitialize(_Out_ PEXLATEOBJ pexlo, _In_opt_ PALETTE *ppalSrc, _In_opt_ PALETTE *ppalDst, _In_ COLORREF crSrcBackColor, _In_ COLORREF crDstBackColor, _In_ COLORREF crDstForeColor)
Definition: xlateobj.c:358
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
SURFOBJ SurfObj
Definition: surface.h:8
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:334
Definition: region.h:7
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649
Definition: polytest.cpp:40
LONG x
Definition: windef.h:329
#define IntLPtoDP(pdc, ppt, count)
Definition: coord.h:7
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID RECTL_vSetRect(_Out_ RECTL *prcl, _In_ LONG left, _In_ LONG top, _In_ LONG right, _In_ LONG bottom)
Definition: rect.h:5
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
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
VOID FASTCALL IntUpdateBoundsRect(PDC, PRECTL)
Definition: dcutil.c:694
unsigned int ULONG
Definition: retypes.h:1
char * cleanup(char *str)
Definition: wpickclick.c:99
static const WCHAR dc[]
PALETTE gpalRGB
Definition: palette.c:20
BOOLEAN DIB_XXBPP_FloodFillSolid(SURFOBJ *, BRUSHOBJ *, RECTL *, POINTL *, ULONG, UINT)
Definition: floodfill.c:86
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
INT FASTCALL REGION_GetRgnBox(PREGION Rgn, PRECTL pRect)
Definition: region.c:2562
LONG cy
Definition: windef.h:335
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
BOOL FASTCALL REGION_PtInRegion(PREGION prgn, INT X, INT Y)
Definition: region.c:2602

◆ NtGdiGradientFill()

BOOL APIENTRY NtGdiGradientFill ( HDC  hdc,
PTRIVERTEX  pVertex,
ULONG  nVertex,
PVOID  pMesh,
ULONG  nMesh,
ULONG  ulMode 
)

Definition at line 991 of file fillshap.c.

998 {
999  BOOL bRet;
1000  PTRIVERTEX SafeVertex;
1001  PVOID SafeMesh;
1002  ULONG cbVertex, cbMesh;
1003 
1004  /* Validate parameters */
1005  if (!pVertex || !nVertex || !pMesh || !nMesh)
1006  {
1008  return FALSE;
1009  }
1010 
1011  switch (ulMode)
1012  {
1013  case GRADIENT_FILL_RECT_H:
1014  case GRADIENT_FILL_RECT_V:
1015  cbMesh = nMesh * sizeof(GRADIENT_RECT);
1016  break;
1017  case GRADIENT_FILL_TRIANGLE:
1018  cbMesh = nMesh * sizeof(GRADIENT_TRIANGLE);
1019  break;
1020  default:
1022  return FALSE;
1023  }
1024 
1025  cbVertex = nVertex * sizeof(TRIVERTEX) ;
1026  if(cbVertex + cbMesh <= cbVertex)
1027  {
1028  /* Overflow */
1029  return FALSE ;
1030  }
1031 
1032  /* Allocate a kernel mode buffer */
1033  SafeVertex = ExAllocatePoolWithTag(PagedPool, cbVertex + cbMesh, TAG_SHAPE);
1034  if(!SafeVertex)
1035  {
1037  return FALSE;
1038  }
1039 
1040  SafeMesh = (PVOID)((ULONG_PTR)SafeVertex + cbVertex);
1041 
1042  /* Copy the parameters to kernel mode */
1043  _SEH2_TRY
1044  {
1045  ProbeForRead(pVertex, cbVertex, 1);
1046  ProbeForRead(pMesh, cbMesh, 1);
1047  RtlCopyMemory(SafeVertex, pVertex, cbVertex);
1048  RtlCopyMemory(SafeMesh, pMesh, cbMesh);
1049  }
1051  {
1052  ExFreePoolWithTag(SafeVertex, TAG_SHAPE);
1054  _SEH2_YIELD(return FALSE;)
1055  }
1056  _SEH2_END;
1057 
1058  /* Call the internal function */
1059  bRet = GreGradientFill(hdc, SafeVertex, nVertex, SafeMesh, nMesh, ulMode);
1060 
1061  /* Cleanup and return result */
1062  ExFreePoolWithTag(SafeVertex, TAG_SHAPE);
1063  return bRet;
1064 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG _In_ PVOID _In_ ULONG nMesh
Definition: winddi.h:3649
struct _GRADIENT_TRIANGLE GRADIENT_TRIANGLE
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG _In_ PVOID pMesh
Definition: winddi.h:3649
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
struct _TRIVERTEX TRIVERTEX
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define TAG_SHAPE
Definition: tags.h:14
_SEH2_TRY
Definition: create.c:4226
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
BOOL NTAPI GreGradientFill(HDC hdc, PTRIVERTEX pVertex, ULONG nVertex, PVOID pMesh, ULONG nMesh, ULONG ulMode)
Definition: fillshap.c:871
void * PVOID
Definition: retypes.h:9
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX * pVertex
Definition: winddi.h:3649
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
HDC hdc
Definition: main.c:9
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG _In_ PVOID _In_ ULONG _In_ RECTL _In_ POINTL _In_ ULONG ulMode
Definition: winddi.h:3649
_SEH2_END
Definition: create.c:4400
unsigned int ULONG
Definition: retypes.h:1
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG nVertex
Definition: winddi.h:3649
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
struct _GRADIENT_RECT GRADIENT_RECT
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

◆ NtGdiPolyPolyDraw()

ULONG_PTR APIENTRY NtGdiPolyPolyDraw ( IN HDC  hDC,
IN PPOINT  UnsafePoints,
IN PULONG  UnsafeCounts,
IN ULONG  Count,
IN INT  iFunc 
)

Definition at line 376 of file fillshap.c.

381 {
382  DC *dc;
383  PVOID pTemp;
384  LPPOINT SafePoints;
385  PULONG SafeCounts;
387  BOOL Ret = TRUE;
388  ULONG nPoints = 0, nMaxPoints = 0, nInvalid = 0, i;
389 
390  if (!UnsafePoints || !UnsafeCounts ||
391  Count == 0 || iFunc == 0 || iFunc > GdiPolyPolyRgn)
392  {
393  /* Windows doesn't set last error */
394  return FALSE;
395  }
396 
397  _SEH2_TRY
398  {
399  ProbeForRead(UnsafePoints, Count * sizeof(POINT), 1);
400  ProbeForRead(UnsafeCounts, Count * sizeof(ULONG), 1);
401 
402  /* Count points and validate poligons */
403  for (i = 0; i < Count; i++)
404  {
405  if (UnsafeCounts[i] < 2)
406  {
407  nInvalid++;
408  }
409  nPoints += UnsafeCounts[i];
410  nMaxPoints = max(nMaxPoints, UnsafeCounts[i]);
411  }
412  }
414  {
416  }
417  _SEH2_END;
418 
419  if (!NT_SUCCESS(Status))
420  {
421  /* Windows doesn't set last error */
422  return FALSE;
423  }
424 
425  if (nPoints == 0 || nPoints < nMaxPoints)
426  {
427  /* If all polygon counts are zero, or we have overflow,
428  return without setting a last error code. */
429  return FALSE;
430  }
431 
432  if (nInvalid != 0)
433  {
434  /* If at least one poly count is 0 or 1, fail */
436  return FALSE;
437  }
438 
439  /* Allocate one buffer for both counts and points */
441  Count * sizeof(ULONG) + nPoints * sizeof(POINT),
442  TAG_SHAPE);
443  if (!pTemp)
444  {
446  return FALSE;
447  }
448 
449  SafeCounts = pTemp;
450  SafePoints = (PVOID)(SafeCounts + Count);
451 
452  _SEH2_TRY
453  {
454  /* Pointers already probed! */
455  RtlCopyMemory(SafeCounts, UnsafeCounts, Count * sizeof(ULONG));
456  RtlCopyMemory(SafePoints, UnsafePoints, nPoints * sizeof(POINT));
457  }
459  {
461  }
462  _SEH2_END;
463 
464  if (!NT_SUCCESS(Status))
465  {
467  return FALSE;
468  }
469 
470  /* Special handling for GdiPolyPolyRgn */
471  if (iFunc == GdiPolyPolyRgn)
472  {
473  INT iMode = (INT)(UINT_PTR)hDC;
474  HRGN hrgn;
475 
476  hrgn = GreCreatePolyPolygonRgn(SafePoints, SafeCounts, Count, iMode);
477 
479  return (ULONG_PTR)hrgn;
480  }
481 
482  dc = DC_LockDc(hDC);
483  if (!dc)
484  {
487  return FALSE;
488  }
489 
491 
492  if (dc->pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
494 
495  if (dc->pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
497 
498  /* Perform the actual work */
499  switch (iFunc)
500  {
501  case GdiPolyPolygon:
502  Ret = IntGdiPolyPolygon(dc, SafePoints, SafeCounts, Count);
503  break;
504  case GdiPolyPolyLine:
505  Ret = IntGdiPolyPolyline(dc, SafePoints, SafeCounts, Count);
506  break;
507  case GdiPolyBezier:
508  Ret = IntGdiPolyBezier(dc, SafePoints, *SafeCounts);
509  break;
510  case GdiPolyLineTo:
511  Ret = IntGdiPolylineTo(dc, SafePoints, *SafeCounts);
512  break;
513  case GdiPolyBezierTo:
514  Ret = IntGdiPolyBezierTo(dc, SafePoints, *SafeCounts);
515  break;
516  default:
518  Ret = FALSE;
519  }
520 
521  /* Cleanup and return */
523  DC_UnlockDc(dc);
525 
526  return (ULONG_PTR)Ret;
527 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define max(a, b)
Definition: svc.c:63
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
BOOL FASTCALL IntGdiPolylineTo(DC *dc, LPPOINT pt, DWORD Count)
Definition: line.c:355
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc)
Definition: dcobjs.c:62
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
_In_ ULONG iMode
Definition: winddi.h:3520
#define TRUE
Definition: types.h:120
#define DC_PEN_DIRTY
Definition: ntgdihdl.h:158
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
LONG NTSTATUS
Definition: precomp.h:26
#define INT
Definition: polytest.cpp:20
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1173
int32_t INT
Definition: typedefs.h:58
#define TAG_SHAPE
Definition: tags.h:14
_SEH2_TRY
Definition: create.c:4226
uint32_t ULONG_PTR
Definition: typedefs.h:65
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 FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
BOOL FASTCALL IntGdiPolyPolygon(DC *dc, LPPOINT Points, PULONG PolyCounts, int Count)
Definition: fillshap.c:148
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
BOOL FASTCALL IntGdiPolyPolyline(DC *dc, LPPOINT pt, PULONG PolyPoints, DWORD Count)
Definition: line.c:394
Definition: polytest.cpp:40
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
BOOL FASTCALL IntGdiPolyBezierTo(DC *dc, LPPOINT pt, DWORD Count)
Definition: line.c:254
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define DIRTY_FILL
Definition: ntgdihdl.h:145
Status
Definition: gdiplustypes.h:24
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
static HRGN hrgn
Definition: win.c:55
static HDC hDC
Definition: 3dtext.c:33
_SEH2_END
Definition: create.c:4400
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
unsigned int * PULONG
Definition: retypes.h:1
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:157
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
HRGN NTAPI GreCreatePolyPolygonRgn(_In_ const POINT *ppt, _In_ const ULONG *pcPoints, _In_ ULONG cPolygons, _In_ INT iMode)
Definition: region.c:3471
unsigned int ULONG
Definition: retypes.h:1
#define DIRTY_LINE
Definition: ntgdihdl.h:146
static const WCHAR dc[]
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:3014
BOOL FASTCALL IntGdiPolyBezier(DC *dc, LPPOINT pt, DWORD Count)
Definition: line.c:226
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16

◆ NtGdiRectangle()

BOOL APIENTRY NtGdiRectangle ( HDC  hDC,
int  LeftRect,
int  TopRect,
int  RightRect,
int  BottomRect 
)

Definition at line 672 of file fillshap.c.

677 {
678  DC *dc;
679  BOOL ret; // Default to failure
680 
681  dc = DC_LockDc(hDC);
682  if (!dc)
683  {
685  return FALSE;
686  }
687 
688  /* Do we rotate or shear? */
689  if (!(dc->pdcattr->mxWorldToDevice.flAccel & XFORM_SCALE))
690  {
691  POINTL DestCoords[4];
692  ULONG PolyCounts = 4;
693 
694  DestCoords[0].x = DestCoords[3].x = LeftRect;
695  DestCoords[0].y = DestCoords[1].y = TopRect;
696  DestCoords[1].x = DestCoords[2].x = RightRect;
697  DestCoords[2].y = DestCoords[3].y = BottomRect;
698  // Use IntGdiPolyPolygon so to support PATH.
699  ret = IntGdiPolyPolygon(dc, DestCoords, &PolyCounts, 1);
700  }
701  else
702  {
703  ret = IntRectangle(dc, LeftRect, TopRect, RightRect, BottomRect );
704  }
705 
706  DC_UnlockDc(dc);
707 
708  return ret;
709 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
LONG y
Definition: windef.h:330
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL FASTCALL IntGdiPolyPolygon(DC *dc, LPPOINT Points, PULONG PolyCounts, int Count)
Definition: fillshap.c:148
Definition: polytest.cpp:40
BOOL FASTCALL IntRectangle(PDC dc, int LeftRect, int TopRect, int RightRect, int BottomRect)
Definition: fillshap.c:532
LONG x
Definition: windef.h:329
int ret
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
unsigned int ULONG
Definition: retypes.h:1
static const WCHAR dc[]
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

◆ NtGdiRoundRect()

BOOL APIENTRY NtGdiRoundRect ( HDC  hDC,
int  LeftRect,
int  TopRect,
int  RightRect,
int  BottomRect,
int  Width,
int  Height 
)

Definition at line 842 of file fillshap.c.

850 {
851  DC *dc = DC_LockDc(hDC);
852  BOOL ret = FALSE; /* Default to failure */
853 
854  DPRINT("NtGdiRoundRect(0x%p,%i,%i,%i,%i,%i,%i)\n",hDC,LeftRect,TopRect,RightRect,BottomRect,Width,Height);
855  if ( !dc )
856  {
857  DPRINT1("NtGdiRoundRect() - hDC is invalid\n");
859  }
860  else
861  {
862  ret = IntRoundRect ( dc, LeftRect, TopRect, RightRect, BottomRect, Width, Height );
863  DC_UnlockDc ( dc );
864  }
865 
866  return ret;
867 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
void DPRINT(...)
Definition: polytest.cpp:61
Definition: polytest.cpp:40
int ret
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DPRINT1
Definition: precomp.h:8
BOOL FASTCALL IntRoundRect(PDC dc, int Left, int Top, int Right, int Bottom, int xCurveDiameter, int yCurveDiameter)
Definition: fillshap.c:714
static const WCHAR dc[]
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27