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.
28 unsigned char notmask
[2] = { 0x0f, 0xf0 };
29 unsigned char altnotmask
[2] = { 0xf0, 0x0f };
31 DIB_FUNCTIONS DibFunctionsForBitmapFormat
[] =
35 Dummy_PutPixel
, Dummy_GetPixel
, Dummy_HLine
, Dummy_VLine
,
36 Dummy_BitBlt
, Dummy_BitBlt
, Dummy_StretchBlt
, Dummy_TransparentBlt
,
37 Dummy_ColorFill
, Dummy_AlphaBlend
41 DIB_1BPP_PutPixel
, DIB_1BPP_GetPixel
, DIB_1BPP_HLine
, DIB_1BPP_VLine
,
42 DIB_1BPP_BitBlt
, DIB_1BPP_BitBltSrcCopy
, DIB_XXBPP_StretchBlt
,
43 DIB_1BPP_TransparentBlt
, DIB_1BPP_ColorFill
, DIB_1BPP_AlphaBlend
47 DIB_4BPP_PutPixel
, DIB_4BPP_GetPixel
, DIB_4BPP_HLine
, DIB_4BPP_VLine
,
48 DIB_4BPP_BitBlt
, DIB_4BPP_BitBltSrcCopy
, DIB_XXBPP_StretchBlt
,
49 DIB_4BPP_TransparentBlt
, DIB_4BPP_ColorFill
, DIB_4BPP_AlphaBlend
53 DIB_8BPP_PutPixel
, DIB_8BPP_GetPixel
, DIB_8BPP_HLine
, DIB_8BPP_VLine
,
54 DIB_8BPP_BitBlt
, DIB_8BPP_BitBltSrcCopy
, DIB_XXBPP_StretchBlt
,
55 DIB_8BPP_TransparentBlt
, DIB_8BPP_ColorFill
, DIB_8BPP_AlphaBlend
59 DIB_16BPP_PutPixel
, DIB_16BPP_GetPixel
, DIB_16BPP_HLine
, DIB_16BPP_VLine
,
60 DIB_16BPP_BitBlt
, DIB_16BPP_BitBltSrcCopy
, DIB_XXBPP_StretchBlt
,
61 DIB_16BPP_TransparentBlt
, DIB_16BPP_ColorFill
, DIB_16BPP_AlphaBlend
65 DIB_24BPP_PutPixel
, DIB_24BPP_GetPixel
, DIB_24BPP_HLine
, DIB_24BPP_VLine
,
66 DIB_24BPP_BitBlt
, DIB_24BPP_BitBltSrcCopy
, DIB_XXBPP_StretchBlt
,
67 DIB_24BPP_TransparentBlt
, DIB_24BPP_ColorFill
, DIB_24BPP_AlphaBlend
71 DIB_32BPP_PutPixel
, DIB_32BPP_GetPixel
, DIB_32BPP_HLine
, DIB_32BPP_VLine
,
72 DIB_32BPP_BitBlt
, DIB_32BPP_BitBltSrcCopy
, DIB_XXBPP_StretchBlt
,
73 DIB_32BPP_TransparentBlt
, DIB_32BPP_ColorFill
, DIB_32BPP_AlphaBlend
77 Dummy_PutPixel
, Dummy_GetPixel
, Dummy_HLine
, Dummy_VLine
,
78 Dummy_BitBlt
, Dummy_BitBlt
, Dummy_StretchBlt
, Dummy_TransparentBlt
,
79 Dummy_ColorFill
, Dummy_AlphaBlend
83 Dummy_PutPixel
, Dummy_GetPixel
, Dummy_HLine
, Dummy_VLine
,
84 Dummy_BitBlt
, Dummy_BitBlt
, Dummy_StretchBlt
, Dummy_TransparentBlt
,
85 Dummy_ColorFill
, Dummy_AlphaBlend
89 Dummy_PutPixel
, Dummy_GetPixel
, Dummy_HLine
, Dummy_VLine
,
90 Dummy_BitBlt
, Dummy_BitBlt
, Dummy_StretchBlt
, Dummy_TransparentBlt
,
91 Dummy_ColorFill
, Dummy_AlphaBlend
95 Dummy_PutPixel
, Dummy_GetPixel
, Dummy_HLine
, Dummy_VLine
,
96 Dummy_BitBlt
, Dummy_BitBlt
, Dummy_StretchBlt
, Dummy_TransparentBlt
,
97 Dummy_ColorFill
, Dummy_AlphaBlend
102 DIB_DoRop(ULONG Rop
, ULONG Dest
, ULONG Source
, ULONG Pattern
)
107 static const ULONG ExpandDest
[16] =
109 0x55555555 /* 0000 */,
110 0x555555AA /* 0001 */,
111 0x5555AA55 /* 0010 */,
112 0x5555AAAA /* 0011 */,
113 0x55AA5555 /* 0100 */,
114 0x55AA55AA /* 0101 */,
115 0x55AAAA55 /* 0110 */,
116 0x55AAAAAA /* 0111 */,
117 0xAA555555 /* 1000 */,
118 0xAA5555AA /* 1001 */,
119 0xAA55AA55 /* 1010 */,
120 0xAA55AAAA /* 1011 */,
121 0xAAAA5555 /* 1100 */,
122 0xAAAA55AA /* 1101 */,
123 0xAAAAAA55 /* 1110 */,
124 0xAAAAAAAA /* 1111 */,
126 static const ULONG ExpandSource
[16] =
128 0x33333333 /* 0000 */,
129 0x333333CC /* 0001 */,
130 0x3333CC33 /* 0010 */,
131 0x3333CCCC /* 0011 */,
132 0x33CC3333 /* 0100 */,
133 0x33CC33CC /* 0101 */,
134 0x33CCCC33 /* 0110 */,
135 0x33CCCCCC /* 0111 */,
136 0xCC333333 /* 1000 */,
137 0xCC3333CC /* 1001 */,
138 0xCC33CC33 /* 1010 */,
139 0xCC33CCCC /* 1011 */,
140 0xCCCC3333 /* 1100 */,
141 0xCCCC33CC /* 1101 */,
142 0xCCCCCC33 /* 1110 */,
143 0xCCCCCCCC /* 1111 */,
145 static const ULONG ExpandPattern
[16] =
147 0x0F0F0F0F /* 0000 */,
148 0x0F0F0FF0 /* 0001 */,
149 0x0F0FF00F /* 0010 */,
150 0x0F0FF0F0 /* 0011 */,
151 0x0FF00F0F /* 0100 */,
152 0x0FF00FF0 /* 0101 */,
153 0x0FF0F00F /* 0110 */,
154 0x0FF0F0F0 /* 0111 */,
155 0xF00F0F0F /* 1000 */,
156 0xF00F0FF0 /* 1001 */,
157 0xF00FF00F /* 1010 */,
158 0xF00FF0F0 /* 1011 */,
159 0xF0F00F0F /* 1100 */,
160 0xF0F00FF0 /* 1101 */,
161 0xF0F0F00F /* 1110 */,
162 0xF0F0F0F0 /* 1111 */,
165 /* Optimized code for the various named rop codes. */
168 case ROP3_TO_ROP4(BLACKNESS
): return(0);
169 case ROP3_TO_ROP4(NOTSRCERASE
): return(~(Dest
| Source
));
170 case ROP3_TO_ROP4(NOTSRCCOPY
): return(~Source
);
171 case ROP3_TO_ROP4(SRCERASE
): return((~Dest
) & Source
);
172 case ROP3_TO_ROP4(DSTINVERT
): return(~Dest
);
173 case ROP3_TO_ROP4(PATINVERT
): return(Dest
^ Pattern
);
174 case ROP3_TO_ROP4(SRCINVERT
): return(Dest
^ Source
);
175 case ROP3_TO_ROP4(SRCAND
): return(Dest
& Source
);
176 case ROP3_TO_ROP4(MERGEPAINT
): return(Dest
| (~Source
));
177 case ROP3_TO_ROP4(SRCPAINT
): return(Dest
| Source
);
178 case ROP3_TO_ROP4(MERGECOPY
): return(Source
& Pattern
);
179 case ROP3_TO_ROP4(SRCCOPY
): return(Source
);
180 case ROP3_TO_ROP4(PATCOPY
): return(Pattern
);
181 case ROP3_TO_ROP4(PATPAINT
): return(Dest
| (~Source
) | Pattern
);
182 case ROP3_TO_ROP4(WHITENESS
): return(0xFFFFFFFF);
184 /* Expand the ROP operation to all four bytes */
186 Rop
|= (Rop
<< 24) | (Rop
<< 16) | (Rop
<< 8);
187 /* Do the operation on four bits simultaneously. */
189 for (i
= 0; i
< 8; i
++)
191 ResultNibble
= Rop
& ExpandDest
[Dest
& 0xF] & ExpandSource
[Source
& 0xF] & ExpandPattern
[Pattern
& 0xF];
192 Result
|= (((ResultNibble
& 0xFF000000) ? 0x8 : 0x0) | ((ResultNibble
& 0x00FF0000) ? 0x4 : 0x0) |
193 ((ResultNibble
& 0x0000FF00) ? 0x2 : 0x0) | ((ResultNibble
& 0x000000FF) ? 0x1 : 0x0)) << (i
* 4);
201 VOID
Dummy_PutPixel(SURFOBJ
* SurfObj
, LONG x
, LONG y
, ULONG c
)
206 ULONG
Dummy_GetPixel(SURFOBJ
* SurfObj
, LONG x
, LONG y
)
211 VOID
Dummy_HLine(SURFOBJ
* SurfObj
, LONG x1
, LONG x2
, LONG y
, ULONG c
)
216 VOID
Dummy_VLine(SURFOBJ
* SurfObj
, LONG x
, LONG y1
, LONG y2
, ULONG c
)
221 BOOLEAN
Dummy_BitBlt(PBLTINFO BltInfo
)
226 BOOLEAN
Dummy_StretchBlt(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
227 SURFOBJ
*PatternSurface
, SURFOBJ
*MaskSurf
,
228 RECTL
* DestRect
, RECTL
*SourceRect
,
229 POINTL
* MaskOrigin
, BRUSHOBJ
* Brush
,
231 XLATEOBJ
*ColorTranslation
,
232 XLATEOBJ
*XlatePatternToDest
, ROP4 Rop
)
237 BOOLEAN
Dummy_TransparentBlt(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
238 RECTL
* DestRect
, RECTL
*SourceRect
,
239 XLATEOBJ
*ColorTranslation
, ULONG iTransColor
)
244 BOOLEAN
Dummy_ColorFill(SURFOBJ
* Dest
, RECTL
* DestRect
, ULONG Color
)
251 Dummy_AlphaBlend(SURFOBJ
* Dest
, SURFOBJ
* Source
, RECTL
* DestRect
,
252 RECTL
* SourceRect
, CLIPOBJ
* ClipRegion
,
253 XLATEOBJ
* ColorTranslation
, BLENDOBJ
* BlendObj
)