1*c2c66affSColin Finck /*
2*c2c66affSColin Finck * COPYRIGHT: See COPYING in the top level directory
3*c2c66affSColin Finck * PROJECT: ReactOS kernel
4*c2c66affSColin Finck * PURPOSE: GDI Driver Paint Functions
5*c2c66affSColin Finck * FILE: win32ss/gdi/eng/paint.c
6*c2c66affSColin Finck * PROGRAMERS: Timo Kreuzer (timo.kreuzer@reactos.org)
7*c2c66affSColin Finck * Jason Filby
8*c2c66affSColin Finck */
9*c2c66affSColin Finck
10*c2c66affSColin Finck #include <win32k.h>
11*c2c66affSColin Finck
12*c2c66affSColin Finck #define NDEBUG
13*c2c66affSColin Finck #include <debug.h>
14*c2c66affSColin Finck
15*c2c66affSColin Finck const BYTE gajRop2ToRop3[16] =
16*c2c66affSColin Finck {
17*c2c66affSColin Finck 0x00, // 1: R2_BLACK 0
18*c2c66affSColin Finck 0x05, // 2: R2_NOTMERGEPEN DPon
19*c2c66affSColin Finck 0x0A, // 3: R2_MASKNOTPEN DPna
20*c2c66affSColin Finck 0x0F, // 4: R2_NOTCOPYPEN Pn
21*c2c66affSColin Finck 0x50, // 5: R2_MASKPENNOT PDna
22*c2c66affSColin Finck 0x55, // 6: R2_NOT Dn
23*c2c66affSColin Finck 0x5A, // 7: R2_XORPEN DPx
24*c2c66affSColin Finck 0x5F, // 8: R2_NOTMASKPEN DPan
25*c2c66affSColin Finck 0xA0, // 9: R2_MASKPEN DPa
26*c2c66affSColin Finck 0xA5, // 10: R2_NOTXORPEN PDxn
27*c2c66affSColin Finck 0xAA, // 11: R2_NOP D
28*c2c66affSColin Finck 0xAF, // 12: R2_MERGENOTPEN DPno
29*c2c66affSColin Finck 0xF0, // 13: R2_COPYPEN P
30*c2c66affSColin Finck 0xF5, // 14: R2_MERGEPENNOT PDno
31*c2c66affSColin Finck 0xFA, // 15: R2_MERGEPEN DPo
32*c2c66affSColin Finck 0xFF, // 16: R2_WHITE 1
33*c2c66affSColin Finck };
34*c2c66affSColin Finck
FillSolid(SURFOBJ * pso,PRECTL pRect,ULONG iColor)35*c2c66affSColin Finck BOOL APIENTRY FillSolid(SURFOBJ *pso, PRECTL pRect, ULONG iColor)
36*c2c66affSColin Finck {
37*c2c66affSColin Finck LONG y;
38*c2c66affSColin Finck ULONG LineWidth;
39*c2c66affSColin Finck
40*c2c66affSColin Finck ASSERT(pso);
41*c2c66affSColin Finck ASSERT(pRect);
42*c2c66affSColin Finck LineWidth = pRect->right - pRect->left;
43*c2c66affSColin Finck DPRINT(" LineWidth: %lu, top: %ld, bottom: %ld\n", LineWidth, pRect->top, pRect->bottom);
44*c2c66affSColin Finck for (y = pRect->top; y < pRect->bottom; y++)
45*c2c66affSColin Finck {
46*c2c66affSColin Finck DibFunctionsForBitmapFormat[pso->iBitmapFormat].DIB_HLine(
47*c2c66affSColin Finck pso, pRect->left, pRect->right, y, iColor);
48*c2c66affSColin Finck }
49*c2c66affSColin Finck return TRUE;
50*c2c66affSColin Finck }
51*c2c66affSColin Finck
52*c2c66affSColin Finck BOOL
53*c2c66affSColin Finck APIENTRY
EngPaint(_In_ SURFOBJ * pso,_In_ CLIPOBJ * pco,_In_ BRUSHOBJ * pbo,_In_ POINTL * pptlBrushOrg,_In_ __in_data_source (USER_MODE)MIX mix)54*c2c66affSColin Finck EngPaint(
55*c2c66affSColin Finck _In_ SURFOBJ *pso,
56*c2c66affSColin Finck _In_ CLIPOBJ *pco,
57*c2c66affSColin Finck _In_ BRUSHOBJ *pbo,
58*c2c66affSColin Finck _In_ POINTL *pptlBrushOrg,
59*c2c66affSColin Finck _In_ __in_data_source(USER_MODE) MIX mix)
60*c2c66affSColin Finck {
61*c2c66affSColin Finck ROP4 rop4;
62*c2c66affSColin Finck
63*c2c66affSColin Finck /* Convert the MIX, consisting of 2 ROP2 codes into a ROP4 */
64*c2c66affSColin Finck rop4 = MIX_TO_ROP4(mix);
65*c2c66affSColin Finck
66*c2c66affSColin Finck /* Sanity check */
67*c2c66affSColin Finck NT_ASSERT(!ROP4_USES_SOURCE(rop4));
68*c2c66affSColin Finck
69*c2c66affSColin Finck /* Forward the call to Eng/DrvBitBlt */
70*c2c66affSColin Finck return IntEngBitBlt(pso,
71*c2c66affSColin Finck NULL,
72*c2c66affSColin Finck NULL,
73*c2c66affSColin Finck pco,
74*c2c66affSColin Finck NULL,
75*c2c66affSColin Finck &pco->rclBounds,
76*c2c66affSColin Finck NULL,
77*c2c66affSColin Finck NULL,
78*c2c66affSColin Finck pbo,
79*c2c66affSColin Finck pptlBrushOrg,
80*c2c66affSColin Finck rop4);
81*c2c66affSColin Finck }
82*c2c66affSColin Finck
83*c2c66affSColin Finck BOOL
84*c2c66affSColin Finck APIENTRY
IntEngPaint(_In_ SURFOBJ * pso,_In_ CLIPOBJ * pco,_In_ BRUSHOBJ * pbo,_In_ POINTL * pptlBrushOrg,_In_ __in_data_source (USER_MODE)MIX mix)85*c2c66affSColin Finck IntEngPaint(
86*c2c66affSColin Finck _In_ SURFOBJ *pso,
87*c2c66affSColin Finck _In_ CLIPOBJ *pco,
88*c2c66affSColin Finck _In_ BRUSHOBJ *pbo,
89*c2c66affSColin Finck _In_ POINTL *pptlBrushOrg,
90*c2c66affSColin Finck _In_ __in_data_source(USER_MODE) MIX mix)
91*c2c66affSColin Finck {
92*c2c66affSColin Finck SURFACE *psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj);
93*c2c66affSColin Finck
94*c2c66affSColin Finck /* Is the surface's Paint function hooked? */
95*c2c66affSColin Finck if ((pso->iType != STYPE_BITMAP) && (psurf->flags & HOOK_PAINT))
96*c2c66affSColin Finck {
97*c2c66affSColin Finck /* Call the driver's DrvPaint */
98*c2c66affSColin Finck return GDIDEVFUNCS(pso).Paint(pso, pco, pbo, pptlBrushOrg, mix);
99*c2c66affSColin Finck }
100*c2c66affSColin Finck
101*c2c66affSColin Finck return EngPaint(pso, pco, pbo, pptlBrushOrg, mix);
102*c2c66affSColin Finck }
103*c2c66affSColin Finck
104*c2c66affSColin Finck /* EOF */
105