2000-03-17 21:44:02 +00:00
|
|
|
/*
|
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-01-06 13:58:04 +00:00
|
|
|
/* $Id$
|
2005-05-08 02:11:54 +00:00
|
|
|
*
|
2000-03-17 21:44:02 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* PURPOSE: GDI Driver Paint Functions
|
|
|
|
* FILE: subsys/win32k/eng/paint.c
|
|
|
|
* PROGRAMER: Jason Filby
|
|
|
|
* REVISION HISTORY:
|
|
|
|
* 3/7/1999: Created
|
|
|
|
*/
|
|
|
|
|
2010-04-26 13:58:46 +00:00
|
|
|
#include <win32k.h>
|
2002-08-18 07:02:57 +00:00
|
|
|
|
2005-06-29 07:09:25 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2009-03-26 02:33:15 +00:00
|
|
|
static BOOL APIENTRY FillSolidUnlocked(SURFOBJ *pso, PRECTL pRect, ULONG iColor)
|
2000-03-17 21:44:02 +00:00
|
|
|
{
|
2002-01-13 22:52:08 +00:00
|
|
|
LONG y;
|
2003-03-04 10:09:01 +00:00
|
|
|
ULONG LineWidth;
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2009-01-08 16:33:40 +00:00
|
|
|
ASSERT(pso);
|
|
|
|
ASSERT(pRect);
|
|
|
|
MouseSafetyOnDrawStart(pso, pRect->left, pRect->top, pRect->right, pRect->bottom);
|
2002-08-18 07:02:57 +00:00
|
|
|
LineWidth = pRect->right - pRect->left;
|
|
|
|
DPRINT(" LineWidth: %d, top: %d, bottom: %d\n", LineWidth, pRect->top, pRect->bottom);
|
|
|
|
for (y = pRect->top; y < pRect->bottom; y++)
|
2001-03-31 15:35:08 +00:00
|
|
|
{
|
2009-01-08 16:33:40 +00:00
|
|
|
DibFunctionsForBitmapFormat[pso->iBitmapFormat].DIB_HLine(
|
|
|
|
pso, pRect->left, pRect->right, y, iColor);
|
2001-03-31 15:35:08 +00:00
|
|
|
}
|
2009-01-08 16:33:40 +00:00
|
|
|
MouseSafetyOnDrawEnd(pso);
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2001-03-31 15:35:08 +00:00
|
|
|
return TRUE;
|
2000-03-17 21:44:02 +00:00
|
|
|
}
|
|
|
|
|
2009-03-26 02:33:15 +00:00
|
|
|
BOOL APIENTRY FillSolid(SURFOBJ *pso, PRECTL pRect, ULONG iColor)
|
|
|
|
{
|
|
|
|
SURFACE *psurf;
|
|
|
|
BOOL Result;
|
|
|
|
psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj);
|
|
|
|
SURFACE_LockBitmapBits(psurf);
|
|
|
|
Result = FillSolidUnlocked(pso, pRect, iColor);
|
|
|
|
SURFACE_UnlockBitmapBits(psurf);
|
|
|
|
return Result;
|
|
|
|
}
|
|
|
|
|
2008-11-29 22:48:58 +00:00
|
|
|
BOOL APIENTRY
|
2009-01-08 16:33:40 +00:00
|
|
|
EngPaintRgn(SURFOBJ *pso, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix,
|
2004-07-03 13:55:37 +00:00
|
|
|
BRUSHOBJ *BrushObj, POINTL *BrushPoint)
|
2000-03-17 21:44:02 +00:00
|
|
|
{
|
2001-03-31 15:35:08 +00:00
|
|
|
RECT_ENUM RectEnum;
|
|
|
|
BOOL EnumMore;
|
2003-02-15 19:16:34 +00:00
|
|
|
ULONG i;
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2009-01-08 16:33:40 +00:00
|
|
|
ASSERT(pso);
|
2004-12-14 04:55:43 +00:00
|
|
|
ASSERT(ClipRegion);
|
|
|
|
|
2002-08-18 07:02:57 +00:00
|
|
|
DPRINT("ClipRegion->iMode:%d, ClipRegion->iDComplexity: %d\n Color: %d", ClipRegion->iMode, ClipRegion->iDComplexity, iColor);
|
2001-03-31 15:35:08 +00:00
|
|
|
switch(ClipRegion->iMode) {
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2001-03-31 15:35:08 +00:00
|
|
|
case TC_RECTANGLES:
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2001-03-31 15:35:08 +00:00
|
|
|
/* Rectangular clipping can be handled without enumeration.
|
|
|
|
Note that trivial clipping is not possible, since the clipping
|
|
|
|
region defines the area to fill */
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2001-03-31 15:35:08 +00:00
|
|
|
if (ClipRegion->iDComplexity == DC_RECT)
|
|
|
|
{
|
2009-03-26 02:33:15 +00:00
|
|
|
FillSolidUnlocked(pso, &(ClipRegion->rclBounds), iColor);
|
2001-03-31 15:35:08 +00:00
|
|
|
} else {
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2001-03-31 15:35:08 +00:00
|
|
|
/* Enumerate all the rectangles and draw them */
|
2003-12-31 16:10:35 +00:00
|
|
|
CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, CD_ANY, 0);
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2001-03-31 15:35:08 +00:00
|
|
|
do {
|
|
|
|
EnumMore = CLIPOBJ_bEnum(ClipRegion, sizeof(RectEnum), (PVOID) &RectEnum);
|
2003-02-15 19:16:34 +00:00
|
|
|
for (i = 0; i < RectEnum.c; i++) {
|
2009-03-26 02:33:15 +00:00
|
|
|
FillSolidUnlocked(pso, RectEnum.arcl + i, iColor);
|
2003-02-15 19:16:34 +00:00
|
|
|
}
|
2001-03-31 15:35:08 +00:00
|
|
|
} while (EnumMore);
|
|
|
|
}
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2001-03-31 15:35:08 +00:00
|
|
|
return(TRUE);
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2001-03-31 15:35:08 +00:00
|
|
|
default:
|
|
|
|
return(FALSE);
|
|
|
|
}
|
2000-03-17 21:44:02 +00:00
|
|
|
}
|
|
|
|
|
2003-07-11 15:59:37 +00:00
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2008-11-29 22:48:58 +00:00
|
|
|
BOOL APIENTRY
|
2009-01-08 16:33:40 +00:00
|
|
|
EngPaint(IN SURFOBJ *pso,
|
2002-06-15 21:44:08 +00:00
|
|
|
IN CLIPOBJ *ClipRegion,
|
|
|
|
IN BRUSHOBJ *Brush,
|
|
|
|
IN POINTL *BrushOrigin,
|
|
|
|
IN MIX Mix)
|
2000-03-17 21:44:02 +00:00
|
|
|
{
|
2001-06-03 10:47:29 +00:00
|
|
|
BOOLEAN ret;
|
2002-08-18 07:02:57 +00:00
|
|
|
|
|
|
|
// FIXME: We only support a brush's solid color attribute
|
2009-01-08 16:33:40 +00:00
|
|
|
ret = EngPaintRgn(pso, ClipRegion, Brush->iSolidColor, Mix, Brush, BrushOrigin);
|
2002-08-18 07:02:57 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-11-29 22:48:58 +00:00
|
|
|
BOOL APIENTRY
|
2009-01-08 16:33:40 +00:00
|
|
|
IntEngPaint(IN SURFOBJ *pso,
|
2004-07-03 13:55:37 +00:00
|
|
|
IN CLIPOBJ *ClipRegion,
|
|
|
|
IN BRUSHOBJ *Brush,
|
|
|
|
IN POINTL *BrushOrigin,
|
|
|
|
IN MIX Mix)
|
2002-08-18 07:02:57 +00:00
|
|
|
{
|
2009-01-08 16:33:40 +00:00
|
|
|
SURFACE *psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj);
|
2002-08-18 07:02:57 +00:00
|
|
|
BOOL ret;
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2009-01-08 16:33:40 +00:00
|
|
|
DPRINT("pso->iType == %d\n", pso->iType);
|
2004-07-03 13:55:37 +00:00
|
|
|
/* Is the surface's Paint function hooked? */
|
2009-01-08 16:33:40 +00:00
|
|
|
if((pso->iType!=STYPE_BITMAP) && (psurf->flHooks & HOOK_PAINT))
|
2001-03-31 15:35:08 +00:00
|
|
|
{
|
|
|
|
// Call the driver's DrvPaint
|
2009-01-08 16:33:40 +00:00
|
|
|
SURFACE_LockBitmapBits(psurf);
|
|
|
|
MouseSafetyOnDrawStart(pso, ClipRegion->rclBounds.left,
|
2002-08-18 07:02:57 +00:00
|
|
|
ClipRegion->rclBounds.top, ClipRegion->rclBounds.right,
|
|
|
|
ClipRegion->rclBounds.bottom);
|
|
|
|
|
2009-01-08 16:33:40 +00:00
|
|
|
ret = GDIDEVFUNCS(pso).Paint(
|
|
|
|
pso, ClipRegion, Brush, BrushOrigin, Mix);
|
|
|
|
MouseSafetyOnDrawEnd(pso);
|
|
|
|
SURFACE_UnlockBitmapBits(psurf);
|
2001-06-03 10:47:29 +00:00
|
|
|
return ret;
|
2001-03-31 15:35:08 +00:00
|
|
|
}
|
2009-01-08 16:33:40 +00:00
|
|
|
return EngPaint(pso, ClipRegion, Brush, BrushOrigin, Mix );
|
2000-03-17 21:44:02 +00:00
|
|
|
|
|
|
|
}
|
2003-05-18 17:16:18 +00:00
|
|
|
/* EOF */
|