ReactOS  0.4.15-dev-3163-gf17c2c0
dib4bpp.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for dib4bpp.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define DEC_OR_INC(var, decTrue, amount)   ((var) = (decTrue) ? ((var) - (amount)) : ((var) + (amount)))
 

Functions

VOID DIB_4BPP_PutPixel (SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
 
ULONG DIB_4BPP_GetPixel (SURFOBJ *SurfObj, LONG x, LONG y)
 
VOID DIB_4BPP_HLine (SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
 
VOID DIB_4BPP_VLine (SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
 
BOOLEAN DIB_4BPP_BitBltSrcCopy (PBLTINFO BltInfo)
 
BOOLEAN DIB_4BPP_BitBlt (PBLTINFO BltInfo)
 
BOOLEAN DIB_4BPP_ColorFill (SURFOBJ *DestSurface, RECTL *DestRect, ULONG color)
 
BOOLEAN DIB_4BPP_TransparentBlt (SURFOBJ *DestSurf, SURFOBJ *SourceSurf, RECTL *DestRect, RECTL *SourceRect, XLATEOBJ *ColorTranslation, ULONG iTransColor)
 

Macro Definition Documentation

◆ DEC_OR_INC

#define DEC_OR_INC (   var,
  decTrue,
  amount 
)    ((var) = (decTrue) ? ((var) - (amount)) : ((var) + (amount)))

Definition at line 15 of file dib4bpp.c.

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file dib4bpp.c.

Function Documentation

◆ DIB_4BPP_BitBlt()

BOOLEAN DIB_4BPP_BitBlt ( PBLTINFO  BltInfo)

Definition at line 368 of file dib4bpp.c.

369 {
370  LONG DestX, DestY;
371  LONG SourceX, SourceY;
372  LONG PatternY = 0;
373  ULONG Dest, Source = 0, Pattern = 0;
374  BOOLEAN UsesSource;
375  BOOLEAN UsesPattern;
376  PULONG DestBits;
377  LONG RoundedRight;
378  static const ULONG ExpandSolidColor[16] =
379  {
380  0x00000000 /* 0 */,
381  0x11111111 /* 1 */,
382  0x22222222 /* 2 */,
383  0x33333333 /* 3 */,
384  0x44444444 /* 4 */,
385  0x55555555 /* 5 */,
386  0x66666666 /* 6 */,
387  0x77777777 /* 7 */,
388  0x88888888 /* 8 */,
389  0x99999999 /* 9 */,
390  0xAAAAAAAA /* 10 */,
391  0xBBBBBBBB /* 11 */,
392  0xCCCCCCCC /* 12 */,
393  0xDDDDDDDD /* 13 */,
394  0xEEEEEEEE /* 14 */,
395  0xFFFFFFFF /* 15 */,
396  };
397 
398  UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4);
399  UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4);
400 
401  SourceY = BltInfo->SourcePoint.y;
402  RoundedRight = BltInfo->DestRect.right -
403  ((BltInfo->DestRect.right - BltInfo->DestRect.left) & 0x7);
404 
405  if (UsesPattern)
406  {
407  if (BltInfo->PatternSurface)
408  {
409  PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
410  BltInfo->PatternSurface->sizlBitmap.cy;
411  }
412  else
413  {
414  if (BltInfo->Brush)
415  Pattern = ExpandSolidColor[BltInfo->Brush->iSolidColor];
416  }
417  }
418 
419  for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
420  {
421  DestBits = (PULONG)(
422  (PBYTE)BltInfo->DestSurface->pvScan0 +
423  (BltInfo->DestRect.left >> 1) +
424  DestY * BltInfo->DestSurface->lDelta);
425  SourceX = BltInfo->SourcePoint.x;
426  DestX = BltInfo->DestRect.left;
427 
428  if (DestX & 0x1)
429  {
430  Dest = DIB_4BPP_GetPixel(BltInfo->DestSurface, DestX, DestY);
431 
432  if (UsesSource)
433  {
434  Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
435  }
436 
437  if (BltInfo->PatternSurface)
438  {
439  Pattern = DIB_GetSourceIndex(BltInfo->PatternSurface,
440  (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY);
441  }
442 
443  DIB_4BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xF);
444 
445  DestX++;
446  SourceX++;
447  DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
448  }
449 
450  for (; DestX < RoundedRight; DestX += 8, SourceX += 8, DestBits++)
451  {
452  Dest = *DestBits;
453  if (UsesSource)
454  {
455  Source =
456  (DIB_GetSource(BltInfo->SourceSurface, SourceX + 1, SourceY, BltInfo->XlateSourceToDest)) |
457  (DIB_GetSource(BltInfo->SourceSurface, SourceX + 0, SourceY, BltInfo->XlateSourceToDest) << 4) |
458  (DIB_GetSource(BltInfo->SourceSurface, SourceX + 3, SourceY, BltInfo->XlateSourceToDest) << 8) |
459  (DIB_GetSource(BltInfo->SourceSurface, SourceX + 2, SourceY, BltInfo->XlateSourceToDest) << 12) |
460  (DIB_GetSource(BltInfo->SourceSurface, SourceX + 5, SourceY, BltInfo->XlateSourceToDest) << 16) |
461  (DIB_GetSource(BltInfo->SourceSurface, SourceX + 4, SourceY, BltInfo->XlateSourceToDest) << 20) |
462  (DIB_GetSource(BltInfo->SourceSurface, SourceX + 7, SourceY, BltInfo->XlateSourceToDest) << 24) |
463  (DIB_GetSource(BltInfo->SourceSurface, SourceX + 6, SourceY, BltInfo->XlateSourceToDest) << 28);
464  }
465  if (BltInfo->PatternSurface)
466  {
467  Pattern = DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 1) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY);
468  Pattern |= DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 0) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY) << 4;
469  Pattern |= DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 3) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY) << 8;
470  Pattern |= DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 2) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY) << 12;
471  Pattern |= DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 5) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY) << 16;
472  Pattern |= DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 4) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY) << 20;
473  Pattern |= DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 7) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY) << 24;
474  Pattern |= DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 6) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY) << 28;
475  }
476  *DestBits = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
477  }
478 
479  /* Process the rest of pixel on the line */
480  for (; DestX < BltInfo->DestRect.right; DestX++, SourceX++)
481  {
482  Dest = DIB_4BPP_GetPixel(BltInfo->DestSurface, DestX, DestY);
483  if (UsesSource)
484  {
485  Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
486  }
487  if (BltInfo->PatternSurface)
488  {
489  Pattern = DIB_GetSourceIndex(BltInfo->PatternSurface,
490  (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY);
491  }
492  DIB_4BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xF);
493  }
494 
495  SourceY++;
496  if (BltInfo->PatternSurface)
497  {
498  PatternY++;
499  PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
500  }
501  }
502 
503  return TRUE;
504 }
POINTL BrushOrigin
Definition: dib.h:29
ROP4 Rop4
Definition: dib.h:30
SIZEL sizlBitmap
Definition: winddi.h:1209
LONG lDelta
Definition: winddi.h:1213
XLATEOBJ * XlateSourceToDest
Definition: dib.h:25
#define TRUE
Definition: types.h:120
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
SURFOBJ * PatternSurface
Definition: dib.h:24
LONG y
Definition: windef.h:330
uint32_t ULONG_PTR
Definition: typedefs.h:65
long right
Definition: polytest.cpp:53
#define DIB_GetSource(SourceSurf, sx, sy, ColorTranslation)
Definition: dib.h:136
long LONG
Definition: pedump.c:60
VOID DIB_4BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib4bpp.c:19
#define DIB_GetSourceIndex(SourceSurf, sx, sy)
Definition: dib.h:141
long top
Definition: polytest.cpp:53
unsigned char BOOLEAN
LONG cx
Definition: windef.h:334
#define ROP4_USES_SOURCE(Rop4)
Definition: inteng.h:45
ULONG DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern)
Definition: dib.c:92
long left
Definition: polytest.cpp:53
SURFOBJ * SourceSurface
Definition: dib.h:23
RECTL DestRect
Definition: dib.h:26
SURFOBJ * DestSurface
Definition: dib.h:22
LONG x
Definition: windef.h:329
ULONG DIB_4BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
Definition: dib4bpp.c:26
ULONG iSolidColor
Definition: winddi.h:234
BRUSHOBJ * Brush
Definition: dib.h:28
#define ROP4_USES_PATTERN(Rop4)
Definition: inteng.h:46
unsigned int * PULONG
Definition: retypes.h:1
POINTL SourcePoint
Definition: dib.h:27
unsigned int ULONG
Definition: retypes.h:1
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
LONG cy
Definition: windef.h:335
BYTE * PBYTE
Definition: pedump.c:66
PVOID pvScan0
Definition: winddi.h:1212

◆ DIB_4BPP_BitBltSrcCopy()

BOOLEAN DIB_4BPP_BitBltSrcCopy ( PBLTINFO  BltInfo)

Definition at line 63 of file dib4bpp.c.

64 {
65  LONG i, j, sx, sy, f2, xColor;
66  PBYTE SourceBits_24BPP, SourceLine_24BPP;
67  PBYTE DestBits, DestLine, SourceBits_8BPP, SourceLine_8BPP;
68  PBYTE SourceBits, SourceLine;
69  BOOLEAN bTopToBottom, bLeftToRight;
70 
71  DPRINT("DIB_4BPP_BitBltSrcCopy: SrcSurf cx/cy (%d/%d), DestSuft cx/cy (%d/%d) dstRect: (%d,%d)-(%d,%d)\n",
73  BltInfo->DestSurface->sizlBitmap.cx, BltInfo->DestSurface->sizlBitmap.cy,
74  BltInfo->DestRect.left, BltInfo->DestRect.top, BltInfo->DestRect.right, BltInfo->DestRect.bottom);
75 
76  /* Get back left to right flip here */
77  bLeftToRight = (BltInfo->DestRect.left > BltInfo->DestRect.right);
78 
79  /* Check for top to bottom flip needed. */
80  bTopToBottom = BltInfo->DestRect.top > BltInfo->DestRect.bottom;
81 
82  /* Make WellOrdered with top < bottom and left < right */
84 
85  DPRINT("BPP is '%d/%d' & BltInfo->SourcePoint.x is '%d' & BltInfo->SourcePoint.y is '%d'.\n",
86  BltInfo->SourceSurface->iBitmapFormat, BltInfo->SourcePoint.x, BltInfo->SourcePoint.y);
87 
88  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 +
89  (BltInfo->DestRect.left >> 1) +
90  BltInfo->DestRect.top * BltInfo->DestSurface->lDelta;
91 
92  switch (BltInfo->SourceSurface->iBitmapFormat)
93  {
94  case BMF_1BPP:
95  DPRINT("1BPP Case Selected with DestRect Width of '%d'.\n",
96  BltInfo->DestRect.right - BltInfo->DestRect.left);
97 
98  sx = BltInfo->SourcePoint.x;
99 
100  /* This sets sy to the top line */
101  sy = BltInfo->SourcePoint.y;
102 
103  if (bTopToBottom)
104  {
105  /* This sets sy to the bottom line */
106  sy += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;
107  }
108 
109  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
110  {
111  sx = BltInfo->SourcePoint.x;
112 
113  if (bLeftToRight)
114  {
115  /* This sets the sx to the rightmost pixel */
116  sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
117  }
118 
119  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
120  {
121  if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
122  {
124  }
125  else
126  {
128  }
129  DEC_OR_INC(sx, bLeftToRight, 1);
130  }
131  DEC_OR_INC(sy, bTopToBottom, 1);
132  }
133  break;
134 
135  case BMF_4BPP:
136  DPRINT("4BPP Case Selected with DestRect Width of '%d'.\n",
137  BltInfo->DestRect.right - BltInfo->DestRect.left);
138 
139  /* This sets sy to the top line */
140  sy = BltInfo->SourcePoint.y;
141 
142  if (bTopToBottom)
143  {
144  /* This sets sy to the bottom line */
145  sy += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1)
146  * BltInfo->SourceSurface->lDelta;
147  }
148 
149  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
150  {
151  sx = BltInfo->SourcePoint.x;
152 
153  if (bLeftToRight)
154  {
155  /* This sets the sx to the rightmost pixel */
156  sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
157  }
158 
159  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
160  {
161  if (NULL != BltInfo->XlateSourceToDest)
162  {
163  DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j,
165  DIB_4BPP_GetPixel(BltInfo->SourceSurface, sx, sy)));
166  }
167  else
168  {
169  DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j,
170  DIB_4BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
171  }
172  DEC_OR_INC(sx, bLeftToRight, 1);
173  }
174  DEC_OR_INC(sy, bTopToBottom, 1);
175  }
176  break;
177 
178  case BMF_8BPP:
179  DPRINT("8BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
180  BltInfo->DestRect.left, BltInfo->DestRect.top,
181  BltInfo->DestRect.right, BltInfo->DestRect.bottom,
182  BltInfo->DestRect.right - BltInfo->DestRect.left);
183 
184  SourceBits_8BPP = (PBYTE)BltInfo->SourceSurface->pvScan0 +
185  (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
186 
187  if (bTopToBottom)
188  {
189  /* This sets SourceBits to the bottom line */
190  SourceBits_8BPP = (PBYTE)((LONG_PTR)SourceBits_8BPP +
191  ((BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) *
192  BltInfo->SourceSurface->lDelta));
193  }
194 
195  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
196  {
197  SourceLine_8BPP = SourceBits_8BPP;
198  DestLine = DestBits;
199 
200  if (bLeftToRight)
201  {
202  /* This sets SourceBits_8BPP to the rightmost pixel */
203  SourceBits_8BPP += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
204  }
205 
206  f2 = BltInfo->DestRect.left & 1;
207 
208  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
209  {
210  *DestLine = (*DestLine & notmask[f2]) |
211  (BYTE)((XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceLine_8BPP)) << ((4 * (1 - f2))));
212  if (f2 == 1) { DestLine++; f2 = 0; } else { f2 = 1; }
213  DEC_OR_INC(SourceLine_8BPP, bLeftToRight, 1);
214  }
215  DEC_OR_INC(SourceBits_8BPP, bTopToBottom, BltInfo->SourceSurface->lDelta);
216  DestBits += BltInfo->DestSurface->lDelta;
217  }
218  break;
219 
220  case BMF_16BPP:
221  DPRINT("16BPP Case Selected with DestRect Width of '%d'.\n",
222  BltInfo->DestRect.right - BltInfo->DestRect.left);
223 
224  DPRINT("BMF_16BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
225  BltInfo->DestRect.left, BltInfo->DestRect.top,
226  BltInfo->DestRect.right, BltInfo->DestRect.bottom,
227  BltInfo->DestRect.right - BltInfo->DestRect.left);
228 
229  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
230  (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) +
231  2 * BltInfo->SourcePoint.x;
232 
233  if (bTopToBottom)
234  {
235  /* This sets SourceLine to the bottom line */
236  SourceLine += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) *
237  BltInfo->SourceSurface->lDelta;;
238  }
239 
240  DestLine = DestBits;
241 
242  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
243  {
244  SourceBits = SourceLine;
245 
246  if (bLeftToRight)
247  {
248  /* This sets SourceBits to the rightmost pixel */
249  SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1) * 2;
250  }
251 
252  DestBits = DestLine;
253  f2 = BltInfo->DestRect.left & 1;
254 
255  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
256  {
257  xColor = *((PWORD) SourceBits);
258  *DestBits = (*DestBits & notmask[f2]) |
259  (BYTE)((XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor)) << ((4 * (1 - f2))));
260  if(f2 == 1) { DestBits++; f2 = 0; } else { f2 = 1; }
261 
262  DEC_OR_INC(SourceBits, bLeftToRight, 2);
263  }
264 
265  DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
266  DestLine += BltInfo->DestSurface->lDelta;
267  }
268  break;
269 
270  case BMF_24BPP:
271 
272  DPRINT("24BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
273  BltInfo->DestRect.left, BltInfo->DestRect.top,
274  BltInfo->DestRect.right, BltInfo->DestRect.bottom,
275  BltInfo->DestRect.right - BltInfo->DestRect.left);
276 
277  SourceBits_24BPP = (PBYTE)BltInfo->SourceSurface->pvScan0 +
278  (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) +
279  BltInfo->SourcePoint.x * 3;
280 
281  if (bTopToBottom)
282  {
283  /* This sets SourceLine to the bottom line */
284  SourceBits_24BPP += BltInfo->SourceSurface->lDelta *
285  (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1);
286  }
287 
288  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
289  {
290  SourceLine_24BPP = SourceBits_24BPP;
291  DestLine = DestBits;
292  f2 = BltInfo->DestRect.left & 1;
293 
294  if (bLeftToRight)
295  {
296  /* This sets the SourceBits_24BPP to the rightmost pixel */
297  SourceLine_24BPP += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1) * 3;
298  }
299 
300  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
301  {
302  xColor = (*(SourceLine_24BPP + 2) << 0x10) +
303  (*(SourceLine_24BPP + 1) << 0x08) +
304  (*(SourceLine_24BPP));
305  *DestLine = (*DestLine & notmask[f2]) |
306  (BYTE)((XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor)) << ((4 * (1 - f2))));
307  if(f2 == 1) { DestLine++; f2 = 0; } else { f2 = 1; }
308  DEC_OR_INC(SourceLine_24BPP, bLeftToRight, 3);
309  }
310  DEC_OR_INC(SourceBits_24BPP, bTopToBottom, BltInfo->SourceSurface->lDelta);
311  DestBits += BltInfo->DestSurface->lDelta;
312  }
313  break;
314 
315  case BMF_32BPP:
316  DPRINT("32BPP Case Selected with DestRect Width of '%d'.\n",
317  BltInfo->DestRect.right - BltInfo->DestRect.left);
318 
319  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
320  (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) +
321  4 * BltInfo->SourcePoint.x;
322 
323  if (bTopToBottom)
324  {
325  /* This sets SourceLine to the bottom line */
326  SourceLine += BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1;
327  }
328 
329  DestLine = DestBits;
330 
331  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
332  {
333  SourceBits = SourceLine;
334  DestBits = DestLine;
335 
336  if (bLeftToRight)
337  {
338  /* This sets SourceBits to the rightmost pixel */
339  SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1) * 4;
340  }
341 
342  f2 = BltInfo->DestRect.left & 1;
343 
344  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
345  {
346  xColor = *((PDWORD) SourceBits);
347  *DestBits = (*DestBits & notmask[f2]) |
348  (BYTE)((XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor)) << ((4 * (1 - f2))));
349  if(f2 == 1) { DestBits++; f2 = 0; } else { f2 = 1; }
350 
351  DEC_OR_INC(SourceBits, bLeftToRight, 4);
352  }
353 
354  DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
355  DestLine += BltInfo->DestSurface->lDelta;
356  }
357  break;
358 
359  default:
360  DbgPrint("DIB_4BPP_BitBltSrcCopy: Unhandled Source BPP: %u\n",
362  return FALSE;
363  }
364  return(TRUE);
365 }
#define BMF_24BPP
Definition: winddi.h:359
Definition: xlate.c:8
SIZEL sizlBitmap
Definition: winddi.h:1209
LONG lDelta
Definition: winddi.h:1213
#define BMF_32BPP
Definition: winddi.h:360
#define DbgPrint
Definition: hal.h:12
XLATEOBJ * XlateSourceToDest
Definition: dib.h:25
#define TRUE
Definition: types.h:120
#define BitsPerFormat(Format)
Definition: surface.h:109
long bottom
Definition: polytest.cpp:53
ULONG iBitmapFormat
Definition: winddi.h:1215
LONG y
Definition: windef.h:330
long right
Definition: polytest.cpp:53
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
VOID DIB_4BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib4bpp.c:19
long top
Definition: polytest.cpp:53
unsigned char BOOLEAN
LONG cx
Definition: windef.h:334
unsigned char notmask[2]
Definition: dib.c:17
long left
Definition: polytest.cpp:53
#define BMF_16BPP
Definition: winddi.h:358
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 GLint GLint j
Definition: glfuncs.h:250
SURFOBJ * SourceSurface
Definition: dib.h:23
WORD * PWORD
Definition: pedump.c:67
RECTL DestRect
Definition: dib.h:26
SURFOBJ * DestSurface
Definition: dib.h:22
LONG x
Definition: windef.h:329
#define DEC_OR_INC(var, decTrue, amount)
Definition: dib4bpp.c:15
ULONG DIB_4BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
Definition: dib4bpp.c:26
ULONG DIB_1BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib1bpp.c:30
unsigned char BYTE
Definition: xxhash.c:193
Definition: xlate.c:9
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
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
DWORD * PDWORD
Definition: pedump.c:68
POINTL SourcePoint
Definition: dib.h:27
Definition: xlate.c:10
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
#define DPRINT
Definition: sndvol32.h:71
int f2(S1 &, S2 &)
LONG cy
Definition: windef.h:335
BYTE * PBYTE
Definition: pedump.c:66
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
PVOID pvScan0
Definition: winddi.h:1212

◆ DIB_4BPP_ColorFill()

BOOLEAN DIB_4BPP_ColorFill ( SURFOBJ DestSurface,
RECTL DestRect,
ULONG  color 
)

Definition at line 508 of file dib4bpp.c.

509 {
510  LONG DestY;
511 
512  /* Make WellOrdered by making top < bottom and left < right */
513  RECTL_vMakeWellOrdered(DestRect);
514 
515  for (DestY = DestRect->top; DestY < DestRect->bottom; DestY++)
516  {
517  DIB_4BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
518  }
519  return TRUE;
520 }
#define TRUE
Definition: types.h:120
VOID DIB_4BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
Definition: dib4bpp.c:33
long right
Definition: polytest.cpp:53
long LONG
Definition: pedump.c:60
GLuint color
Definition: glext.h:6243
long top
Definition: polytest.cpp:53
GLint GLint bottom
Definition: glext.h:7726
long left
Definition: polytest.cpp:53
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81

◆ DIB_4BPP_GetPixel()

ULONG DIB_4BPP_GetPixel ( SURFOBJ SurfObj,
LONG  x,
LONG  y 
)

Definition at line 26 of file dib4bpp.c.

27 {
28  PBYTE addr = (PBYTE)SurfObj->pvScan0 + (x>>1) + y * SurfObj->lDelta;
29  return (*addr >> ((1-(x&1))<<2)) & 0x0f;
30 }
LONG lDelta
Definition: winddi.h:1213
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLenum const GLvoid * addr
Definition: glext.h:9621
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
BYTE * PBYTE
Definition: pedump.c:66
PVOID pvScan0
Definition: winddi.h:1212

Referenced by DIB_1BPP_BitBltSrcCopy(), DIB_4BPP_BitBlt(), and DIB_4BPP_BitBltSrcCopy().

◆ DIB_4BPP_HLine()

VOID DIB_4BPP_HLine ( SURFOBJ SurfObj,
LONG  x1,
LONG  x2,
LONG  y,
ULONG  c 
)

Definition at line 33 of file dib4bpp.c.

34 {
35  PBYTE addr = (PBYTE)SurfObj->pvScan0 + (x1>>1) + y * SurfObj->lDelta;
36  LONG cx = x1;
37 
38  while(cx < x2)
39  {
40  *addr = (*addr & notmask[x1&1]) | (BYTE)(c << ((1-(x1&1))<<2));
41  if((++x1 & 1) == 0)
42  ++addr;
43  ++cx;
44  }
45 }
LONG lDelta
Definition: winddi.h:1213
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
long LONG
Definition: pedump.c:60
unsigned char notmask[2]
Definition: dib.c:17
const GLubyte * c
Definition: glext.h:8905
GLenum const GLvoid * addr
Definition: glext.h:9621
unsigned char BYTE
Definition: xxhash.c:193
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
_Out_opt_ int * cx
Definition: commctrl.h:585
BYTE * PBYTE
Definition: pedump.c:66
PVOID pvScan0
Definition: winddi.h:1212

Referenced by DIB_4BPP_ColorFill().

◆ DIB_4BPP_PutPixel()

VOID DIB_4BPP_PutPixel ( SURFOBJ SurfObj,
LONG  x,
LONG  y,
ULONG  c 
)

Definition at line 19 of file dib4bpp.c.

20 {
21  PBYTE addr = (PBYTE)SurfObj->pvScan0 + (x>>1) + y * SurfObj->lDelta;
22  *addr = (*addr & notmask[x&1]) | (BYTE)(c << ((1-(x&1))<<2));
23 }
LONG lDelta
Definition: winddi.h:1213
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
unsigned char notmask[2]
Definition: dib.c:17
const GLubyte * c
Definition: glext.h:8905
GLenum const GLvoid * addr
Definition: glext.h:9621
unsigned char BYTE
Definition: xxhash.c:193
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
BYTE * PBYTE
Definition: pedump.c:66
PVOID pvScan0
Definition: winddi.h:1212

Referenced by DIB_4BPP_BitBlt(), and DIB_4BPP_BitBltSrcCopy().

◆ DIB_4BPP_TransparentBlt()

BOOLEAN DIB_4BPP_TransparentBlt ( SURFOBJ DestSurf,
SURFOBJ SourceSurf,
RECTL DestRect,
RECTL SourceRect,
XLATEOBJ ColorTranslation,
ULONG  iTransColor 
)

Definition at line 524 of file dib4bpp.c.

527 {
528  return FALSE;
529 }
#define FALSE
Definition: types.h:117

◆ DIB_4BPP_VLine()

VOID DIB_4BPP_VLine ( SURFOBJ SurfObj,
LONG  x,
LONG  y1,
LONG  y2,
ULONG  c 
)

Definition at line 48 of file dib4bpp.c.

49 {
50  PBYTE addr = SurfObj->pvScan0;
51  int lDelta = SurfObj->lDelta;
52 
53  addr += (x>>1) + y1 * lDelta;
54  while(y1++ < y2)
55  {
56  *addr = (*addr & notmask[x&1]) | (BYTE)(c << ((1-(x&1))<<2));
57  addr += lDelta;
58  }
59 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
LONG lDelta
Definition: winddi.h:1213
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
unsigned char notmask[2]
Definition: dib.c:17
const GLubyte * c
Definition: glext.h:8905
GLenum const GLvoid * addr
Definition: glext.h:9621
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
unsigned char BYTE
Definition: xxhash.c:193
BYTE * PBYTE
Definition: pedump.c:66
PVOID pvScan0
Definition: winddi.h:1212