2003-05-18 17:16:18 +00:00
|
|
|
/*
|
|
|
|
* ReactOS W32 Subsystem
|
|
|
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2009-10-27 10:34:16 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2003-05-18 17:16:18 +00:00
|
|
|
*/
|
2005-06-29 07:09:25 +00:00
|
|
|
|
2010-04-26 13:58:46 +00:00
|
|
|
#include <win32k.h>
|
1999-07-22 16:21:53 +00:00
|
|
|
|
2005-06-29 07:09:25 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2008-07-01 13:30:44 +00:00
|
|
|
#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)))
|
|
|
|
|
2009-03-20 22:40:14 +00:00
|
|
|
BOOL FASTCALL IntFillEllipse( PDC dc, INT XLeft, INT YLeft, INT Width, INT Height, PBRUSH pbrush);
|
|
|
|
BOOL FASTCALL IntDrawEllipse( PDC dc, INT XLeft, INT YLeft, INT Width, INT Height, PBRUSH pbrush);
|
|
|
|
BOOL FASTCALL IntFillRoundRect( PDC dc, INT Left, INT Top, INT Right, INT Bottom, INT Wellipse, INT Hellipse, PBRUSH pbrush);
|
|
|
|
BOOL FASTCALL IntDrawRoundRect( PDC dc, INT Left, INT Top, INT Right, INT Bottom, INT Wellipse, INT Hellipse, PBRUSH pbrush);
|
2008-07-01 13:30:44 +00:00
|
|
|
|
2003-12-13 10:57:29 +00:00
|
|
|
BOOL FASTCALL
|
|
|
|
IntGdiPolygon(PDC dc,
|
2008-10-07 23:02:41 +00:00
|
|
|
PPOINT Points,
|
2003-12-13 10:57:29 +00:00
|
|
|
int Count)
|
|
|
|
{
|
2009-01-08 16:33:40 +00:00
|
|
|
SURFACE *psurf;
|
2009-04-01 01:49:18 +00:00
|
|
|
PBRUSH pbrLine, pbrFill;
|
2007-11-08 01:22:40 +00:00
|
|
|
BOOL ret = FALSE; // default to failure
|
|
|
|
RECTL DestRect;
|
|
|
|
int CurrentPoint;
|
2009-03-20 04:51:26 +00:00
|
|
|
PDC_ATTR pdcattr;
|
2009-03-16 03:21:00 +00:00
|
|
|
POINTL BrushOrigin;
|
|
|
|
// int Left;
|
|
|
|
// int Top;
|
2009-08-04 20:37:10 +00:00
|
|
|
|
2007-11-08 01:22:40 +00:00
|
|
|
ASSERT(dc); // caller's responsibility to pass a valid dc
|
|
|
|
|
2008-10-07 23:02:41 +00:00
|
|
|
if (!Points || Count < 2 )
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-03-16 03:21:00 +00:00
|
|
|
/*
|
|
|
|
//Find start x, y
|
|
|
|
Left = Points[0].x;
|
|
|
|
Top = Points[0].y;
|
|
|
|
for (CurrentPoint = 1; CurrentPoint < Count; ++CurrentPoint) {
|
|
|
|
Left = min(Left, Points[CurrentPoint].x);
|
|
|
|
Top = min(Top, Points[CurrentPoint].y);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr = dc->pdcattr;
|
2008-05-06 20:44:25 +00:00
|
|
|
|
2007-11-08 01:22:40 +00:00
|
|
|
/* Convert to screen coordinates */
|
2008-10-07 23:02:41 +00:00
|
|
|
IntLPtoDP(dc, Points, Count);
|
2007-11-08 01:22:40 +00:00
|
|
|
for (CurrentPoint = 0; CurrentPoint < Count; CurrentPoint++)
|
|
|
|
{
|
2008-10-07 23:02:41 +00:00
|
|
|
Points[CurrentPoint].x += dc->ptlDCOrig.x;
|
|
|
|
Points[CurrentPoint].y += dc->ptlDCOrig.y;
|
2007-11-08 01:22:40 +00:00
|
|
|
}
|
2008-06-30 00:47:58 +00:00
|
|
|
// No need to have path here.
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2008-10-07 23:02:41 +00:00
|
|
|
DestRect.left = Points[0].x;
|
|
|
|
DestRect.right = Points[0].x;
|
|
|
|
DestRect.top = Points[0].y;
|
|
|
|
DestRect.bottom = Points[0].y;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
|
|
|
for (CurrentPoint = 1; CurrentPoint < Count; ++CurrentPoint)
|
|
|
|
{
|
2008-10-07 23:02:41 +00:00
|
|
|
DestRect.left = min(DestRect.left, Points[CurrentPoint].x);
|
|
|
|
DestRect.right = max(DestRect.right, Points[CurrentPoint].x);
|
|
|
|
DestRect.top = min(DestRect.top, Points[CurrentPoint].y);
|
|
|
|
DestRect.bottom = max(DestRect.bottom, Points[CurrentPoint].y);
|
2007-11-08 01:22:40 +00:00
|
|
|
}
|
|
|
|
|
2009-04-05 23:51:27 +00:00
|
|
|
if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
|
|
|
|
DC_vUpdateFillBrush(dc);
|
2008-11-15 13:37:26 +00:00
|
|
|
|
2009-04-05 23:51:27 +00:00
|
|
|
if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
|
|
|
|
DC_vUpdateLineBrush(dc);
|
2008-11-15 13:37:26 +00:00
|
|
|
|
2008-07-15 02:06:38 +00:00
|
|
|
/* Special locking order to avoid lock-ups */
|
2009-04-01 01:49:18 +00:00
|
|
|
pbrFill = dc->dclevel.pbrFill;
|
|
|
|
pbrLine = dc->dclevel.pbrLine;
|
2009-04-14 20:50:02 +00:00
|
|
|
psurf = dc->dclevel.pSurface;
|
2009-01-08 16:33:40 +00:00
|
|
|
/* FIXME - psurf can be NULL!!!! don't assert but handle this case gracefully! */
|
|
|
|
ASSERT(psurf);
|
2008-07-15 02:06:38 +00:00
|
|
|
|
2009-04-01 01:49:18 +00:00
|
|
|
/* Now fill the polygon with the current fill brush. */
|
|
|
|
if (!(pbrFill->flAttrs & GDIBRUSH_IS_NULL))
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2009-04-01 01:49:18 +00:00
|
|
|
BrushOrigin = *((PPOINTL)&pbrFill->ptOrigin);
|
2009-03-16 03:21:00 +00:00
|
|
|
BrushOrigin.x += dc->ptlDCOrig.x;
|
|
|
|
BrushOrigin.y += dc->ptlDCOrig.y;
|
2009-04-01 01:49:18 +00:00
|
|
|
ret = IntFillPolygon (dc,
|
|
|
|
psurf,
|
|
|
|
&dc->eboFill.BrushObject,
|
|
|
|
Points,
|
|
|
|
Count,
|
|
|
|
DestRect,
|
|
|
|
&BrushOrigin);
|
2007-11-08 01:22:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Draw the Polygon Edges with the current pen ( if not a NULL pen )
|
2009-04-01 01:49:18 +00:00
|
|
|
if (!(pbrLine->flAttrs & GDIBRUSH_IS_NULL))
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2007-11-08 02:19:25 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < Count-1; i++)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2006-06-07 01:28:44 +00:00
|
|
|
|
|
|
|
// DPRINT1("Polygon Making line from (%d,%d) to (%d,%d)\n",
|
2008-10-07 23:02:41 +00:00
|
|
|
// Points[0].x, Points[0].y,
|
|
|
|
// Points[1].x, Points[1].y );
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2009-01-08 16:33:40 +00:00
|
|
|
ret = IntEngLineTo(&psurf->SurfObj,
|
2009-03-20 01:35:49 +00:00
|
|
|
dc->rosdc.CombinedClip,
|
2009-04-01 01:49:18 +00:00
|
|
|
&dc->eboLine.BrushObject,
|
2008-10-07 23:02:41 +00:00
|
|
|
Points[i].x, /* From */
|
|
|
|
Points[i].y,
|
|
|
|
Points[i+1].x, /* To */
|
|
|
|
Points[i+1].y,
|
2007-11-08 01:22:40 +00:00
|
|
|
&DestRect,
|
2009-03-20 04:51:26 +00:00
|
|
|
ROP2_TO_MIX(pdcattr->jROP2)); /* MIX */
|
2007-11-08 01:22:40 +00:00
|
|
|
if (!ret) break;
|
2007-11-08 02:19:25 +00:00
|
|
|
}
|
|
|
|
/* Close the polygon */
|
|
|
|
if (ret)
|
|
|
|
{
|
2009-01-08 16:33:40 +00:00
|
|
|
ret = IntEngLineTo(&psurf->SurfObj,
|
2009-03-20 01:35:49 +00:00
|
|
|
dc->rosdc.CombinedClip,
|
2009-04-01 01:49:18 +00:00
|
|
|
&dc->eboLine.BrushObject,
|
2008-10-07 23:02:41 +00:00
|
|
|
Points[Count-1].x, /* From */
|
|
|
|
Points[Count-1].y,
|
|
|
|
Points[0].x, /* To */
|
|
|
|
Points[0].y,
|
2007-11-08 02:19:25 +00:00
|
|
|
&DestRect,
|
2009-03-20 04:51:26 +00:00
|
|
|
ROP2_TO_MIX(pdcattr->jROP2)); /* MIX */
|
2007-11-08 01:22:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2003-12-13 10:57:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL FASTCALL
|
|
|
|
IntGdiPolyPolygon(DC *dc,
|
|
|
|
LPPOINT Points,
|
2008-10-07 23:02:41 +00:00
|
|
|
PULONG PolyCounts,
|
2003-12-13 10:57:29 +00:00
|
|
|
int Count)
|
|
|
|
{
|
2009-03-20 14:16:01 +00:00
|
|
|
if (PATH_IsPathOpen(dc->dclevel))
|
2008-10-07 23:02:41 +00:00
|
|
|
return PATH_PolyPolygon ( dc, Points, (PINT)PolyCounts, Count);
|
2008-07-01 13:30:44 +00:00
|
|
|
|
2007-11-08 01:22:40 +00:00
|
|
|
while (--Count >=0)
|
|
|
|
{
|
|
|
|
if (!IntGdiPolygon ( dc, Points, *PolyCounts ))
|
|
|
|
return FALSE;
|
|
|
|
Points+=*PolyCounts++;
|
|
|
|
}
|
|
|
|
return TRUE;
|
2003-12-13 10:57:29 +00:00
|
|
|
}
|
|
|
|
|
2008-06-09 16:46:52 +00:00
|
|
|
|
|
|
|
|
2003-12-13 10:57:29 +00:00
|
|
|
/******************************************************************************/
|
|
|
|
|
2004-02-04 22:10:00 +00:00
|
|
|
/*
|
|
|
|
* NtGdiEllipse
|
2005-05-08 02:11:54 +00:00
|
|
|
*
|
2004-02-04 22:10:00 +00:00
|
|
|
* Author
|
|
|
|
* Filip Navara
|
|
|
|
*
|
|
|
|
* Remarks
|
|
|
|
* This function uses optimized Bresenham's ellipse algorithm. It draws
|
|
|
|
* four lines of the ellipse in one pass.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2008-11-29 22:48:58 +00:00
|
|
|
BOOL APIENTRY
|
2004-02-04 22:10:00 +00:00
|
|
|
NtGdiEllipse(
|
2007-11-08 01:22:40 +00:00
|
|
|
HDC hDC,
|
2008-07-01 13:30:44 +00:00
|
|
|
int Left,
|
|
|
|
int Top,
|
|
|
|
int Right,
|
|
|
|
int Bottom)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2007-11-08 01:22:40 +00:00
|
|
|
PDC dc;
|
2009-03-20 04:51:26 +00:00
|
|
|
PDC_ATTR pdcattr;
|
2008-07-01 13:30:44 +00:00
|
|
|
RECTL RectBounds;
|
2009-03-20 22:40:14 +00:00
|
|
|
PBRUSH pbrush;
|
2008-07-01 13:30:44 +00:00
|
|
|
BOOL ret = TRUE;
|
|
|
|
LONG PenWidth, PenOrigWidth;
|
|
|
|
LONG RadiusX, RadiusY, CenterX, CenterY;
|
2009-03-20 22:40:14 +00:00
|
|
|
PBRUSH pFillBrushObj;
|
|
|
|
BRUSH tmpFillBrushObj;
|
2008-06-29 13:23:08 +00:00
|
|
|
|
2008-07-01 13:30:44 +00:00
|
|
|
if ((Left == Right) || (Top == Bottom)) return TRUE;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
|
|
|
dc = DC_LockDc(hDC);
|
|
|
|
if (dc == NULL)
|
|
|
|
{
|
2008-07-01 13:30:44 +00:00
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
2007-11-08 01:22:40 +00:00
|
|
|
}
|
2009-03-20 01:35:49 +00:00
|
|
|
if (dc->dctype == DC_TYPE_INFO)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2008-07-01 13:30:44 +00:00
|
|
|
DC_UnlockDc(dc);
|
|
|
|
/* Yes, Windows really returns TRUE in this case */
|
|
|
|
return TRUE;
|
2007-11-08 01:22:40 +00:00
|
|
|
}
|
|
|
|
|
2009-03-20 14:16:01 +00:00
|
|
|
if (PATH_IsPathOpen(dc->dclevel))
|
2008-06-30 00:47:58 +00:00
|
|
|
{
|
2008-07-01 13:30:44 +00:00
|
|
|
ret = PATH_Ellipse(dc, Left, Top, Right, Bottom);
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
return ret;
|
2008-06-30 00:47:58 +00:00
|
|
|
}
|
|
|
|
|
2008-07-01 13:30:44 +00:00
|
|
|
if (Right < Left)
|
2008-06-30 00:47:58 +00:00
|
|
|
{
|
2008-07-01 13:30:44 +00:00
|
|
|
INT tmp = Right; Right = Left; Left = tmp;
|
2008-06-30 00:47:58 +00:00
|
|
|
}
|
2008-07-01 13:30:44 +00:00
|
|
|
if (Bottom < Top)
|
2008-06-30 00:47:58 +00:00
|
|
|
{
|
2008-07-01 13:30:44 +00:00
|
|
|
INT tmp = Bottom; Bottom = Top; Top = tmp;
|
2008-06-30 00:47:58 +00:00
|
|
|
}
|
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr = dc->pdcattr;
|
2007-11-18 13:51:34 +00:00
|
|
|
|
2009-04-08 18:10:33 +00:00
|
|
|
if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
|
|
|
|
DC_vUpdateFillBrush(dc);
|
2008-11-15 13:37:26 +00:00
|
|
|
|
2009-04-08 18:10:33 +00:00
|
|
|
if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
|
|
|
|
DC_vUpdateLineBrush(dc);
|
2008-11-15 13:37:26 +00:00
|
|
|
|
2009-03-23 00:38:59 +00:00
|
|
|
pbrush = PEN_LockPen(pdcattr->hpen);
|
2009-03-20 22:40:14 +00:00
|
|
|
if (!pbrush)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2008-07-01 13:30:44 +00:00
|
|
|
DPRINT1("Ellipse Fail 1\n");
|
2007-11-08 01:22:40 +00:00
|
|
|
DC_UnlockDc(dc);
|
|
|
|
SetLastWin32Error(ERROR_INTERNAL_ERROR);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-03-20 22:40:14 +00:00
|
|
|
PenOrigWidth = PenWidth = pbrush->ptPenWidth.x;
|
|
|
|
if (pbrush->ulPenStyle == PS_NULL) PenWidth = 0;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2009-03-20 22:40:14 +00:00
|
|
|
if (pbrush->ulPenStyle == PS_INSIDEFRAME)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2008-07-01 13:30:44 +00:00
|
|
|
if (2*PenWidth > (Right - Left)) PenWidth = (Right -Left + 1)/2;
|
|
|
|
if (2*PenWidth > (Bottom - Top)) PenWidth = (Bottom -Top + 1)/2;
|
|
|
|
Left += PenWidth / 2;
|
|
|
|
Right -= (PenWidth - 1) / 2;
|
|
|
|
Top += PenWidth / 2;
|
|
|
|
Bottom -= (PenWidth - 1) / 2;
|
2007-11-08 01:22:40 +00:00
|
|
|
}
|
|
|
|
|
2008-07-01 13:30:44 +00:00
|
|
|
if (!PenWidth) PenWidth = 1;
|
2009-03-20 22:40:14 +00:00
|
|
|
pbrush->ptPenWidth.x = PenWidth;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2008-07-01 13:30:44 +00:00
|
|
|
RectBounds.left = Left;
|
|
|
|
RectBounds.right = Right;
|
|
|
|
RectBounds.top = Top;
|
|
|
|
RectBounds.bottom = Bottom;
|
|
|
|
|
2007-11-08 01:22:40 +00:00
|
|
|
IntLPtoDP(dc, (LPPOINT)&RectBounds, 2);
|
2008-07-01 13:30:44 +00:00
|
|
|
|
2008-06-02 17:53:53 +00:00
|
|
|
RectBounds.left += dc->ptlDCOrig.x;
|
|
|
|
RectBounds.right += dc->ptlDCOrig.x;
|
|
|
|
RectBounds.top += dc->ptlDCOrig.y;
|
|
|
|
RectBounds.bottom += dc->ptlDCOrig.y;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2008-07-01 13:30:44 +00:00
|
|
|
// Setup for dynamic width and height.
|
|
|
|
RadiusX = max((RectBounds.right - RectBounds.left) / 2, 2); // Needs room
|
|
|
|
RadiusY = max((RectBounds.bottom - RectBounds.top) / 2, 2);
|
|
|
|
CenterX = (RectBounds.right + RectBounds.left) / 2;
|
|
|
|
CenterY = (RectBounds.bottom + RectBounds.top) / 2;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2008-07-01 13:30:44 +00:00
|
|
|
DPRINT("Ellipse 1: Left: %d, Top: %d, Right: %d, Bottom: %d\n",
|
|
|
|
RectBounds.left,RectBounds.top,RectBounds.right,RectBounds.bottom);
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2008-07-01 13:30:44 +00:00
|
|
|
DPRINT("Ellipse 2: XLeft: %d, YLeft: %d, Width: %d, Height: %d\n",
|
|
|
|
CenterX - RadiusX, CenterY + RadiusY, RadiusX*2, RadiusY*2);
|
|
|
|
|
2009-03-20 22:40:14 +00:00
|
|
|
pFillBrushObj = BRUSH_LockBrush(pdcattr->hbrush);
|
2009-03-16 03:21:00 +00:00
|
|
|
if (NULL == pFillBrushObj)
|
|
|
|
{
|
|
|
|
DPRINT1("FillEllipse Fail\n");
|
|
|
|
SetLastWin32Error(ERROR_INTERNAL_ERROR);
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RtlCopyMemory(&tmpFillBrushObj, pFillBrushObj, sizeof(tmpFillBrushObj));
|
|
|
|
// tmpFillBrushObj.ptOrigin.x += RectBounds.left - Left;
|
|
|
|
// tmpFillBrushObj.ptOrigin.y += RectBounds.top - Top;
|
|
|
|
tmpFillBrushObj.ptOrigin.x += dc->ptlDCOrig.x;
|
|
|
|
tmpFillBrushObj.ptOrigin.y += dc->ptlDCOrig.y;
|
|
|
|
ret = IntFillEllipse( dc,
|
|
|
|
CenterX - RadiusX,
|
|
|
|
CenterY - RadiusY,
|
|
|
|
RadiusX*2, // Width
|
|
|
|
RadiusY*2, // Height
|
|
|
|
&tmpFillBrushObj);
|
2009-03-20 22:40:14 +00:00
|
|
|
BRUSH_UnlockBrush(pFillBrushObj);
|
2009-03-16 03:21:00 +00:00
|
|
|
}
|
|
|
|
|
2008-07-01 13:30:44 +00:00
|
|
|
if (ret)
|
|
|
|
ret = IntDrawEllipse( dc,
|
|
|
|
CenterX - RadiusX,
|
|
|
|
CenterY - RadiusY,
|
|
|
|
RadiusX*2, // Width
|
|
|
|
RadiusY*2, // Height
|
2009-03-20 22:40:14 +00:00
|
|
|
pbrush);
|
2008-07-01 13:30:44 +00:00
|
|
|
|
2009-03-20 22:40:14 +00:00
|
|
|
pbrush->ptPenWidth.x = PenOrigWidth;
|
2009-03-23 00:38:59 +00:00
|
|
|
PEN_UnlockPen(pbrush);
|
2007-11-08 01:22:40 +00:00
|
|
|
DC_UnlockDc(dc);
|
2008-07-01 13:30:44 +00:00
|
|
|
DPRINT("Ellipse Exit.\n");
|
2007-11-08 01:22:40 +00:00
|
|
|
return ret;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
#if 0
|
|
|
|
|
2005-05-08 02:11:54 +00:00
|
|
|
//When the fill mode is ALTERNATE, GDI fills the area between odd-numbered and
|
|
|
|
//even-numbered polygon sides on each scan line. That is, GDI fills the area between the
|
|
|
|
//first and second side, between the third and fourth side, and so on.
|
2003-08-16 04:47:41 +00:00
|
|
|
|
2005-05-08 02:11:54 +00:00
|
|
|
//WINDING Selects winding mode (fills any region with a nonzero winding value).
|
2003-08-16 04:47:41 +00:00
|
|
|
//When the fill mode is WINDING, GDI fills any region that has a nonzero winding value.
|
|
|
|
//This value is defined as the number of times a pen used to draw the polygon would go around the region.
|
2005-05-08 02:11:54 +00:00
|
|
|
//The direction of each edge of the polygon is important.
|
2003-08-16 04:47:41 +00:00
|
|
|
|
|
|
|
extern BOOL FillPolygon(PDC dc,
|
2007-11-08 01:22:40 +00:00
|
|
|
SURFOBJ *SurfObj,
|
|
|
|
PBRUSHOBJ BrushObj,
|
|
|
|
MIX RopMode,
|
|
|
|
CONST PPOINT Points,
|
|
|
|
int Count,
|
|
|
|
RECTL BoundRect);
|
2003-03-20 03:07:38 +00:00
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
#endif
|
2003-03-20 03:07:38 +00:00
|
|
|
|
2007-04-26 14:42:22 +00:00
|
|
|
|
|
|
|
ULONG_PTR
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2007-08-24 04:49:38 +00:00
|
|
|
NtGdiPolyPolyDraw( IN HDC hDC,
|
2008-10-07 23:02:41 +00:00
|
|
|
IN PPOINT UnsafePoints,
|
|
|
|
IN PULONG UnsafeCounts,
|
2007-08-24 04:49:38 +00:00
|
|
|
IN ULONG Count,
|
2007-04-26 14:42:22 +00:00
|
|
|
IN INT iFunc )
|
|
|
|
{
|
2007-11-08 01:22:40 +00:00
|
|
|
DC *dc;
|
2008-10-07 23:02:41 +00:00
|
|
|
PVOID pTemp;
|
|
|
|
LPPOINT SafePoints;
|
|
|
|
PULONG SafeCounts;
|
2007-11-08 01:22:40 +00:00
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
BOOL Ret = TRUE;
|
2008-10-07 23:02:41 +00:00
|
|
|
INT nPoints = 0, nMaxPoints = 0, nInvalid = 0, i;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2008-10-07 23:02:41 +00:00
|
|
|
if (!UnsafePoints || !UnsafeCounts ||
|
|
|
|
Count == 0 || iFunc == 0 || iFunc > GdiPolyPolyRgn)
|
2007-08-24 04:49:38 +00:00
|
|
|
{
|
2008-10-07 23:02:41 +00:00
|
|
|
/* Windows doesn't set last error */
|
2007-11-08 01:22:40 +00:00
|
|
|
return FALSE;
|
2007-08-24 04:49:38 +00:00
|
|
|
}
|
|
|
|
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_TRY
|
2007-08-24 04:49:38 +00:00
|
|
|
{
|
2008-10-07 23:02:41 +00:00
|
|
|
ProbeForRead(UnsafePoints, Count * sizeof(POINT), 1);
|
|
|
|
ProbeForRead(UnsafeCounts, Count * sizeof(ULONG), 1);
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2008-10-07 23:02:41 +00:00
|
|
|
/* Count points and validate poligons */
|
2007-11-08 01:22:40 +00:00
|
|
|
for (i = 0; i < Count; i++)
|
|
|
|
{
|
2008-10-07 23:02:41 +00:00
|
|
|
if (UnsafeCounts[i] < 2)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
|
|
|
nInvalid++;
|
|
|
|
}
|
2008-10-07 23:02:41 +00:00
|
|
|
nPoints += UnsafeCounts[i];
|
|
|
|
nMaxPoints = max(nMaxPoints, UnsafeCounts[i]);
|
2007-11-08 01:22:40 +00:00
|
|
|
}
|
2008-10-07 23:02:41 +00:00
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
2008-10-07 23:02:41 +00:00
|
|
|
{
|
2008-11-30 19:28:11 +00:00
|
|
|
Status = _SEH2_GetExceptionCode();
|
2008-10-07 23:02:41 +00:00
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_END;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2008-10-07 23:02:41 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
/* Windows doesn't set last error */
|
|
|
|
return FALSE;
|
|
|
|
}
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2008-10-07 23:02:41 +00:00
|
|
|
if (nPoints == 0 || nPoints < nMaxPoints)
|
|
|
|
{
|
|
|
|
/* If all polygon counts are zero, or we have overflow,
|
|
|
|
return without setting a last error code. */
|
|
|
|
return FALSE;
|
|
|
|
}
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2008-10-07 23:02:41 +00:00
|
|
|
if (nInvalid != 0)
|
|
|
|
{
|
|
|
|
/* If at least one poly count is 0 or 1, fail */
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2008-10-07 23:02:41 +00:00
|
|
|
/* Allocate one buffer for both counts and points */
|
|
|
|
pTemp = ExAllocatePoolWithTag(PagedPool,
|
|
|
|
Count * sizeof(ULONG) + nPoints * sizeof(POINT),
|
|
|
|
TAG_SHAPE);
|
|
|
|
if (!pTemp)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return FALSE;
|
2007-08-24 04:49:38 +00:00
|
|
|
}
|
2008-10-07 23:02:41 +00:00
|
|
|
|
|
|
|
SafeCounts = pTemp;
|
|
|
|
SafePoints = (PVOID)(SafeCounts + Count);
|
|
|
|
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_TRY
|
2007-08-24 04:49:38 +00:00
|
|
|
{
|
2008-10-07 23:02:41 +00:00
|
|
|
/* Pointers already probed! */
|
|
|
|
RtlCopyMemory(SafeCounts, UnsafeCounts, Count * sizeof(ULONG));
|
|
|
|
RtlCopyMemory(SafePoints, UnsafePoints, nPoints * sizeof(POINT));
|
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
2008-10-07 23:02:41 +00:00
|
|
|
{
|
2008-11-30 19:28:11 +00:00
|
|
|
Status = _SEH2_GetExceptionCode();
|
2008-10-07 23:02:41 +00:00
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_END;
|
2008-10-07 23:02:41 +00:00
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
2008-11-04 23:49:07 +00:00
|
|
|
ExFreePoolWithTag(pTemp, TAG_SHAPE);
|
2007-11-08 01:22:40 +00:00
|
|
|
return FALSE;
|
2007-08-24 04:49:38 +00:00
|
|
|
}
|
|
|
|
|
2008-10-07 23:02:41 +00:00
|
|
|
/* Special handling for GdiPolyPolyRgn */
|
|
|
|
if (iFunc == GdiPolyPolyRgn)
|
|
|
|
{
|
|
|
|
HRGN hRgn;
|
|
|
|
hRgn = IntCreatePolyPolygonRgn(SafePoints, SafeCounts, Count, (INT_PTR)hDC);
|
2008-11-04 23:49:07 +00:00
|
|
|
ExFreePoolWithTag(pTemp, TAG_SHAPE);
|
2008-10-07 23:02:41 +00:00
|
|
|
return (ULONG_PTR)hRgn;
|
|
|
|
}
|
|
|
|
|
|
|
|
dc = DC_LockDc(hDC);
|
|
|
|
if (!dc)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
ExFreePool(pTemp);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-03-20 01:35:49 +00:00
|
|
|
if (dc->dctype == DC_TYPE_INFO)
|
2008-10-07 23:02:41 +00:00
|
|
|
{
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
ExFreePool(pTemp);
|
|
|
|
/* Yes, Windows really returns TRUE in this case */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Perform the actual work */
|
2007-11-08 01:22:40 +00:00
|
|
|
switch (iFunc)
|
2007-08-24 04:49:38 +00:00
|
|
|
{
|
2007-11-08 01:22:40 +00:00
|
|
|
case GdiPolyPolygon:
|
2008-10-07 23:02:41 +00:00
|
|
|
Ret = IntGdiPolyPolygon(dc, SafePoints, SafeCounts, Count);
|
2007-11-08 01:22:40 +00:00
|
|
|
break;
|
|
|
|
case GdiPolyPolyLine:
|
2008-10-07 23:02:41 +00:00
|
|
|
Ret = IntGdiPolyPolyline(dc, SafePoints, SafeCounts, Count);
|
2007-11-08 01:22:40 +00:00
|
|
|
break;
|
|
|
|
case GdiPolyBezier:
|
2008-10-07 23:02:41 +00:00
|
|
|
Ret = IntGdiPolyBezier(dc, SafePoints, *SafeCounts);
|
2007-11-08 01:22:40 +00:00
|
|
|
break;
|
|
|
|
case GdiPolyLineTo:
|
2008-10-07 23:02:41 +00:00
|
|
|
Ret = IntGdiPolylineTo(dc, SafePoints, *SafeCounts);
|
2007-11-08 01:22:40 +00:00
|
|
|
break;
|
|
|
|
case GdiPolyBezierTo:
|
2008-10-07 23:02:41 +00:00
|
|
|
Ret = IntGdiPolyBezierTo(dc, SafePoints, *SafeCounts);
|
2007-11-08 01:22:40 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
Ret = FALSE;
|
2007-08-24 04:49:38 +00:00
|
|
|
}
|
2008-10-07 23:02:41 +00:00
|
|
|
|
|
|
|
/* Cleanup and return */
|
2007-08-24 04:49:38 +00:00
|
|
|
DC_UnlockDc(dc);
|
2008-10-07 23:02:41 +00:00
|
|
|
ExFreePool(pTemp);
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2008-10-07 23:02:41 +00:00
|
|
|
return (ULONG_PTR)Ret;
|
2007-04-26 14:42:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
2003-08-17 17:32:58 +00:00
|
|
|
FASTCALL
|
|
|
|
IntRectangle(PDC dc,
|
2007-11-08 01:22:40 +00:00
|
|
|
int LeftRect,
|
|
|
|
int TopRect,
|
|
|
|
int RightRect,
|
|
|
|
int BottomRect)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2009-01-08 16:33:40 +00:00
|
|
|
SURFACE *psurf = NULL;
|
2009-04-01 01:49:18 +00:00
|
|
|
PBRUSH pbrLine, pbrFill;
|
2007-11-08 01:22:40 +00:00
|
|
|
BOOL ret = FALSE; // default to failure
|
|
|
|
RECTL DestRect;
|
|
|
|
MIX Mix;
|
2009-03-20 04:51:26 +00:00
|
|
|
PDC_ATTR pdcattr;
|
2009-03-16 03:21:00 +00:00
|
|
|
POINTL BrushOrigin;
|
2008-05-06 20:44:25 +00:00
|
|
|
|
2007-11-08 01:22:40 +00:00
|
|
|
ASSERT ( dc ); // caller's responsibility to set this up
|
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr = dc->pdcattr;
|
2007-11-18 13:51:34 +00:00
|
|
|
|
2008-07-15 02:06:38 +00:00
|
|
|
/* Do we rotate or shear? */
|
2009-03-20 14:16:01 +00:00
|
|
|
if (!(dc->dclevel.mxWorldToDevice.flAccel & MX_SCALE))
|
2004-04-05 21:26:25 +00:00
|
|
|
{
|
2008-11-06 02:36:10 +00:00
|
|
|
|
2008-07-15 02:06:38 +00:00
|
|
|
POINTL DestCoords[4];
|
2008-11-06 02:36:10 +00:00
|
|
|
ULONG PolyCounts = 4;
|
2008-07-15 02:06:38 +00:00
|
|
|
DestCoords[0].x = DestCoords[3].x = LeftRect;
|
|
|
|
DestCoords[0].y = DestCoords[1].y = TopRect;
|
|
|
|
DestCoords[1].x = DestCoords[2].x = RightRect;
|
|
|
|
DestCoords[2].y = DestCoords[3].y = BottomRect;
|
2008-11-06 02:36:10 +00:00
|
|
|
// Use IntGdiPolyPolygon so to support PATH.
|
|
|
|
return IntGdiPolyPolygon(dc, DestCoords, &PolyCounts, 1);
|
|
|
|
}
|
|
|
|
// Rectangle Path only.
|
2009-03-20 14:16:01 +00:00
|
|
|
if ( PATH_IsPathOpen(dc->dclevel) )
|
2008-11-06 02:36:10 +00:00
|
|
|
{
|
|
|
|
return PATH_Rectangle ( dc, LeftRect, TopRect, RightRect, BottomRect );
|
2004-04-05 21:26:25 +00:00
|
|
|
}
|
2008-07-15 02:06:38 +00:00
|
|
|
|
2008-07-16 19:48:19 +00:00
|
|
|
DestRect.left = LeftRect;
|
|
|
|
DestRect.right = RightRect;
|
|
|
|
DestRect.top = TopRect;
|
|
|
|
DestRect.bottom = BottomRect;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2008-07-16 19:48:19 +00:00
|
|
|
IntLPtoDP(dc, (LPPOINT)&DestRect, 2);
|
2008-07-15 02:06:38 +00:00
|
|
|
|
2008-07-16 19:48:19 +00:00
|
|
|
DestRect.left += dc->ptlDCOrig.x;
|
|
|
|
DestRect.right += dc->ptlDCOrig.x;
|
|
|
|
DestRect.top += dc->ptlDCOrig.y;
|
|
|
|
DestRect.bottom += dc->ptlDCOrig.y;
|
2008-07-15 02:06:38 +00:00
|
|
|
|
2008-07-16 19:48:19 +00:00
|
|
|
/* In GM_COMPATIBLE, don't include bottom and right edges */
|
2009-03-24 02:58:14 +00:00
|
|
|
if (pdcattr->iGraphicsMode == GM_COMPATIBLE)
|
2008-07-16 19:48:19 +00:00
|
|
|
{
|
|
|
|
DestRect.right--;
|
|
|
|
DestRect.bottom--;
|
|
|
|
}
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2009-04-05 23:51:27 +00:00
|
|
|
if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
|
|
|
|
DC_vUpdateFillBrush(dc);
|
2008-11-15 13:37:26 +00:00
|
|
|
|
2009-04-05 23:51:27 +00:00
|
|
|
if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
|
|
|
|
DC_vUpdateLineBrush(dc);
|
2008-11-15 13:37:26 +00:00
|
|
|
|
2009-04-01 01:49:18 +00:00
|
|
|
pbrFill = dc->dclevel.pbrFill;
|
|
|
|
pbrLine = dc->dclevel.pbrLine;
|
|
|
|
if (!pbrLine)
|
2008-07-16 19:48:19 +00:00
|
|
|
{
|
|
|
|
ret = FALSE;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2009-04-14 20:50:02 +00:00
|
|
|
psurf = dc->dclevel.pSurface;
|
2009-01-08 16:33:40 +00:00
|
|
|
if (!psurf)
|
2008-07-16 19:48:19 +00:00
|
|
|
{
|
|
|
|
ret = FALSE;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
2009-04-01 01:49:18 +00:00
|
|
|
if (pbrFill)
|
2008-07-16 19:48:19 +00:00
|
|
|
{
|
2009-04-01 01:49:18 +00:00
|
|
|
if (!(pbrFill->flAttrs & GDIBRUSH_IS_NULL))
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2009-04-01 01:49:18 +00:00
|
|
|
BrushOrigin = *((PPOINTL)&pbrFill->ptOrigin);
|
2009-03-16 03:21:00 +00:00
|
|
|
BrushOrigin.x += dc->ptlDCOrig.x;
|
|
|
|
BrushOrigin.y += dc->ptlDCOrig.y;
|
2009-01-08 16:33:40 +00:00
|
|
|
ret = IntEngBitBlt(&psurf->SurfObj,
|
2008-07-16 19:48:19 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2009-03-20 01:35:49 +00:00
|
|
|
dc->rosdc.CombinedClip,
|
2008-07-16 19:48:19 +00:00
|
|
|
NULL,
|
|
|
|
&DestRect,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2009-04-01 01:49:18 +00:00
|
|
|
&dc->eboFill.BrushObject,
|
2009-03-16 03:21:00 +00:00
|
|
|
&BrushOrigin,
|
2008-07-16 19:48:19 +00:00
|
|
|
ROP3_TO_ROP4(PATCOPY));
|
2007-11-08 01:22:40 +00:00
|
|
|
}
|
2008-07-16 19:48:19 +00:00
|
|
|
}
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2008-07-16 19:48:19 +00:00
|
|
|
// Draw the rectangle with the current pen
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2008-07-16 19:48:19 +00:00
|
|
|
ret = TRUE; // change default to success
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2009-04-01 01:49:18 +00:00
|
|
|
if (!(pbrLine->flAttrs & GDIBRUSH_IS_NULL))
|
2008-07-16 19:48:19 +00:00
|
|
|
{
|
2009-03-20 04:51:26 +00:00
|
|
|
Mix = ROP2_TO_MIX(pdcattr->jROP2);
|
2009-01-08 16:33:40 +00:00
|
|
|
ret = ret && IntEngLineTo(&psurf->SurfObj,
|
2009-03-20 01:35:49 +00:00
|
|
|
dc->rosdc.CombinedClip,
|
2009-04-01 01:49:18 +00:00
|
|
|
&dc->eboLine.BrushObject,
|
2008-07-16 19:48:19 +00:00
|
|
|
DestRect.left, DestRect.top, DestRect.right, DestRect.top,
|
|
|
|
&DestRect, // Bounding rectangle
|
|
|
|
Mix);
|
|
|
|
|
2009-01-08 16:33:40 +00:00
|
|
|
ret = ret && IntEngLineTo(&psurf->SurfObj,
|
2009-03-20 01:35:49 +00:00
|
|
|
dc->rosdc.CombinedClip,
|
2009-04-01 01:49:18 +00:00
|
|
|
&dc->eboLine.BrushObject,
|
2008-07-16 19:48:19 +00:00
|
|
|
DestRect.right, DestRect.top, DestRect.right, DestRect.bottom,
|
|
|
|
&DestRect, // Bounding rectangle
|
|
|
|
Mix);
|
|
|
|
|
2009-01-08 16:33:40 +00:00
|
|
|
ret = ret && IntEngLineTo(&psurf->SurfObj,
|
2009-03-20 01:35:49 +00:00
|
|
|
dc->rosdc.CombinedClip,
|
2009-04-01 01:49:18 +00:00
|
|
|
&dc->eboLine.BrushObject,
|
2008-07-16 19:48:19 +00:00
|
|
|
DestRect.right, DestRect.bottom, DestRect.left, DestRect.bottom,
|
|
|
|
&DestRect, // Bounding rectangle
|
|
|
|
Mix);
|
|
|
|
|
2009-01-08 16:33:40 +00:00
|
|
|
ret = ret && IntEngLineTo(&psurf->SurfObj,
|
2009-03-20 01:35:49 +00:00
|
|
|
dc->rosdc.CombinedClip,
|
2009-04-01 01:49:18 +00:00
|
|
|
&dc->eboLine.BrushObject,
|
2008-07-16 19:48:19 +00:00
|
|
|
DestRect.left, DestRect.bottom, DestRect.left, DestRect.top,
|
|
|
|
&DestRect, // Bounding rectangle
|
|
|
|
Mix);
|
2003-08-17 17:32:58 +00:00
|
|
|
}
|
2004-04-05 21:26:25 +00:00
|
|
|
|
2008-07-15 02:06:38 +00:00
|
|
|
cleanup:
|
2007-11-08 01:22:40 +00:00
|
|
|
/* Move current position in DC?
|
|
|
|
MSDN: The current position is neither used nor updated by Rectangle. */
|
2003-10-04 20:04:10 +00:00
|
|
|
|
2008-07-15 02:06:38 +00:00
|
|
|
return ret;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2003-08-17 17:32:58 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiRectangle(HDC hDC,
|
2007-11-08 01:22:40 +00:00
|
|
|
int LeftRect,
|
|
|
|
int TopRect,
|
|
|
|
int RightRect,
|
|
|
|
int BottomRect)
|
2003-08-17 17:32:58 +00:00
|
|
|
{
|
2007-11-08 01:22:40 +00:00
|
|
|
DC *dc;
|
|
|
|
BOOL ret; // default to failure
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2007-11-08 01:22:40 +00:00
|
|
|
dc = DC_LockDc(hDC);
|
|
|
|
if (!dc)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2009-03-20 01:35:49 +00:00
|
|
|
if (dc->dctype == DC_TYPE_INFO)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
/* Yes, Windows really returns TRUE in this case */
|
|
|
|
return TRUE;
|
|
|
|
}
|
2003-08-17 17:32:58 +00:00
|
|
|
|
2007-11-08 01:22:40 +00:00
|
|
|
ret = IntRectangle ( dc, LeftRect, TopRect, RightRect, BottomRect );
|
|
|
|
DC_UnlockDc ( dc );
|
|
|
|
|
|
|
|
return ret;
|
2003-08-17 17:32:58 +00:00
|
|
|
}
|
|
|
|
|
2003-09-09 15:49:59 +00:00
|
|
|
|
|
|
|
BOOL
|
|
|
|
FASTCALL
|
|
|
|
IntRoundRect(
|
2007-11-08 01:22:40 +00:00
|
|
|
PDC dc,
|
2008-07-02 07:47:23 +00:00
|
|
|
int Left,
|
|
|
|
int Top,
|
|
|
|
int Right,
|
|
|
|
int Bottom,
|
2007-11-08 01:22:40 +00:00
|
|
|
int xCurveDiameter,
|
|
|
|
int yCurveDiameter)
|
2003-09-09 15:49:59 +00:00
|
|
|
{
|
2009-03-20 04:51:26 +00:00
|
|
|
PDC_ATTR pdcattr;
|
2009-03-20 22:40:14 +00:00
|
|
|
PBRUSH pbrushLine, pbrushFill;
|
2008-07-02 07:47:23 +00:00
|
|
|
RECTL RectBounds;
|
|
|
|
LONG PenWidth, PenOrigWidth;
|
|
|
|
BOOL ret = TRUE; // default to success
|
2009-03-20 22:40:14 +00:00
|
|
|
BRUSH brushTemp;
|
2003-09-09 15:49:59 +00:00
|
|
|
|
2007-11-08 01:22:40 +00:00
|
|
|
ASSERT ( dc ); // caller's responsibility to set this up
|
2003-09-09 15:49:59 +00:00
|
|
|
|
2009-03-20 14:16:01 +00:00
|
|
|
if ( PATH_IsPathOpen(dc->dclevel) )
|
2008-07-02 07:47:23 +00:00
|
|
|
return PATH_RoundRect ( dc, Left, Top, Right, Bottom,
|
2007-11-08 01:22:40 +00:00
|
|
|
xCurveDiameter, yCurveDiameter );
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2008-07-02 07:47:23 +00:00
|
|
|
if ((Left == Right) || (Top == Bottom)) return TRUE;
|
2003-09-09 15:49:59 +00:00
|
|
|
|
2008-07-02 07:47:23 +00:00
|
|
|
xCurveDiameter = max(abs( xCurveDiameter ), 1);
|
|
|
|
yCurveDiameter = max(abs( yCurveDiameter ), 1);
|
2003-09-09 15:49:59 +00:00
|
|
|
|
2008-07-02 07:47:23 +00:00
|
|
|
if (Right < Left)
|
2005-02-20 17:35:50 +00:00
|
|
|
{
|
2008-07-02 07:47:23 +00:00
|
|
|
INT tmp = Right; Right = Left; Left = tmp;
|
2005-02-20 17:35:50 +00:00
|
|
|
}
|
2008-07-02 07:47:23 +00:00
|
|
|
if (Bottom < Top)
|
2005-02-20 17:35:50 +00:00
|
|
|
{
|
2008-07-02 07:47:23 +00:00
|
|
|
INT tmp = Bottom; Bottom = Top; Top = tmp;
|
2005-02-20 17:35:50 +00:00
|
|
|
}
|
2003-09-09 15:49:59 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr = dc->pdcattr;
|
2008-07-02 07:47:23 +00:00
|
|
|
|
2009-04-08 18:10:33 +00:00
|
|
|
if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
|
|
|
|
DC_vUpdateFillBrush(dc);
|
2008-11-15 13:37:26 +00:00
|
|
|
|
2009-04-08 18:10:33 +00:00
|
|
|
if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
|
|
|
|
DC_vUpdateLineBrush(dc);
|
2008-11-15 13:37:26 +00:00
|
|
|
|
2009-03-23 00:38:59 +00:00
|
|
|
pbrushLine = PEN_LockPen(pdcattr->hpen);
|
2009-03-20 22:40:14 +00:00
|
|
|
if (!pbrushLine)
|
2005-02-20 17:35:50 +00:00
|
|
|
{
|
2008-07-02 07:47:23 +00:00
|
|
|
/* Nothing to do, as we don't have a bitmap */
|
|
|
|
SetLastWin32Error(ERROR_INTERNAL_ERROR);
|
|
|
|
return FALSE;
|
2005-02-20 17:35:50 +00:00
|
|
|
}
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2009-03-20 22:40:14 +00:00
|
|
|
PenOrigWidth = PenWidth = pbrushLine->ptPenWidth.x;
|
|
|
|
if (pbrushLine->ulPenStyle == PS_NULL) PenWidth = 0;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2009-03-20 22:40:14 +00:00
|
|
|
if (pbrushLine->ulPenStyle == PS_INSIDEFRAME)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2008-07-02 07:47:23 +00:00
|
|
|
if (2*PenWidth > (Right - Left)) PenWidth = (Right -Left + 1)/2;
|
|
|
|
if (2*PenWidth > (Bottom - Top)) PenWidth = (Bottom -Top + 1)/2;
|
|
|
|
Left += PenWidth / 2;
|
|
|
|
Right -= (PenWidth - 1) / 2;
|
|
|
|
Top += PenWidth / 2;
|
|
|
|
Bottom -= (PenWidth - 1) / 2;
|
2007-11-08 01:22:40 +00:00
|
|
|
}
|
|
|
|
|
2008-07-02 07:47:23 +00:00
|
|
|
if (!PenWidth) PenWidth = 1;
|
2009-03-20 22:40:14 +00:00
|
|
|
pbrushLine->ptPenWidth.x = PenWidth;
|
2003-09-09 15:49:59 +00:00
|
|
|
|
2008-07-02 07:47:23 +00:00
|
|
|
RectBounds.left = Left;
|
|
|
|
RectBounds.top = Top;
|
|
|
|
RectBounds.right = Right;
|
|
|
|
RectBounds.bottom = Bottom;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2008-07-02 07:47:23 +00:00
|
|
|
IntLPtoDP(dc, (LPPOINT)&RectBounds, 2);
|
2003-09-09 15:49:59 +00:00
|
|
|
|
2008-07-02 07:47:23 +00:00
|
|
|
RectBounds.left += dc->ptlDCOrig.x;
|
|
|
|
RectBounds.top += dc->ptlDCOrig.y;
|
|
|
|
RectBounds.right += dc->ptlDCOrig.x;
|
|
|
|
RectBounds.bottom += dc->ptlDCOrig.y;
|
2003-09-09 15:49:59 +00:00
|
|
|
|
2009-03-20 22:40:14 +00:00
|
|
|
pbrushFill = BRUSH_LockBrush(pdcattr->hbrush);
|
|
|
|
if (NULL == pbrushFill)
|
2009-03-16 03:21:00 +00:00
|
|
|
{
|
|
|
|
DPRINT1("FillRound Fail\n");
|
|
|
|
SetLastWin32Error(ERROR_INTERNAL_ERROR);
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-20 22:40:14 +00:00
|
|
|
RtlCopyMemory(&brushTemp, pbrushFill, sizeof(brushTemp));
|
|
|
|
brushTemp.ptOrigin.x += RectBounds.left - Left;
|
|
|
|
brushTemp.ptOrigin.y += RectBounds.top - Top;
|
2009-03-16 03:21:00 +00:00
|
|
|
ret = IntFillRoundRect( dc,
|
|
|
|
RectBounds.left,
|
|
|
|
RectBounds.top,
|
|
|
|
RectBounds.right,
|
|
|
|
RectBounds.bottom,
|
|
|
|
xCurveDiameter,
|
|
|
|
yCurveDiameter,
|
2009-03-20 22:40:14 +00:00
|
|
|
&brushTemp);
|
|
|
|
BRUSH_UnlockBrush(pbrushFill);
|
2009-03-16 03:21:00 +00:00
|
|
|
}
|
|
|
|
|
2008-07-02 07:47:23 +00:00
|
|
|
if (ret)
|
|
|
|
ret = IntDrawRoundRect( dc,
|
|
|
|
RectBounds.left,
|
|
|
|
RectBounds.top,
|
|
|
|
RectBounds.right,
|
|
|
|
RectBounds.bottom,
|
|
|
|
xCurveDiameter,
|
|
|
|
yCurveDiameter,
|
2009-03-20 22:40:14 +00:00
|
|
|
pbrushLine);
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2009-03-20 22:40:14 +00:00
|
|
|
pbrushLine->ptPenWidth.x = PenOrigWidth;
|
2009-03-23 00:38:59 +00:00
|
|
|
PEN_UnlockPen(pbrushLine);
|
2007-11-08 01:22:40 +00:00
|
|
|
return ret;
|
2003-09-09 15:49:59 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2003-09-09 15:49:59 +00:00
|
|
|
NtGdiRoundRect(
|
2007-11-08 01:22:40 +00:00
|
|
|
HDC hDC,
|
|
|
|
int LeftRect,
|
|
|
|
int TopRect,
|
|
|
|
int RightRect,
|
|
|
|
int BottomRect,
|
|
|
|
int Width,
|
|
|
|
int Height)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2007-11-08 01:22:40 +00:00
|
|
|
DC *dc = DC_LockDc(hDC);
|
|
|
|
BOOL ret = FALSE; /* default to failure */
|
|
|
|
|
|
|
|
DPRINT("NtGdiRoundRect(0x%x,%i,%i,%i,%i,%i,%i)\n",hDC,LeftRect,TopRect,RightRect,BottomRect,Width,Height);
|
|
|
|
if ( !dc )
|
|
|
|
{
|
|
|
|
DPRINT1("NtGdiRoundRect() - hDC is invalid\n");
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
}
|
2009-03-20 01:35:49 +00:00
|
|
|
else if (dc->dctype == DC_TYPE_INFO)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
/* Yes, Windows really returns TRUE in this case */
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ret = IntRoundRect ( dc, LeftRect, TopRect, RightRect, BottomRect, Width, Height );
|
|
|
|
DC_UnlockDc ( dc );
|
|
|
|
}
|
2003-08-20 20:24:35 +00:00
|
|
|
|
2007-11-08 01:22:40 +00:00
|
|
|
return ret;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
2004-02-08 21:37:53 +00:00
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
BOOL
|
|
|
|
NTAPI
|
|
|
|
GreGradientFill(
|
|
|
|
HDC hdc,
|
2007-11-08 01:22:40 +00:00
|
|
|
PTRIVERTEX pVertex,
|
2010-05-25 11:55:04 +00:00
|
|
|
ULONG nVertex,
|
2007-11-08 01:22:40 +00:00
|
|
|
PVOID pMesh,
|
2010-05-25 11:55:04 +00:00
|
|
|
ULONG nMesh,
|
2007-11-08 01:22:40 +00:00
|
|
|
ULONG ulMode)
|
2004-02-08 21:37:53 +00:00
|
|
|
{
|
2010-05-25 11:55:04 +00:00
|
|
|
PDC pdc;
|
2009-01-08 16:33:40 +00:00
|
|
|
SURFACE *psurf;
|
2010-05-25 11:55:04 +00:00
|
|
|
PPALETTE ppal;
|
2009-08-04 20:37:10 +00:00
|
|
|
EXLATEOBJ exlo;
|
2010-05-25 11:55:04 +00:00
|
|
|
RECTL rclExtent;
|
|
|
|
POINTL ptlDitherOrg;
|
2009-08-04 20:37:10 +00:00
|
|
|
ULONG i;
|
2010-05-25 11:55:04 +00:00
|
|
|
BOOL bRet;
|
2008-05-29 01:17:50 +00:00
|
|
|
HPALETTE hDestPalette;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
/* Check parameters */
|
|
|
|
if (ulMode == GRADIENT_FILL_TRIANGLE)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2010-05-25 11:55:04 +00:00
|
|
|
PGRADIENT_TRIANGLE pTriangle = (PGRADIENT_TRIANGLE)pMesh;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
for (i = 0; i < nMesh; i++, pTriangle++)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2010-05-25 11:55:04 +00:00
|
|
|
if (pTriangle->Vertex1 >= nVertex ||
|
|
|
|
pTriangle->Vertex2 >= nVertex ||
|
|
|
|
pTriangle->Vertex3 >= nVertex)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
2004-02-08 21:37:53 +00:00
|
|
|
}
|
2007-11-08 01:22:40 +00:00
|
|
|
else
|
2004-02-08 21:37:53 +00:00
|
|
|
{
|
2010-05-25 11:55:04 +00:00
|
|
|
PGRADIENT_RECT pRect = (PGRADIENT_RECT)pMesh;
|
|
|
|
for (i = 0; i < nMesh; i++, pRect++)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2010-05-25 11:55:04 +00:00
|
|
|
if (pRect->UpperLeft >= nVertex || pRect->LowerRight >= nVertex)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
/* Lock the output DC */
|
|
|
|
pdc = DC_LockDc(hdc);
|
|
|
|
if (!pdc)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pdc->dctype == DC_TYPE_INFO)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2010-05-25 11:55:04 +00:00
|
|
|
DC_UnlockDc(pdc);
|
|
|
|
/* Yes, Windows really returns TRUE in this case */
|
|
|
|
return TRUE;
|
2007-11-08 01:22:40 +00:00
|
|
|
}
|
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
psurf = pdc->dclevel.pSurface;
|
|
|
|
if (!psurf)
|
|
|
|
{
|
|
|
|
/* Memory DC with no surface selected */
|
|
|
|
DC_UnlockDc(pdc);
|
|
|
|
return TRUE; // CHECKME
|
|
|
|
}
|
2009-04-09 00:40:37 +00:00
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
/* calculate extent */
|
|
|
|
rclExtent.left = rclExtent.right = pVertex->x;
|
|
|
|
rclExtent.top = rclExtent.bottom = pVertex->y;
|
|
|
|
for (i = 0; i < nVertex; i++)
|
|
|
|
{
|
|
|
|
rclExtent.left = min(rclExtent.left, (pVertex + i)->x);
|
|
|
|
rclExtent.right = max(rclExtent.right, (pVertex + i)->x);
|
|
|
|
rclExtent.top = min(rclExtent.top, (pVertex + i)->y);
|
|
|
|
rclExtent.bottom = max(rclExtent.bottom, (pVertex + i)->y);
|
|
|
|
}
|
2009-04-08 16:53:21 +00:00
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
IntLPtoDP(pdc, (LPPOINT)&rclExtent, 2);
|
|
|
|
rclExtent.left += pdc->ptlDCOrig.x;
|
|
|
|
rclExtent.right += pdc->ptlDCOrig.x;
|
|
|
|
rclExtent.top += pdc->ptlDCOrig.y;
|
|
|
|
rclExtent.bottom += pdc->ptlDCOrig.y;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
ptlDitherOrg.x = ptlDitherOrg.y = 0;
|
|
|
|
IntLPtoDP(pdc, (LPPOINT)&ptlDitherOrg, 1);
|
|
|
|
ptlDitherOrg.x += pdc->ptlDCOrig.x;
|
|
|
|
ptlDitherOrg.y += pdc->ptlDCOrig.y;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2009-01-08 16:33:40 +00:00
|
|
|
hDestPalette = psurf->hDIBPalette;
|
2009-08-16 12:57:41 +00:00
|
|
|
if (!hDestPalette) hDestPalette = pPrimarySurface->devinfo.hpalDefault;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
ppal = PALETTE_LockPalette(hDestPalette);
|
|
|
|
EXLATEOBJ_vInitialize(&exlo, &gpalRGB, ppal, 0, 0, 0);
|
|
|
|
|
|
|
|
ASSERT(pdc->rosdc.CombinedClip);
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
bRet = IntEngGradientFill(&psurf->SurfObj,
|
|
|
|
pdc->rosdc.CombinedClip,
|
|
|
|
&exlo.xlo,
|
|
|
|
pVertex,
|
|
|
|
nVertex,
|
|
|
|
pMesh,
|
|
|
|
nMesh,
|
|
|
|
&rclExtent,
|
|
|
|
&ptlDitherOrg,
|
|
|
|
ulMode);
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2009-08-04 20:37:10 +00:00
|
|
|
EXLATEOBJ_vCleanup(&exlo);
|
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
if (ppal)
|
|
|
|
PALETTE_UnlockPalette(ppal);
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2010-05-26 22:33:10 +00:00
|
|
|
DC_UnlockDc(pdc);
|
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
return bRet;
|
2004-02-08 21:37:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2004-02-08 21:37:53 +00:00
|
|
|
NtGdiGradientFill(
|
2007-11-08 01:22:40 +00:00
|
|
|
HDC hdc,
|
|
|
|
PTRIVERTEX pVertex,
|
2010-05-25 11:55:04 +00:00
|
|
|
ULONG nVertex,
|
2007-11-08 01:22:40 +00:00
|
|
|
PVOID pMesh,
|
2010-05-25 11:55:04 +00:00
|
|
|
ULONG nMesh,
|
2007-11-08 01:22:40 +00:00
|
|
|
ULONG ulMode)
|
2004-02-08 21:37:53 +00:00
|
|
|
{
|
2010-05-25 11:55:04 +00:00
|
|
|
BOOL bRet;
|
2007-11-08 01:22:40 +00:00
|
|
|
PTRIVERTEX SafeVertex;
|
|
|
|
PVOID SafeMesh;
|
2010-05-25 11:55:04 +00:00
|
|
|
ULONG cbVertex, cbMesh;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
/* Validate parameters */
|
|
|
|
if (!pVertex || !nVertex || !pMesh || !nMesh)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-07-26 12:22:55 +00:00
|
|
|
|
2007-11-08 01:22:40 +00:00
|
|
|
switch (ulMode)
|
|
|
|
{
|
|
|
|
case GRADIENT_FILL_RECT_H:
|
|
|
|
case GRADIENT_FILL_RECT_V:
|
2010-05-25 11:55:04 +00:00
|
|
|
cbMesh = nMesh * sizeof(GRADIENT_RECT);
|
2007-11-08 01:22:40 +00:00
|
|
|
break;
|
|
|
|
case GRADIENT_FILL_TRIANGLE:
|
2010-05-25 11:55:04 +00:00
|
|
|
cbMesh = nMesh * sizeof(GRADIENT_TRIANGLE);
|
2007-11-08 01:22:40 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
cbVertex = nVertex * sizeof(TRIVERTEX);
|
|
|
|
if (cbVertex + cbMesh <= cbVertex)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2010-05-25 11:55:04 +00:00
|
|
|
/* Overflow */
|
2007-11-08 01:22:40 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
/* Allocate a kernel mode buffer */
|
|
|
|
SafeVertex = ExAllocatePoolWithTag(PagedPool, cbVertex + cbMesh, TAG_SHAPE);
|
|
|
|
if (!SafeVertex)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
SafeMesh = (PVOID)((ULONG_PTR)SafeVertex + cbVertex);
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
/* Copy the parameters to kernel mode */
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_TRY
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2010-05-25 11:55:04 +00:00
|
|
|
ProbeForRead(pVertex, cbVertex, 1);
|
|
|
|
ProbeForRead(pMesh, cbMesh, 1);
|
|
|
|
RtlCopyMemory(SafeVertex, pVertex, cbVertex);
|
|
|
|
RtlCopyMemory(SafeMesh, pMesh, cbMesh);
|
2007-11-08 01:22:40 +00:00
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
2007-11-08 01:22:40 +00:00
|
|
|
{
|
2008-11-04 23:49:07 +00:00
|
|
|
ExFreePoolWithTag(SafeVertex, TAG_SHAPE);
|
2010-05-25 11:55:04 +00:00
|
|
|
SetLastNtError(_SEH2_GetExceptionCode());
|
|
|
|
_SEH2_YIELD(return FALSE;)
|
2007-11-08 01:22:40 +00:00
|
|
|
}
|
2010-05-25 11:55:04 +00:00
|
|
|
_SEH2_END;
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
/* Call the internal function */
|
|
|
|
bRet = GreGradientFill(hdc, SafeVertex, nVertex, SafeMesh, nMesh, ulMode);
|
2007-11-08 01:22:40 +00:00
|
|
|
|
2010-05-25 11:55:04 +00:00
|
|
|
/* Cleanup and return result */
|
|
|
|
ExFreePoolWithTag(SafeVertex, TAG_SHAPE);
|
|
|
|
return bRet;
|
2004-02-08 21:37:53 +00:00
|
|
|
}
|
|
|
|
|
2008-11-29 22:48:58 +00:00
|
|
|
BOOL APIENTRY
|
2007-08-23 17:04:28 +00:00
|
|
|
NtGdiExtFloodFill(
|
2007-11-08 01:22:40 +00:00
|
|
|
HDC hDC,
|
|
|
|
INT XStart,
|
|
|
|
INT YStart,
|
|
|
|
COLORREF Color,
|
|
|
|
UINT FillType)
|
2007-08-23 17:04:28 +00:00
|
|
|
{
|
2009-03-16 03:21:00 +00:00
|
|
|
PDC dc;
|
2009-08-01 14:39:40 +00:00
|
|
|
PDC_ATTR pdcattr;
|
|
|
|
SURFACE *psurf = NULL;
|
2009-08-04 20:37:10 +00:00
|
|
|
HPALETTE hpal;
|
|
|
|
PPALETTE ppal;
|
|
|
|
EXLATEOBJ exlo;
|
2009-03-16 03:21:00 +00:00
|
|
|
BOOL Ret = FALSE;
|
|
|
|
RECTL DestRect;
|
|
|
|
POINTL Pt;
|
2009-08-01 14:39:40 +00:00
|
|
|
ULONG ConvColor;
|
2009-03-16 03:21:00 +00:00
|
|
|
|
|
|
|
dc = DC_LockDc(hDC);
|
|
|
|
if (!dc)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2009-03-20 01:35:49 +00:00
|
|
|
if (dc->dctype == DC_TYPE_INFO)
|
2009-03-16 03:21:00 +00:00
|
|
|
{
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
/* Yes, Windows really returns TRUE in this case */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr = dc->pdcattr;
|
2009-03-16 03:21:00 +00:00
|
|
|
|
2009-04-01 01:49:18 +00:00
|
|
|
if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
|
|
|
|
DC_vUpdateFillBrush(dc);
|
2009-03-16 03:21:00 +00:00
|
|
|
|
2009-04-01 01:49:18 +00:00
|
|
|
if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
|
|
|
|
DC_vUpdateLineBrush(dc);
|
2009-03-16 03:21:00 +00:00
|
|
|
|
|
|
|
Pt.x = XStart;
|
|
|
|
Pt.y = YStart;
|
|
|
|
IntLPtoDP(dc, (LPPOINT)&Pt, 1);
|
|
|
|
|
2009-03-20 01:35:49 +00:00
|
|
|
Ret = NtGdiPtInRegion(dc->rosdc.hGCClipRgn, Pt.x, Pt.y);
|
2009-03-16 03:21:00 +00:00
|
|
|
if (Ret)
|
2009-03-20 01:35:49 +00:00
|
|
|
IntGdiGetRgnBox(dc->rosdc.hGCClipRgn,(LPRECT)&DestRect);
|
2009-03-16 03:21:00 +00:00
|
|
|
else
|
|
|
|
goto cleanup;
|
|
|
|
|
2009-04-14 20:50:02 +00:00
|
|
|
psurf = dc->dclevel.pSurface;
|
2009-03-16 03:21:00 +00:00
|
|
|
if (!psurf)
|
|
|
|
{
|
|
|
|
Ret = FALSE;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
2009-08-04 20:37:10 +00:00
|
|
|
hpal = dc->dclevel.pSurface->hDIBPalette;
|
2009-08-16 12:57:41 +00:00
|
|
|
if (!hpal) hpal = pPrimarySurface->devinfo.hpalDefault;
|
2009-08-04 20:37:10 +00:00
|
|
|
ppal = PALETTE_ShareLockPalette(hpal);
|
|
|
|
|
|
|
|
EXLATEOBJ_vInitialize(&exlo, &gpalRGB, ppal, 0, 0xffffff, 0);
|
2009-07-31 15:41:09 +00:00
|
|
|
|
2009-08-01 14:39:40 +00:00
|
|
|
/* Only solid fills supported for now
|
|
|
|
* How to support pattern brushes and non standard surfaces (not offering dib functions):
|
|
|
|
* Version a (most likely slow): call DrvPatBlt for every pixel
|
|
|
|
* Version b: create a flood mask and let MaskBlt blit a masked brush */
|
2009-08-04 20:37:10 +00:00
|
|
|
ConvColor = XLATEOBJ_iXlate(&exlo.xlo, Color);
|
|
|
|
Ret = DIB_XXBPP_FloodFillSolid(&psurf->SurfObj, &dc->eboFill.BrushObject, &DestRect, &Pt, ConvColor, FillType);
|
|
|
|
|
|
|
|
EXLATEOBJ_vCleanup(&exlo);
|
|
|
|
PALETTE_ShareUnlockPalette(ppal);
|
2009-07-31 15:41:09 +00:00
|
|
|
|
2008-11-15 13:37:26 +00:00
|
|
|
cleanup:
|
2009-03-16 03:21:00 +00:00
|
|
|
DC_UnlockDc(dc);
|
|
|
|
return Ret;
|
2007-08-23 17:04:28 +00:00
|
|
|
}
|
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
/* EOF */
|