ReactOS 0.4.15-dev-7961-gdcf9eb0
dib.c
Go to the documentation of this file.
1/*
2 * PROJECT: Win32 subsystem
3 * LICENSE: See COPYING in the top level directory
4 * FILE: win32ss/gdi/dib/dib.c
5 * PURPOSE: ROP handling, function pointer arrays, misc
6 * PROGRAMMERS: Ge van Geldorp
7 */
8
9
10#include <win32k.h>
11
12#define NDEBUG
13#include <debug.h>
14
15/* Static data */
16
17unsigned char notmask[2] = { 0x0f, 0xf0 };
18unsigned char altnotmask[2] = { 0xf0, 0x0f };
19
21{
22 /* 0 */
23 {
27 },
28 /* BMF_1BPP */
29 {
33 },
34 /* BMF_4BPP */
35 {
39 },
40 /* BMF_8BPP */
41 {
45 },
46 /* BMF_16BPP */
47 {
51 },
52 /* BMF_24BPP */
53 {
57 },
58 /* BMF_32BPP */
59 {
63 },
64 /* BMF_4RLE */
65 {
69 },
70 /* BMF_8RLE */
71 {
75 },
76 /* BMF_JPEG */
77 {
81 },
82 /* BMF_PNG */
83 {
87 }
88};
89
90
92DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern)
93{
94 ULONG ResultNibble;
95 ULONG Result = 0;
96 ULONG i;
97static const ULONG ExpandDest[16] =
98 {
99 0x55555555 /* 0000 */,
100 0x555555AA /* 0001 */,
101 0x5555AA55 /* 0010 */,
102 0x5555AAAA /* 0011 */,
103 0x55AA5555 /* 0100 */,
104 0x55AA55AA /* 0101 */,
105 0x55AAAA55 /* 0110 */,
106 0x55AAAAAA /* 0111 */,
107 0xAA555555 /* 1000 */,
108 0xAA5555AA /* 1001 */,
109 0xAA55AA55 /* 1010 */,
110 0xAA55AAAA /* 1011 */,
111 0xAAAA5555 /* 1100 */,
112 0xAAAA55AA /* 1101 */,
113 0xAAAAAA55 /* 1110 */,
114 0xAAAAAAAA /* 1111 */,
115 };
116 static const ULONG ExpandSource[16] =
117 {
118 0x33333333 /* 0000 */,
119 0x333333CC /* 0001 */,
120 0x3333CC33 /* 0010 */,
121 0x3333CCCC /* 0011 */,
122 0x33CC3333 /* 0100 */,
123 0x33CC33CC /* 0101 */,
124 0x33CCCC33 /* 0110 */,
125 0x33CCCCCC /* 0111 */,
126 0xCC333333 /* 1000 */,
127 0xCC3333CC /* 1001 */,
128 0xCC33CC33 /* 1010 */,
129 0xCC33CCCC /* 1011 */,
130 0xCCCC3333 /* 1100 */,
131 0xCCCC33CC /* 1101 */,
132 0xCCCCCC33 /* 1110 */,
133 0xCCCCCCCC /* 1111 */,
134 };
135 static const ULONG ExpandPattern[16] =
136 {
137 0x0F0F0F0F /* 0000 */,
138 0x0F0F0FF0 /* 0001 */,
139 0x0F0FF00F /* 0010 */,
140 0x0F0FF0F0 /* 0011 */,
141 0x0FF00F0F /* 0100 */,
142 0x0FF00FF0 /* 0101 */,
143 0x0FF0F00F /* 0110 */,
144 0x0FF0F0F0 /* 0111 */,
145 0xF00F0F0F /* 1000 */,
146 0xF00F0FF0 /* 1001 */,
147 0xF00FF00F /* 1010 */,
148 0xF00FF0F0 /* 1011 */,
149 0xF0F00F0F /* 1100 */,
150 0xF0F00FF0 /* 1101 */,
151 0xF0F0F00F /* 1110 */,
152 0xF0F0F0F0 /* 1111 */,
153 };
154
155 Rop &=0xFF;
156 switch(Rop)
157 {
158
159 /* Optimized code for the various named rop codes. */
160 case R3_OPINDEX_NOOP: return(Dest);
161 case R3_OPINDEX_BLACKNESS: return(0);
162 case R3_OPINDEX_NOTSRCERASE: return(~(Dest | Source));
163 case R3_OPINDEX_NOTSRCCOPY: return(~Source);
164 case R3_OPINDEX_SRCERASE: return((~Dest) & Source);
165 case R3_OPINDEX_DSTINVERT: return(~Dest);
166 case R3_OPINDEX_PATINVERT: return(Dest ^ Pattern);
167 case R3_OPINDEX_SRCINVERT: return(Dest ^ Source);
168 case R3_OPINDEX_SRCAND: return(Dest & Source);
169 case R3_OPINDEX_MERGEPAINT: return(Dest | (~Source));
170 case R3_OPINDEX_SRCPAINT: return(Dest | Source);
171 case R3_OPINDEX_MERGECOPY: return(Source & Pattern);
172 case R3_OPINDEX_SRCCOPY: return(Source);
173 case R3_OPINDEX_PATCOPY: return(Pattern);
174 case R3_OPINDEX_PATPAINT: return(Dest | (~Source) | Pattern);
175 case R3_OPINDEX_WHITENESS: return(0xFFFFFFFF);
176 }
177
178 /* Expand the ROP operation to all four bytes */
179 Rop |= (Rop << 24) | (Rop << 16) | (Rop << 8);
180 /* Do the operation on four bits simultaneously. */
181 Result = 0;
182 for (i = 0; i < 8; i++)
183 {
184 ResultNibble = Rop & ExpandDest[Dest & 0xF] & ExpandSource[Source & 0xF] & ExpandPattern[Pattern & 0xF];
185 Result |= (((ResultNibble & 0xFF000000) ? 0x8 : 0x0) | ((ResultNibble & 0x00FF0000) ? 0x4 : 0x0) |
186 ((ResultNibble & 0x0000FF00) ? 0x2 : 0x0) | ((ResultNibble & 0x000000FF) ? 0x1 : 0x0)) << (i * 4);
187 Dest >>= 4;
188 Source >>= 4;
189 Pattern >>= 4;
190 }
191 return(Result);
192}
193
195{
196 return;
197}
198
200{
201 return 0;
202}
203
205{
206 return;
207}
208
210{
211 return;
212}
213
215{
216 return FALSE;
217}
218
220 SURFOBJ *PatternSurface, SURFOBJ *MaskSurf,
221 RECTL* DestRect, RECTL *SourceRect,
222 POINTL* MaskOrigin, BRUSHOBJ* Brush,
223 POINTL* BrushOrign,
224 XLATEOBJ *ColorTranslation,
225 ROP4 Rop)
226{
227 return FALSE;
228}
229
231 RECTL* DestRect, RECTL *SourceRect,
232 XLATEOBJ *ColorTranslation, ULONG iTransColor)
233{
234 return FALSE;
235}
236
238{
239 return FALSE;
240}
241
242
245 RECTL* SourceRect, CLIPOBJ* ClipRegion,
246 XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj)
247{
248 return FALSE;
249}
250
251/* EOF */
unsigned char BOOLEAN
#define R3_OPINDEX_SRCCOPY
Definition: bitblt.h:27
#define R3_OPINDEX_NOOP
Definition: bitblt.h:28
#define FALSE
Definition: types.h:117
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
const GLubyte * c
Definition: glext.h:8905
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
@ R3_OPINDEX_PATINVERT
Definition: inteng.h:28
@ R3_OPINDEX_MERGEPAINT
Definition: inteng.h:31
@ R3_OPINDEX_NOTSRCCOPY
Definition: inteng.h:25
@ R3_OPINDEX_WHITENESS
Definition: inteng.h:37
@ R3_OPINDEX_BLACKNESS
Definition: inteng.h:23
@ R3_OPINDEX_PATCOPY
Definition: inteng.h:35
@ R3_OPINDEX_SRCPAINT
Definition: inteng.h:34
@ R3_OPINDEX_DSTINVERT
Definition: inteng.h:27
@ R3_OPINDEX_SRCERASE
Definition: inteng.h:26
@ R3_OPINDEX_MERGECOPY
Definition: inteng.h:32
@ R3_OPINDEX_SRCAND
Definition: inteng.h:30
@ R3_OPINDEX_NOTSRCERASE
Definition: inteng.h:24
@ R3_OPINDEX_SRCINVERT
Definition: inteng.h:29
@ R3_OPINDEX_PATPAINT
Definition: inteng.h:36
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
long LONG
Definition: pedump.c:60
Definition: dib.h:21
uint32_t ULONG
Definition: typedefs.h:59
BOOLEAN DIB_XXBPP_AlphaBlend(SURFOBJ *Dest, SURFOBJ *Source, RECTL *DestRect, RECTL *SourceRect, CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation, BLENDOBJ *BlendObj)
Definition: alphablend.c:33
BOOLEAN Dummy_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, SURFOBJ *PatternSurface, SURFOBJ *MaskSurf, RECTL *DestRect, RECTL *SourceRect, POINTL *MaskOrigin, BRUSHOBJ *Brush, POINTL *BrushOrign, XLATEOBJ *ColorTranslation, ROP4 Rop)
Definition: dib.c:219
BOOLEAN Dummy_AlphaBlend(SURFOBJ *Dest, SURFOBJ *Source, RECTL *DestRect, RECTL *SourceRect, CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation, BLENDOBJ *BlendObj)
Definition: dib.c:244
BOOLEAN Dummy_BitBlt(PBLTINFO BltInfo)
Definition: dib.c:214
unsigned char notmask[2]
Definition: dib.c:17
VOID Dummy_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
Definition: dib.c:204
BOOLEAN Dummy_ColorFill(SURFOBJ *Dest, RECTL *DestRect, ULONG Color)
Definition: dib.c:237
ULONG DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern)
Definition: dib.c:92
VOID Dummy_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib.c:194
BOOLEAN Dummy_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, RECTL *DestRect, RECTL *SourceRect, XLATEOBJ *ColorTranslation, ULONG iTransColor)
Definition: dib.c:230
unsigned char altnotmask[2]
Definition: dib.c:18
DIB_FUNCTIONS DibFunctionsForBitmapFormat[]
Definition: dib.c:20
VOID Dummy_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
Definition: dib.c:209
ULONG Dummy_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
Definition: dib.c:199
VOID DIB_8BPP_VLine(SURFOBJ *, LONG, LONG, LONG, ULONG)
Definition: dib8bpp.c:43
BOOLEAN DIB_8BPP_BitBlt(PBLTINFO)
VOID DIB_4BPP_PutPixel(SURFOBJ *, LONG, LONG, ULONG)
Definition: dib4bpp.c:19
BOOLEAN DIB_24BPP_TransparentBlt(SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, XLATEOBJ *, ULONG)
Definition: dib24bpp.c:660
BOOLEAN DIB_24BPP_AlphaBlend(SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, CLIPOBJ *, XLATEOBJ *, BLENDOBJ *)
Definition: dib24bpp.c:725
BOOLEAN DIB_4BPP_BitBltSrcCopy(PBLTINFO)
Definition: dib4bpp.c:63
ULONG DIB_8BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib8bpp.c:29
BOOLEAN DIB_32BPP_ColorFill(SURFOBJ *, RECTL *, ULONG)
Definition: dib32bppc.c:31
BOOLEAN DIB_16BPP_BitBltSrcCopy(PBLTINFO)
Definition: dib16bpp.c:144
BOOLEAN DIB_32BPP_BitBltSrcCopy(PBLTINFO)
Definition: dib32bpp.c:54
BOOLEAN DIB_32BPP_AlphaBlend(SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, CLIPOBJ *, XLATEOBJ *, BLENDOBJ *)
Definition: dib32bpp.c:763
BOOLEAN DIB_8BPP_BitBltSrcCopy(PBLTINFO)
Definition: dib8bpp.c:59
BOOLEAN DIB_24BPP_BitBlt(PBLTINFO)
Definition: dib24bpp.c:485
BOOLEAN DIB_8BPP_TransparentBlt(SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, XLATEOBJ *, ULONG)
Definition: dib8bpp.c:543
VOID DIB_32BPP_VLine(SURFOBJ *, LONG, LONG, LONG, ULONG)
Definition: dib32bpp.c:39
VOID DIB_24BPP_VLine(SURFOBJ *, LONG, LONG, LONG, ULONG)
Definition: dib24bpp.c:38
VOID DIB_8BPP_PutPixel(SURFOBJ *, LONG, LONG, ULONG)
Definition: dib8bpp.c:21
BOOLEAN DIB_16BPP_BitBlt(PBLTINFO)
VOID DIB_1BPP_HLine(SURFOBJ *, LONG, LONG, LONG, ULONG)
Definition: dib1bpp.c:38
ULONG DIB_24BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib24bpp.c:29
VOID DIB_16BPP_VLine(SURFOBJ *, LONG, LONG, LONG, ULONG)
Definition: dib16bpp.c:94
VOID DIB_32BPP_HLine(SURFOBJ *, LONG, LONG, LONG, ULONG)
Definition: dib32bppc.c:16
BOOLEAN DIB_1BPP_ColorFill(SURFOBJ *, RECTL *, ULONG)
Definition: dib1bpp.c:508
BOOLEAN DIB_32BPP_TransparentBlt(SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, XLATEOBJ *, ULONG)
Definition: dib32bpp.c:701
VOID DIB_16BPP_PutPixel(SURFOBJ *, LONG, LONG, ULONG)
Definition: dib16bpp.c:21
VOID DIB_24BPP_HLine(SURFOBJ *, LONG, LONG, LONG, ULONG)
Definition: dib24bppc.c:16
BOOLEAN DIB_16BPP_AlphaBlend(SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, CLIPOBJ *, XLATEOBJ *, BLENDOBJ *)
Definition: dib16bpp.c:851
BOOLEAN DIB_4BPP_TransparentBlt(SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, XLATEOBJ *, ULONG)
Definition: dib4bpp.c:524
ULONG DIB_1BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib1bpp.c:30
BOOLEAN DIB_1BPP_BitBltSrcCopy(PBLTINFO)
Definition: dib1bpp.c:159
ULONG DIB_4BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib4bpp.c:26
ULONG DIB_16BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib16bpp.c:30
VOID DIB_4BPP_HLine(SURFOBJ *, LONG, LONG, LONG, ULONG)
Definition: dib4bpp.c:33
VOID DIB_4BPP_VLine(SURFOBJ *, LONG, LONG, LONG, ULONG)
Definition: dib4bpp.c:48
BOOLEAN DIB_1BPP_BitBlt(PBLTINFO)
Definition: dib1bpp.c:367
VOID DIB_24BPP_PutPixel(SURFOBJ *, LONG, LONG, ULONG)
Definition: dib24bpp.c:21
VOID DIB_16BPP_HLine(SURFOBJ *, LONG, LONG, LONG, ULONG)
Definition: dib16bpp.c:38
ULONG DIB_32BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib32bpp.c:30
BOOLEAN DIB_XXBPP_StretchBlt(SURFOBJ *, SURFOBJ *, SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, POINTL *, BRUSHOBJ *, POINTL *, XLATEOBJ *, ROP4)
Definition: stretchblt.c:17
BOOLEAN DIB_8BPP_ColorFill(SURFOBJ *, RECTL *, ULONG)
Definition: dib8bpp.c:527
VOID DIB_1BPP_PutPixel(SURFOBJ *, LONG, LONG, ULONG)
Definition: dib1bpp.c:19
VOID DIB_1BPP_VLine(SURFOBJ *, LONG, LONG, LONG, ULONG)
Definition: dib1bpp.c:48
VOID DIB_8BPP_HLine(SURFOBJ *, LONG, LONG, LONG, ULONG)
Definition: dib8bpp.c:37
BOOLEAN DIB_32BPP_BitBlt(PBLTINFO)
BOOLEAN DIB_24BPP_BitBltSrcCopy(PBLTINFO)
Definition: dib24bpp.c:54
VOID DIB_32BPP_PutPixel(SURFOBJ *, LONG, LONG, ULONG)
Definition: dib32bpp.c:21
BOOLEAN DIB_4BPP_BitBlt(PBLTINFO)
Definition: dib4bpp.c:368
BOOLEAN DIB_16BPP_ColorFill(SURFOBJ *, RECTL *, ULONG)
Definition: dib16bpp.c:673
BOOLEAN DIB_1BPP_TransparentBlt(SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, XLATEOBJ *, ULONG)
Definition: dib1bpp.c:524
BOOLEAN DIB_24BPP_ColorFill(SURFOBJ *, RECTL *, ULONG)
Definition: dib24bpp.c:558
BOOLEAN DIB_16BPP_TransparentBlt(SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, XLATEOBJ *, ULONG)
Definition: dib16bpp.c:723
BOOLEAN DIB_4BPP_ColorFill(SURFOBJ *, RECTL *, ULONG)
Definition: dib4bpp.c:508
_In_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_ RECTL _In_ ULONG iTransColor
Definition: winddi.h:4195
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711
ULONG ROP4
Definition: winddi.h:128
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409