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