ReactOS  0.4.13-dev-101-g0ca4b50
dib24bpp.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for dib24bpp.c:

Go to the source code of this file.

Classes

union  NICEPIXEL32
 

Macros

#define NDEBUG
 

Functions

VOID DIB_24BPP_PutPixel (SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
 
ULONG DIB_24BPP_GetPixel (SURFOBJ *SurfObj, LONG x, LONG y)
 
VOID DIB_24BPP_VLine (SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
 
BOOLEAN DIB_24BPP_BitBltSrcCopy (PBLTINFO BltInfo)
 
BOOLEAN DIB_24BPP_BitBlt (PBLTINFO BltInfo)
 
BOOLEAN DIB_24BPP_ColorFill (SURFOBJ *DestSurface, RECTL *DestRect, ULONG color)
 
BOOLEAN DIB_24BPP_TransparentBlt (SURFOBJ *DestSurf, SURFOBJ *SourceSurf, RECTL *DestRect, RECTL *SourceRect, XLATEOBJ *ColorTranslation, ULONG iTransColor)
 
static __inline UCHAR Clamp8 (ULONG val)
 
BOOLEAN DIB_24BPP_AlphaBlend (SURFOBJ *Dest, SURFOBJ *Source, RECTL *DestRect, RECTL *SourceRect, CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation, BLENDOBJ *BlendObj)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file dib24bpp.c.

Function Documentation

◆ Clamp8()

static __inline UCHAR Clamp8 ( ULONG  val)
static

Definition at line 458 of file dib24bpp.c.

459 {
460  return (val > 255) ? 255 : (UCHAR)val;
461 }
GLuint GLfloat * val
Definition: glext.h:7180
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by DIB_24BPP_AlphaBlend().

◆ DIB_24BPP_AlphaBlend()

BOOLEAN DIB_24BPP_AlphaBlend ( SURFOBJ Dest,
SURFOBJ Source,
RECTL DestRect,
RECTL SourceRect,
CLIPOBJ ClipRegion,
XLATEOBJ ColorTranslation,
BLENDOBJ BlendObj 
)

Definition at line 464 of file dib24bpp.c.

467 {
468  INT Rows, Cols, SrcX, SrcY;
469  register PUCHAR Dst;
471  register NICEPIXEL32 DstPixel, SrcPixel;
472  UCHAR Alpha;
473  //UCHAR SrcBpp;
474 
475  DPRINT("DIB_24BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
476  SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
477  DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
478 
479  BlendFunc = BlendObj->BlendFunction;
481  {
482  DPRINT1("BlendOp != AC_SRC_OVER\n");
483  return FALSE;
484  }
485  if (BlendFunc.BlendFlags != 0)
486  {
487  DPRINT1("BlendFlags != 0\n");
488  return FALSE;
489  }
490  if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0)
491  {
492  DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat);
493  return FALSE;
494  }
495  if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 &&
496  BitsPerFormat(Source->iBitmapFormat) != 32)
497  {
498  DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n");
499  return FALSE;
500  }
501 
502  Dst = (PUCHAR)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) +
503  (DestRect->left * 3));
504  //SrcBpp = BitsPerFormat(Source->iBitmapFormat);
505 
506  Rows = 0;
507  SrcY = SourceRect->top;
508  while (++Rows <= DestRect->bottom - DestRect->top)
509  {
510  Cols = 0;
511  SrcX = SourceRect->left;
512  while (++Cols <= DestRect->right - DestRect->left)
513  {
514  SrcPixel.ul = DIB_GetSource(Source, SrcX, SrcY, ColorTranslation);
515  SrcPixel.col.red = (SrcPixel.col.red * BlendFunc.SourceConstantAlpha) / 255;
516  SrcPixel.col.green = (SrcPixel.col.green * BlendFunc.SourceConstantAlpha) / 255;
517  SrcPixel.col.blue = (SrcPixel.col.blue * BlendFunc.SourceConstantAlpha) / 255;
519  {
521  }
522  else
523  {
524  Alpha = (SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha) / 255;
525  }
526 
527  DstPixel.col.red = Clamp8((*Dst * (255 - Alpha)) / 255 + SrcPixel.col.red) ;
528  DstPixel.col.green = Clamp8((*(Dst+1) * (255 - Alpha) / 255 + SrcPixel.col.green)) ;
529  DstPixel.col.blue = Clamp8((*(Dst+2) * (255 - Alpha)) / 255 + SrcPixel.col.blue) ;
530  *Dst++ = DstPixel.col.red;
531  *Dst++ = DstPixel.col.green;
532  *Dst++ = DstPixel.col.blue;
533  SrcX = SourceRect->left + (Cols*(SourceRect->right - SourceRect->left))/(DestRect->right - DestRect->left);
534  }
535  Dst = (PUCHAR)((ULONG_PTR)Dest->pvScan0 + ((DestRect->top + Rows) * Dest->lDelta) +
536  (DestRect->left*3));
537  SrcY = SourceRect->top + (Rows*(SourceRect->bottom - SourceRect->top))/(DestRect->bottom - DestRect->top);
538  }
539 
540  return TRUE;
541 }
#define TRUE
Definition: types.h:120
LONG lDelta
Definition: winddi.h:1213
struct NICEPIXEL32::@4072 col
#define BitsPerFormat(Format)
Definition: surface.h:109
unsigned char * PUCHAR
Definition: retypes.h:3
long bottom
Definition: polytest.cpp:53
#define AC_SRC_ALPHA
Definition: alphablend.c:9
int32_t INT
Definition: typedefs.h:56
BYTE BlendOp
Definition: wingdi.h:2737
uint32_t ULONG_PTR
Definition: typedefs.h:63
long right
Definition: polytest.cpp:53
#define DIB_GetSource(SourceSurf, sx, sy, ColorTranslation)
Definition: dib.h:136
long top
Definition: polytest.cpp:53
_In_ ULONG Rows
Definition: haltypes.h:7
void DPRINT(...)
Definition: polytest.cpp:61
GLint GLint bottom
Definition: glext.h:7726
long left
Definition: polytest.cpp:53
BYTE SourceConstantAlpha
Definition: wingdi.h:2739
GLdouble GLdouble right
Definition: glext.h:10859
unsigned char UCHAR
Definition: xmlstorage.h:181
BYTE BlendFlags
Definition: wingdi.h:2738
#define AC_SRC_OVER
Definition: wingdi.h:1351
#define Dst
Definition: mesh.h:153
#define DPRINT1
Definition: precomp.h:8
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3149
static __inline UCHAR Clamp8(ULONG val)
Definition: dib24bpp.c:458
BYTE AlphaFormat
Definition: wingdi.h:2740
BLENDFUNCTION BlendFunc
Definition: general.c:32
ULONG ul
Definition: alphablend.c:16
BLENDFUNCTION BlendFunction
Definition: winddi.h:224
PVOID pvScan0
Definition: winddi.h:1212

◆ DIB_24BPP_BitBlt()

BOOLEAN DIB_24BPP_BitBlt ( PBLTINFO  BltInfo)

Definition at line 229 of file dib24bpp.c.

230 {
231  LONG DestX, DestY;
232  LONG SourceX, SourceY;
233  LONG PatternY = 0;
234  ULONG Dest, Source = 0, Pattern = 0;
235  BOOL UsesSource;
236  BOOL UsesPattern;
237  PBYTE DestBits;
238 
239  UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4);
240  UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4);
241 
242  SourceY = BltInfo->SourcePoint.y;
243  DestBits = (PBYTE)(
244  (PBYTE)BltInfo->DestSurface->pvScan0 +
245  (BltInfo->DestRect.left << 1) + BltInfo->DestRect.left +
246  BltInfo->DestRect.top * BltInfo->DestSurface->lDelta);
247 
248  if (UsesPattern)
249  {
250  if (BltInfo->PatternSurface)
251  {
252  PatternY = (BltInfo->DestRect.top - BltInfo->BrushOrigin.y) %
253  BltInfo->PatternSurface->sizlBitmap.cy;
254  }
255  else
256  {
257  if (BltInfo->Brush)
258  Pattern = BltInfo->Brush->iSolidColor;
259  }
260  }
261 
262  for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
263  {
264  SourceX = BltInfo->SourcePoint.x;
265 
266  for (DestX = BltInfo->DestRect.left; DestX < BltInfo->DestRect.right; DestX++, DestBits += 3, SourceX++)
267  {
268  Dest = *((PUSHORT)DestBits) + (*(DestBits + 2) << 16);
269 
270  if (UsesSource)
271  {
272  Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
273  }
274 
275  if (BltInfo->PatternSurface)
276  {
277  Pattern = DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX - BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY);
278  }
279 
280  Dest = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xFFFFFF;
281  *(PUSHORT)(DestBits) = Dest & 0xFFFF;
282  *(DestBits + 2) = (BYTE)(Dest >> 16);
283  }
284 
285  SourceY++;
286  if (BltInfo->PatternSurface)
287  {
288  PatternY++;
289  PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
290  }
291  DestBits -= (BltInfo->DestRect.right - BltInfo->DestRect.left) * 3;
292  DestBits += BltInfo->DestSurface->lDelta;
293  }
294 
295  return TRUE;
296 }
POINTL BrushOrigin
Definition: dib.h:29
ROP4 Rop4
Definition: dib.h:30
#define TRUE
Definition: types.h:120
SIZEL sizlBitmap
Definition: winddi.h:1209
LONG lDelta
Definition: winddi.h:1213
XLATEOBJ * XlateSourceToDest
Definition: dib.h:25
SURFOBJ * PatternSurface
Definition: dib.h:24
LONG y
Definition: windef.h:315
long right
Definition: polytest.cpp:53
#define DIB_GetSource(SourceSurf, sx, sy, ColorTranslation)
Definition: dib.h:136
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define DIB_GetSourceIndex(SourceSurf, sx, sy)
Definition: dib.h:141
long top
Definition: polytest.cpp:53
LONG cx
Definition: windef.h:319
#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:314
ULONG iSolidColor
Definition: winddi.h:234
BRUSHOBJ * Brush
Definition: dib.h:28
unsigned char BYTE
Definition: mem.h:68
#define ROP4_USES_PATTERN(Rop4)
Definition: inteng.h:46
POINTL SourcePoint
Definition: dib.h:27
unsigned int ULONG
Definition: retypes.h:1
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3149
LONG cy
Definition: windef.h:320
BYTE * PBYTE
Definition: pedump.c:66
unsigned short * PUSHORT
Definition: retypes.h:2
PVOID pvScan0
Definition: winddi.h:1212

◆ DIB_24BPP_BitBltSrcCopy()

BOOLEAN DIB_24BPP_BitBltSrcCopy ( PBLTINFO  BltInfo)

Definition at line 50 of file dib24bpp.c.

51 {
52  LONG i, j, sx, sy, xColor, f1;
53  PBYTE SourceBits, DestBits, SourceLine, DestLine;
54  PBYTE SourceBits_4BPP, SourceLine_4BPP;
55  PWORD SourceBits_16BPP, SourceLine_16BPP;
56 
57  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left * 3;
58 
59  switch(BltInfo->SourceSurface->iBitmapFormat)
60  {
61  case BMF_1BPP:
62  sx = BltInfo->SourcePoint.x;
63  sy = BltInfo->SourcePoint.y;
64 
65  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
66  {
67  sx = BltInfo->SourcePoint.x;
68  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
69  {
70  if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
71  {
73  } else {
75  }
76  sx++;
77  }
78  sy++;
79  }
80  break;
81 
82  case BMF_4BPP:
83  SourceBits_4BPP = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + (BltInfo->SourcePoint.x >> 1);
84 
85  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
86  {
87  SourceLine_4BPP = SourceBits_4BPP;
88  DestLine = DestBits;
89  sx = BltInfo->SourcePoint.x;
90  f1 = sx & 1;
91 
92  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
93  {
94  xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
95  (*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
96  *DestLine++ = xColor & 0xff;
97  *(PWORD)DestLine = (WORD)(xColor >> 8);
98  DestLine += 2;
99  if(f1 == 1) { SourceLine_4BPP++; f1 = 0; } else { f1 = 1; }
100  sx++;
101  }
102 
103  SourceBits_4BPP += BltInfo->SourceSurface->lDelta;
104  DestBits += BltInfo->DestSurface->lDelta;
105  }
106  break;
107 
108  case BMF_8BPP:
109  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
110  DestLine = DestBits;
111 
112  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
113  {
114  SourceBits = SourceLine;
115  DestBits = DestLine;
116 
117  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
118  {
119  xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits);
120  *DestBits = xColor & 0xff;
121  *(PWORD)(DestBits + 1) = (WORD)(xColor >> 8);
122  SourceBits += 1;
123  DestBits += 3;
124  }
125 
126  SourceLine += BltInfo->SourceSurface->lDelta;
127  DestLine += BltInfo->DestSurface->lDelta;
128  }
129  break;
130 
131  case BMF_16BPP:
132  SourceBits_16BPP = (PWORD)((PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x);
133 
134  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
135  {
136  SourceLine_16BPP = SourceBits_16BPP;
137  DestLine = DestBits;
138 
139  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
140  {
141  xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceLine_16BPP);
142  *DestLine++ = xColor & 0xff;
143  *(PWORD)DestLine = (WORD)(xColor >> 8);
144  DestLine += 2;
145  SourceLine_16BPP++;
146  }
147 
148  SourceBits_16BPP = (PWORD)((PBYTE)SourceBits_16BPP + BltInfo->SourceSurface->lDelta);
149  DestBits += BltInfo->DestSurface->lDelta;
150  }
151  break;
152 
153  case BMF_24BPP:
154  if (NULL == BltInfo->XlateSourceToDest || 0 != (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL))
155  {
156  if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
157  {
158  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x;
159  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
160  {
161  RtlMoveMemory(DestBits, SourceBits, 3 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
162  SourceBits += BltInfo->SourceSurface->lDelta;
163  DestBits += BltInfo->DestSurface->lDelta;
164  }
165  }
166  else
167  {
168  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x;
169  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 3 * BltInfo->DestRect.left;
170  for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
171  {
172  RtlMoveMemory(DestBits, SourceBits, 3 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
173  SourceBits -= BltInfo->SourceSurface->lDelta;
174  DestBits -= BltInfo->DestSurface->lDelta;
175  }
176  }
177  }
178  else
179  {
180  sx = BltInfo->SourcePoint.x;
181  sy = BltInfo->SourcePoint.y;
182 
183  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
184  {
185  sx = BltInfo->SourcePoint.x;
186  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
187  {
188  DWORD pixel = DIB_24BPP_GetPixel(BltInfo->SourceSurface, sx, sy);
189  DIB_24BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, pixel));
190  sx++;
191  }
192  sy++;
193  }
194  }
195  break;
196 
197  case BMF_32BPP:
198  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
199  DestLine = DestBits;
200 
201  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
202  {
203  SourceBits = SourceLine;
204  DestBits = DestLine;
205 
206  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
207  {
208  xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *((PDWORD) SourceBits));
209  *DestBits = xColor & 0xff;
210  *(PWORD)(DestBits + 1) = (WORD)(xColor >> 8);
211  SourceBits += 4;
212  DestBits += 3;
213  }
214 
215  SourceLine += BltInfo->SourceSurface->lDelta;
216  DestLine += BltInfo->DestSurface->lDelta;
217  }
218  break;
219 
220  default:
221  DbgPrint("DIB_24BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
222  return FALSE;
223  }
224 
225  return TRUE;
226 }
#define BMF_24BPP
Definition: winddi.h:359
FLONG flXlate
Definition: winddi.h:1256
#define TRUE
Definition: types.h:120
LONG lDelta
Definition: winddi.h:1213
#define BMF_32BPP
Definition: winddi.h:360
#define DbgPrint
Definition: loader.c:25
XLATEOBJ * XlateSourceToDest
Definition: dib.h:25
unsigned char altnotmask[2]
Definition: dib.c:18
#define BitsPerFormat(Format)
Definition: surface.h:109
long bottom
Definition: polytest.cpp:53
Definition: xlate.c:10
ULONG iBitmapFormat
Definition: winddi.h:1215
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
LONG y
Definition: windef.h:315
long right
Definition: polytest.cpp:53
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
long LONG
Definition: pedump.c:60
long top
Definition: polytest.cpp:53
VOID DIB_24BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib24bpp.c:17
smooth NULL
Definition: ftsmooth.c:416
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
ULONG DIB_24BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
Definition: dib24bpp.c:25
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG x
Definition: windef.h:314
ULONG DIB_1BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib1bpp.c:26
#define XO_TRIVIAL
Definition: winddi.h:1247
#define f1(x, y, z)
Definition: sha1.c:30
Definition: xlate.c:8
DWORD * PDWORD
Definition: pedump.c:68
POINTL SourcePoint
Definition: dib.h:27
Definition: xlate.c:9
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
BYTE * PBYTE
Definition: pedump.c:66
PVOID pvScan0
Definition: winddi.h:1212

◆ DIB_24BPP_ColorFill()

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

Definition at line 300 of file dib24bpp.c.

301 {
302  LONG DestY;
303 
304 #if defined(_M_IX86) && !defined(_MSC_VER)
305  PBYTE xaddr = (PBYTE)DestSurface->pvScan0 + DestRect->top * DestSurface->lDelta + (DestRect->left << 1) + DestRect->left;
306  PBYTE addr;
307  ULONG Count;
308  ULONG xCount=DestRect->right - DestRect->left;
309 
310  for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
311  {
312  Count = xCount;
313  addr = xaddr;
314  xaddr = (PBYTE)((ULONG_PTR)addr + DestSurface->lDelta);
315 
316  if (Count < 8)
317  {
318  /* For small fills, don't bother doing anything fancy */
319  while (Count--)
320  {
321  *(PUSHORT)(addr) = color;
322  addr += 2;
323  *(addr) = color >> 16;
324  addr += 1;
325  }
326  }
327  else
328  {
329  /* Align to 4-byte address */
330  while (0 != ((ULONG_PTR) addr & 0x3))
331  {
332  *(PUSHORT)(addr) = color;
333  addr += 2;
334  *(addr) = color >> 16;
335  addr += 1;
336  Count--;
337  }
338  /* If the color we need to fill with is 0ABC, then the final mem pattern
339  * (note little-endianness) would be:
340  *
341  * |C.B.A|C.B.A|C.B.A|C.B.A| <- pixel borders
342  * |C.B.A.C|B.A.C.B|A.C.B.A| <- ULONG borders
343  *
344  * So, taking endianness into account again, we need to fill with these
345  * ULONGs: CABC BCAB ABCA */
346 
347  /* This is about 30% faster than the generic C code below */
348  __asm__ __volatile__ (
349  "movl %1, %%ecx\n\t"
350  "andl $0xffffff, %%ecx\n\t" /* 0ABC */
351  "movl %%ecx, %%ebx\n\t" /* Construct BCAB in ebx */
352  "shrl $8, %%ebx\n\t"
353  "movl %%ecx, %%eax\n\t"
354  "shll $16, %%eax\n\t"
355  "orl %%eax, %%ebx\n\t"
356  "movl %%ecx, %%edx\n\t" /* Construct ABCA in edx */
357  "shll $8, %%edx\n\t"
358  "movl %%ecx, %%eax\n\t"
359  "shrl $16, %%eax\n\t"
360  "orl %%eax, %%edx\n\t"
361  "movl %%ecx, %%eax\n\t" /* Construct CABC in eax */
362  "shll $24, %%eax\n\t"
363  "orl %%ecx, %%eax\n\t"
364  "movl %2, %%ecx\n\t" /* Load count */
365  "shr $2, %%ecx\n\t"
366  "movl %3, %%edi\n" /* Load dest */
367  "1:\n\t"
368  "movl %%eax, (%%edi)\n\t" /* Store 4 pixels, 12 bytes */
369  "movl %%ebx, 4(%%edi)\n\t"
370  "movl %%edx, 8(%%edi)\n\t"
371  "addl $12, %%edi\n\t"
372  "dec %%ecx\n\t"
373  "jnz 1b\n\t"
374  "movl %%edi, %0"
375  : "=m"(addr)
376  : "m"(color), "m"(Count), "m"(addr)
377  : "%eax", "%ebx", "%ecx", "%edx", "%edi");
378  Count = Count & 0x03;
379  while (0 != Count--)
380  {
381  *(PUSHORT)(addr) = color;
382  addr += 2;
383  *(addr) = color >> 16;
384  addr += 1;
385  }
386  }
387  }
388 #else
389 
390  for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
391  {
392  DIB_24BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
393  }
394 #endif
395  return TRUE;
396 }
#define TRUE
Definition: types.h:120
LONG lDelta
Definition: winddi.h:1213
VOID DIB_24BPP_HLine(SURFOBJ *, LONG, LONG, LONG, ULONG)
Definition: dib24bppc.c:16
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
uint32_t ULONG_PTR
Definition: typedefs.h:63
long right
Definition: polytest.cpp:53
long LONG
Definition: pedump.c:60
GLuint color
Definition: glext.h:6243
__asm__("\t.globl GetPhys\n" "GetPhys:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lwz 3,0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")
long top
Definition: polytest.cpp:53
GLint GLint bottom
Definition: glext.h:7726
long left
Definition: polytest.cpp:53
GLenum const GLvoid * addr
Definition: glext.h:9621
unsigned int ULONG
Definition: retypes.h:1
BYTE * PBYTE
Definition: pedump.c:66
unsigned short * PUSHORT
Definition: retypes.h:2
PVOID pvScan0
Definition: winddi.h:1212

◆ DIB_24BPP_GetPixel()

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

Definition at line 25 of file dib24bpp.c.

26 {
27  PBYTE addr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + (x << 1) + x;
28  return *(PUSHORT)(addr) + (*(addr + 2) << 16);
29 }
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
unsigned short * PUSHORT
Definition: retypes.h:2
PVOID pvScan0
Definition: winddi.h:1212

Referenced by DIB_1BPP_BitBltSrcCopy(), and DIB_24BPP_BitBltSrcCopy().

◆ DIB_24BPP_PutPixel()

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

Definition at line 17 of file dib24bpp.c.

18 {
19  PBYTE addr = (PBYTE)SurfObj->pvScan0 + (y * SurfObj->lDelta) + (x << 1) + x;
20  *(PUSHORT)(addr) = c & 0xFFFF;
21  *(addr + 2) = (c >> 16) & 0xFF;
22 }
LONG lDelta
Definition: winddi.h:1213
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
const GLubyte * c
Definition: glext.h:8905
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
unsigned short * PUSHORT
Definition: retypes.h:2
PVOID pvScan0
Definition: winddi.h:1212

Referenced by DIB_24BPP_BitBltSrcCopy().

◆ DIB_24BPP_TransparentBlt()

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

Definition at line 399 of file dib24bpp.c.

402 {
403  LONG X, Y, SourceX, SourceY = 0, wd;
404  ULONG Source = 0, Dest;
405  BYTE *DestBits;
406 
407  LONG DstHeight;
408  LONG DstWidth;
409  LONG SrcHeight;
410  LONG SrcWidth;
411 
412  DstHeight = DestRect->bottom - DestRect->top;
413  DstWidth = DestRect->right - DestRect->left;
414  SrcHeight = SourceRect->bottom - SourceRect->top;
415  SrcWidth = SourceRect->right - SourceRect->left;
416 
417  DestBits = (BYTE*)((PBYTE)DestSurf->pvScan0 +
418  (DestRect->left * 3) +
419  DestRect->top * DestSurf->lDelta);
420  wd = DestSurf->lDelta - ((DestRect->right - DestRect->left) * 3);
421 
422  for(Y = DestRect->top; Y < DestRect->bottom; Y++)
423  {
424  SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
425  for(X = DestRect->left; X < DestRect->right; X++, DestBits += 3)
426  {
427  SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
428  if (SourceX >= 0 && SourceY >= 0 &&
429  SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
430  {
431  Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
432  if(Source != iTransColor)
433  {
434  Dest = XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFFFFFF;
435  *(PUSHORT)(DestBits) = Dest & 0xFFFF;
436  *(DestBits + 2) = (BYTE)(Dest >> 16);
437  }
438  }
439  }
440 
441  DestBits = (BYTE*)((ULONG_PTR)DestBits + wd);
442  }
443 
444  return TRUE;
445 }
#define TRUE
Definition: types.h:120
SIZEL sizlBitmap
Definition: winddi.h:1209
LONG lDelta
Definition: winddi.h:1213
#define Y(I)
long bottom
Definition: polytest.cpp:53
_In_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_ RECTL _In_ ULONG iTransColor
Definition: winddi.h:4190
uint32_t ULONG_PTR
Definition: typedefs.h:63
long right
Definition: polytest.cpp:53
long LONG
Definition: pedump.c:60
#define DIB_GetSourceIndex(SourceSurf, sx, sy)
Definition: dib.h:141
long top
Definition: polytest.cpp:53
LONG cx
Definition: windef.h:319
GLint GLint bottom
Definition: glext.h:7726
long left
Definition: polytest.cpp:53
GLdouble GLdouble right
Definition: glext.h:10859
unsigned char BYTE
Definition: mem.h:68
unsigned int ULONG
Definition: retypes.h:1
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3149
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
LONG cy
Definition: windef.h:320
BYTE * PBYTE
Definition: pedump.c:66
unsigned short * PUSHORT
Definition: retypes.h:2
#define X(b, s)
PVOID pvScan0
Definition: winddi.h:1212

◆ DIB_24BPP_VLine()

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

Definition at line 34 of file dib24bpp.c.

35 {
36  PBYTE addr = (PBYTE)SurfObj->pvScan0 + y1 * SurfObj->lDelta + (x << 1) + x;
37  LONG lDelta = SurfObj->lDelta;
38 
39  c &= 0xFFFFFF;
40  while(y1++ < y2)
41  {
42  *(PUSHORT)(addr) = c & 0xFFFF;
43  *(addr + 2) = (BYTE)(c >> 16);
44 
45  addr += lDelta;
46  }
47 }
_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
long LONG
Definition: pedump.c:60
const GLubyte * c
Definition: glext.h:8905
GLenum const GLvoid * addr
Definition: glext.h:9621
unsigned char BYTE
Definition: mem.h:68
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
BYTE * PBYTE
Definition: pedump.c:66
unsigned short * PUSHORT
Definition: retypes.h:2
PVOID pvScan0
Definition: winddi.h:1212