2 * ReactOS W32 Subsystem
3 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS kernel
23 * PURPOSE: GDI Driver Paint Functions
24 * FILE: subsys/win32k/eng/paint.c
25 * PROGRAMER: Jason Filby
30 #include <ddk/winddi.h>
31 #include <ddk/ntddmou.h>
32 #include <include/object.h>
33 #include <include/paint.h>
34 #include <include/surface.h>
37 #include <include/mouse.h>
38 #include "../dib/dib.h"
44 #include <win32k/debug1.h>
46 BOOL STDCALL FillSolid(SURFOBJ *Surface, PRECTL pRect, ULONG iColor)
52 SurfaceGDI = (SURFGDI*)AccessInternalObjectFromUserObject(Surface);
53 MouseSafetyOnDrawStart(Surface, SurfaceGDI, pRect->left, pRect->top, pRect->right, pRect->bottom);
54 LineWidth = pRect->right - pRect->left;
55 DPRINT(" LineWidth: %d, top: %d, bottom: %d\n", LineWidth, pRect->top, pRect->bottom);
56 for (y = pRect->top; y < pRect->bottom; y++)
58 SurfaceGDI->DIB_HLine(Surface, pRect->left, pRect->right, y, iColor);
60 MouseSafetyOnDrawEnd(Surface, SurfaceGDI);
66 EngPaintRgn(SURFOBJ *Surface, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix,
67 BRUSHINST *BrushInst, POINTL *BrushPoint)
73 DPRINT("ClipRegion->iMode:%d, ClipRegion->iDComplexity: %d\n Color: %d", ClipRegion->iMode, ClipRegion->iDComplexity, iColor);
74 switch(ClipRegion->iMode) {
78 /* Rectangular clipping can be handled without enumeration.
79 Note that trivial clipping is not possible, since the clipping
80 region defines the area to fill */
82 if (ClipRegion->iDComplexity == DC_RECT)
84 FillSolid(Surface, &(ClipRegion->rclBounds), iColor);
87 /* Enumerate all the rectangles and draw them */
88 CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, CD_ANY, ENUM_RECT_LIMIT);
91 EnumMore = CLIPOBJ_bEnum(ClipRegion, sizeof(RectEnum), (PVOID) &RectEnum);
92 for (i = 0; i < RectEnum.c; i++) {
93 FillSolid(Surface, RectEnum.arcl + i, iColor);
109 EngPaint(IN SURFOBJ *Surface,
110 IN CLIPOBJ *ClipRegion,
112 IN POINTL *BrushOrigin,
117 // FIXME: We only support a brush's solid color attribute
118 ret = EngPaintRgn(Surface, ClipRegion, Brush->iSolidColor, Mix, NULL, BrushOrigin);
124 IntEngPaint(IN SURFOBJ *Surface,
125 IN CLIPOBJ *ClipRegion,
127 IN POINTL *BrushOrigin,
133 // Is the surface's Paint function hooked?
134 SurfGDI = (SURFGDI*)AccessInternalObjectFromUserObject(Surface);
136 DPRINT("SurfGDI type: %d, sgdi paint: %x\n", Surface->iType, SurfGDI->Paint);
137 if((Surface->iType!=STYPE_BITMAP) && (SurfGDI->Paint!=NULL))
139 // Call the driver's DrvPaint
140 MouseSafetyOnDrawStart(Surface, SurfGDI, ClipRegion->rclBounds.left,
141 ClipRegion->rclBounds.top, ClipRegion->rclBounds.right,
142 ClipRegion->rclBounds.bottom);
144 ret = SurfGDI->Paint(Surface, ClipRegion, Brush, BrushOrigin, Mix);
145 MouseSafetyOnDrawEnd(Surface, SurfGDI);
148 return EngPaint( Surface, ClipRegion, Brush, BrushOrigin, Mix );