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
35 BOOL STDCALL
FillSolid(SURFOBJ
*Surface
, PRECTL pRect
, ULONG iColor
)
43 BitmapObj
= CONTAINING_RECORD(Surface
, BITMAPOBJ
, SurfObj
);
44 BITMAPOBJ_LockBitmapBits(BitmapObj
);
45 MouseSafetyOnDrawStart(Surface
, pRect
->left
, pRect
->top
, pRect
->right
, pRect
->bottom
);
46 LineWidth
= pRect
->right
- pRect
->left
;
47 DPRINT(" LineWidth: %d, top: %d, bottom: %d\n", LineWidth
, pRect
->top
, pRect
->bottom
);
48 for (y
= pRect
->top
; y
< pRect
->bottom
; y
++)
50 DibFunctionsForBitmapFormat
[Surface
->iBitmapFormat
].DIB_HLine(
51 Surface
, pRect
->left
, pRect
->right
, y
, iColor
);
53 MouseSafetyOnDrawEnd(Surface
);
54 BITMAPOBJ_UnlockBitmapBits(BitmapObj
);
60 EngPaintRgn(SURFOBJ
*Surface
, CLIPOBJ
*ClipRegion
, ULONG iColor
, MIX Mix
,
61 BRUSHOBJ
*BrushObj
, POINTL
*BrushPoint
)
70 DPRINT("ClipRegion->iMode:%d, ClipRegion->iDComplexity: %d\n Color: %d", ClipRegion
->iMode
, ClipRegion
->iDComplexity
, iColor
);
71 switch(ClipRegion
->iMode
) {
75 /* Rectangular clipping can be handled without enumeration.
76 Note that trivial clipping is not possible, since the clipping
77 region defines the area to fill */
79 if (ClipRegion
->iDComplexity
== DC_RECT
)
81 FillSolid(Surface
, &(ClipRegion
->rclBounds
), iColor
);
84 /* Enumerate all the rectangles and draw them */
85 CLIPOBJ_cEnumStart(ClipRegion
, FALSE
, CT_RECTANGLES
, CD_ANY
, 0);
88 EnumMore
= CLIPOBJ_bEnum(ClipRegion
, sizeof(RectEnum
), (PVOID
) &RectEnum
);
89 for (i
= 0; i
< RectEnum
.c
; i
++) {
90 FillSolid(Surface
, RectEnum
.arcl
+ i
, iColor
);
106 EngPaint(IN SURFOBJ
*Surface
,
107 IN CLIPOBJ
*ClipRegion
,
109 IN POINTL
*BrushOrigin
,
114 // FIXME: We only support a brush's solid color attribute
115 ret
= EngPaintRgn(Surface
, ClipRegion
, Brush
->iSolidColor
, Mix
, Brush
, BrushOrigin
);
121 IntEngPaint(IN SURFOBJ
*Surface
,
122 IN CLIPOBJ
*ClipRegion
,
124 IN POINTL
*BrushOrigin
,
127 BITMAPOBJ
*BitmapObj
= CONTAINING_RECORD(Surface
, BITMAPOBJ
, SurfObj
);
130 DPRINT("SurfGDI type: %d\n", Surface
->iType
);
131 /* Is the surface's Paint function hooked? */
132 if((Surface
->iType
!=STYPE_BITMAP
) && (BitmapObj
->flHooks
& HOOK_PAINT
))
134 // Call the driver's DrvPaint
135 BITMAPOBJ_LockBitmapBits(BitmapObj
);
136 MouseSafetyOnDrawStart(Surface
, ClipRegion
->rclBounds
.left
,
137 ClipRegion
->rclBounds
.top
, ClipRegion
->rclBounds
.right
,
138 ClipRegion
->rclBounds
.bottom
);
140 ret
= GDIDEVFUNCS(Surface
).Paint(
141 Surface
, ClipRegion
, Brush
, BrushOrigin
, Mix
);
142 MouseSafetyOnDrawEnd(Surface
);
143 BITMAPOBJ_UnlockBitmapBits(BitmapObj
);
146 return EngPaint( Surface
, ClipRegion
, Brush
, BrushOrigin
, Mix
);