ReactOS  0.4.13-dev-92-gf251225
dib16bpp.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for dib16bpp.c:

Go to the source code of this file.

Classes

union  NICEPIXEL32
 
union  NICEPIXEL16_565
 
union  NICEPIXEL16_555
 

Macros

#define NDEBUG
 

Functions

VOID DIB_16BPP_PutPixel (SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
 
ULONG DIB_16BPP_GetPixel (SURFOBJ *SurfObj, LONG x, LONG y)
 
VOID DIB_16BPP_HLine (SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
 
VOID DIB_16BPP_VLine (SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
 
BOOLEAN DIB_16BPP_BitBltSrcCopy (PBLTINFO BltInfo)
 
BOOLEAN DIB_16BPP_ColorFill (SURFOBJ *DestSurface, RECTL *DestRect, ULONG color)
 
BOOLEAN DIB_16BPP_TransparentBlt (SURFOBJ *DestSurf, SURFOBJ *SourceSurf, RECTL *DestRect, RECTL *SourceRect, XLATEOBJ *ColorTranslation, ULONG iTransColor)
 
static __inline UCHAR Clamp6 (ULONG val)
 
static __inline UCHAR Clamp5 (ULONG val)
 
BOOLEAN DIB_16BPP_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 dib16bpp.c.

Function Documentation

◆ Clamp5()

static __inline UCHAR Clamp5 ( ULONG  val)
static

Definition at line 570 of file dib16bpp.c.

571 {
572  return (val > 31) ? 31 : (UCHAR)val;
573 }
GLuint GLfloat * val
Definition: glext.h:7180
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by DIB_16BPP_AlphaBlend().

◆ Clamp6()

static __inline UCHAR Clamp6 ( ULONG  val)
static

Definition at line 564 of file dib16bpp.c.

565 {
566  return (val > 63) ? 63 : (UCHAR)val;
567 }
GLuint GLfloat * val
Definition: glext.h:7180
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by DIB_16BPP_AlphaBlend().

◆ DIB_16BPP_AlphaBlend()

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

Definition at line 576 of file dib16bpp.c.

579 {
580  INT DstX, DstY, SrcX, SrcY;
582  NICEPIXEL32 SrcPixel32;
583  UCHAR Alpha;
584  EXLATEOBJ* pexlo;
585  EXLATEOBJ exloSrcRGB;
586 
587  DPRINT("DIB_16BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
588  SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
589  DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
590 
591  BlendFunc = BlendObj->BlendFunction;
593  {
594  DPRINT1("BlendOp != AC_SRC_OVER\n");
595  return FALSE;
596  }
597  if (BlendFunc.BlendFlags != 0)
598  {
599  DPRINT1("BlendFlags != 0\n");
600  return FALSE;
601  }
602  if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0)
603  {
604  DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat);
605  return FALSE;
606  }
607  if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 &&
608  (BitsPerFormat(Source->iBitmapFormat) != 32))
609  {
610  DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n");
611  return FALSE;
612  }
613 
614  if (!ColorTranslation)
615  {
616  DPRINT1("ColorTranslation must not be NULL!\n");
617  return FALSE;
618  }
619 
620  pexlo = CONTAINING_RECORD(ColorTranslation, EXLATEOBJ, xlo);
621  EXLATEOBJ_vInitialize(&exloSrcRGB, pexlo->ppalSrc, &gpalRGB, 0, 0, 0);
622 
623  if (pexlo->ppalDst->flFlags & PAL_RGB16_555)
624  {
625  NICEPIXEL16_555 DstPixel16;
626 
627  SrcY = SourceRect->top;
628  DstY = DestRect->top;
629  while ( DstY < DestRect->bottom )
630  {
631  SrcX = SourceRect->left;
632  DstX = DestRect->left;
633  while(DstX < DestRect->right)
634  {
635  SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo);
636  SrcPixel32.col.red = (SrcPixel32.col.red * BlendFunc.SourceConstantAlpha) / 255;
637  SrcPixel32.col.green = (SrcPixel32.col.green * BlendFunc.SourceConstantAlpha) / 255;
638  SrcPixel32.col.blue = (SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha) / 255;
639 
640  Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
641  (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha) / 255 :
643 
644  Alpha >>= 3;
645 
646  DstPixel16.us = DIB_16BPP_GetPixel(Dest, DstX, DstY) & 0xFFFF;
647  /* Perform bit loss */
648  SrcPixel32.col.red >>= 3;
649  SrcPixel32.col.green >>= 3;
650  SrcPixel32.col.blue >>= 3;
651 
652  /* Do the blend in the right bit depth */
653  DstPixel16.col.red = Clamp5((DstPixel16.col.red * (31 - Alpha)) / 31 + SrcPixel32.col.red);
654  DstPixel16.col.green = Clamp5((DstPixel16.col.green * (31 - Alpha)) / 31 + SrcPixel32.col.green);
655  DstPixel16.col.blue = Clamp5((DstPixel16.col.blue * (31 - Alpha)) / 31 + SrcPixel32.col.blue);
656 
657  DIB_16BPP_PutPixel(Dest, DstX, DstY, DstPixel16.us);
658 
659  DstX++;
660  SrcX = SourceRect->left + ((DstX-DestRect->left)*(SourceRect->right - SourceRect->left))
661  /(DestRect->right-DestRect->left);
662  }
663  DstY++;
664  SrcY = SourceRect->top + ((DstY-DestRect->top)*(SourceRect->bottom - SourceRect->top))
665  /(DestRect->bottom-DestRect->top);
666  }
667  }
668  else
669  {
670  NICEPIXEL16_565 DstPixel16;
671  UCHAR Alpha6, Alpha5;
672 
673  SrcY = SourceRect->top;
674  DstY = DestRect->top;
675  while ( DstY < DestRect->bottom )
676  {
677  SrcX = SourceRect->left;
678  DstX = DestRect->left;
679  while(DstX < DestRect->right)
680  {
681  SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo);
682  SrcPixel32.col.red = (SrcPixel32.col.red * BlendFunc.SourceConstantAlpha) / 255;
683  SrcPixel32.col.green = (SrcPixel32.col.green * BlendFunc.SourceConstantAlpha) / 255;
684  SrcPixel32.col.blue = (SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha) / 255;
685 
686  Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
687  (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha) / 255 :
689 
690  Alpha6 = Alpha >> 2;
691  Alpha5 = Alpha >> 3;
692 
693  DstPixel16.us = DIB_16BPP_GetPixel(Dest, DstX, DstY) & 0xFFFF;
694  /* Perform bit loss */
695  SrcPixel32.col.red >>= 3;
696  SrcPixel32.col.green >>= 2;
697  SrcPixel32.col.blue >>= 3;
698 
699  /* Do the blend in the right bit depth */
700  DstPixel16.col.red = Clamp5((DstPixel16.col.red * (31 - Alpha5)) / 31 + SrcPixel32.col.red);
701  DstPixel16.col.green = Clamp6((DstPixel16.col.green * (63 - Alpha6)) / 63 + SrcPixel32.col.green);
702  DstPixel16.col.blue = Clamp5((DstPixel16.col.blue * (31 - Alpha5)) / 31 + SrcPixel32.col.blue);
703 
704  DIB_16BPP_PutPixel(Dest, DstX, DstY, DstPixel16.us);
705 
706  DstX++;
707  SrcX = SourceRect->left + ((DstX-DestRect->left)*(SourceRect->right - SourceRect->left))
708  /(DestRect->right-DestRect->left);
709  }
710  DstY++;
711  SrcY = SourceRect->top + ((DstY-DestRect->top)*(SourceRect->bottom - SourceRect->top))
712  /(DestRect->bottom-DestRect->top);
713  }
714  }
715 
716  EXLATEOBJ_vCleanup(&exloSrcRGB);
717 
718  return TRUE;
719 }
#define TRUE
Definition: types.h:120
struct NICEPIXEL32::@4072 col
#define BitsPerFormat(Format)
Definition: surface.h:109
long bottom
Definition: polytest.cpp:53
static __inline UCHAR Clamp5(ULONG val)
Definition: dib16bpp.c:570
#define AC_SRC_ALPHA
Definition: alphablend.c:9
int32_t INT
Definition: typedefs.h:56
BYTE BlendOp
Definition: wingdi.h:2737
XLATEOBJ xlo
Definition: xlateobj.h:21
long right
Definition: polytest.cpp:53
VOID NTAPI EXLATEOBJ_vInitialize(_Out_ PEXLATEOBJ pexlo, _In_opt_ PALETTE *ppalSrc, _In_opt_ PALETTE *ppalDst, _In_ COLORREF crSrcBackColor, _In_ COLORREF crDstBackColor, _In_ COLORREF crDstForeColor)
Definition: xlateobj.c:358
#define DIB_GetSource(SourceSurf, sx, sy, ColorTranslation)
Definition: dib.h:136
long top
Definition: polytest.cpp:53
void DPRINT(...)
Definition: polytest.cpp:61
GLint GLint bottom
Definition: glext.h:7726
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649
long left
Definition: polytest.cpp:53
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
BYTE SourceConstantAlpha
Definition: wingdi.h:2739
VOID DIB_16BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib16bpp.c:17
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
FLONG flFlags
Definition: palette.h:40
struct NICEPIXEL16_555::@4075 col
struct NICEPIXEL16_565::@4074 col
ULONG DIB_16BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
Definition: dib16bpp.c:26
static __inline UCHAR Clamp6(ULONG val)
Definition: dib16bpp.c:564
#define DPRINT1
Definition: precomp.h:8
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3149
PALETTE gpalRGB
Definition: palette.c:17
PPALETTE ppalSrc
Definition: xlateobj.h:25
BYTE AlphaFormat
Definition: wingdi.h:2740
BLENDFUNCTION BlendFunc
Definition: general.c:32
ULONG ul
Definition: alphablend.c:16
BLENDFUNCTION BlendFunction
Definition: winddi.h:224
PPALETTE ppalDst
Definition: xlateobj.h:26

◆ DIB_16BPP_BitBltSrcCopy()

BOOLEAN DIB_16BPP_BitBltSrcCopy ( PBLTINFO  BltInfo)

Definition at line 140 of file dib16bpp.c.

141 {
142  LONG i, j, sx, sy, xColor, f1;
143  PBYTE SourceBits, DestBits, SourceLine, DestLine;
144  PBYTE SourceBits_4BPP, SourceLine_4BPP;
145  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + 2 * BltInfo->DestRect.left;
146 
147  switch(BltInfo->SourceSurface->iBitmapFormat)
148  {
149  case BMF_1BPP:
150  sx = BltInfo->SourcePoint.x;
151  sy = BltInfo->SourcePoint.y;
152  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
153  {
154  sx = BltInfo->SourcePoint.x;
155  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
156  {
157  if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
158  {
159  DIB_16BPP_PutPixel(BltInfo->DestSurface, i, j,
160  XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
161  }
162  else
163  {
164  DIB_16BPP_PutPixel(BltInfo->DestSurface, i, j,
165  XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
166  }
167  sx++;
168  }
169  sy++;
170  }
171  break;
172 
173  case BMF_4BPP:
174  SourceBits_4BPP = (PBYTE)BltInfo->SourceSurface->pvScan0 +
175  (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) +
176  (BltInfo->SourcePoint.x >> 1);
177 
178  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
179  {
180  SourceLine_4BPP = SourceBits_4BPP;
181  sx = BltInfo->SourcePoint.x;
182  f1 = sx & 1;
183 
184  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
185  {
186  xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
187  (*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
188  DIB_16BPP_PutPixel(BltInfo->DestSurface, i, j, xColor);
189  if(f1 == 1)
190  {
191  SourceLine_4BPP++;
192  f1 = 0;
193  }
194  else
195  {
196  f1 = 1;
197  }
198  sx++;
199  }
200  SourceBits_4BPP += BltInfo->SourceSurface->lDelta;
201  }
202  break;
203 
204  case BMF_8BPP:
205  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
206  (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) +
207  BltInfo->SourcePoint.x;
208  DestLine = DestBits;
209 
210  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
211  {
212  SourceBits = SourceLine;
213  DestBits = DestLine;
214 
215  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
216  {
217  *((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(
218  BltInfo->XlateSourceToDest, *SourceBits);
219  SourceBits += 1;
220  DestBits += 2;
221  }
222 
223  SourceLine += BltInfo->SourceSurface->lDelta;
224  DestLine += BltInfo->DestSurface->lDelta;
225  }
226  break;
227 
228  case BMF_16BPP:
229  if (NULL == BltInfo->XlateSourceToDest || 0 !=
230  (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL))
231  {
232  if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
233  {
234  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 +
235  (BltInfo->SourcePoint.y *
236  BltInfo->SourceSurface->lDelta) + 2 *
237  BltInfo->SourcePoint.x;
238 
239  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
240  {
241  RtlMoveMemory(DestBits, SourceBits,
242  2 * (BltInfo->DestRect.right -
243  BltInfo->DestRect.left));
244 
245  SourceBits += BltInfo->SourceSurface->lDelta;
246  DestBits += BltInfo->DestSurface->lDelta;
247  }
248  }
249  else
250  {
251  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 +
252  ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom -
253  BltInfo->DestRect.top - 1) *
254  BltInfo->SourceSurface->lDelta) + 2 *
255  BltInfo->SourcePoint.x;
256 
257  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 +
258  ((BltInfo->DestRect.bottom - 1) *
259  BltInfo->DestSurface->lDelta) + 2 *
260  BltInfo->DestRect.left;
261 
262  for (j = BltInfo->DestRect.bottom - 1;
263  BltInfo->DestRect.top <= j; j--)
264  {
265  RtlMoveMemory(DestBits, SourceBits, 2 *
266  (BltInfo->DestRect.right -
267  BltInfo->DestRect.left));
268 
269  SourceBits -= BltInfo->SourceSurface->lDelta;
270  DestBits -= BltInfo->DestSurface->lDelta;
271  }
272  }
273  }
274  else
275  {
276  if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
277  {
278  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
279  (BltInfo->SourcePoint.y *
280  BltInfo->SourceSurface->lDelta) + 2 *
281  BltInfo->SourcePoint.x;
282 
283  DestLine = DestBits;
284  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
285  {
286  SourceBits = SourceLine;
287  DestBits = DestLine;
288  for (i = BltInfo->DestRect.left; i <
289  BltInfo->DestRect.right; i++)
290  {
291  *((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(
292  BltInfo->XlateSourceToDest,
293  *((WORD *)SourceBits));
294  SourceBits += 2;
295  DestBits += 2;
296  }
297  SourceLine += BltInfo->SourceSurface->lDelta;
298  DestLine += BltInfo->DestSurface->lDelta;
299  }
300  }
301  else
302  {
303  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
304  ((BltInfo->SourcePoint.y +
305  BltInfo->DestRect.bottom -
306  BltInfo->DestRect.top - 1) *
307  BltInfo->SourceSurface->lDelta) + 2 *
308  BltInfo->SourcePoint.x;
309 
310  DestLine = (PBYTE)BltInfo->DestSurface->pvScan0 +
311  ((BltInfo->DestRect.bottom - 1) *
312  BltInfo->DestSurface->lDelta) + 2 *
313  BltInfo->DestRect.left;
314 
315  for (j = BltInfo->DestRect.bottom - 1;
316  BltInfo->DestRect.top <= j; j--)
317  {
318  SourceBits = SourceLine;
319  DestBits = DestLine;
320  for (i = BltInfo->DestRect.left; i <
321  BltInfo->DestRect.right; i++)
322  {
323  *((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(
324  BltInfo->XlateSourceToDest,
325  *((WORD *)SourceBits));
326  SourceBits += 2;
327  DestBits += 2;
328  }
329  SourceLine -= BltInfo->SourceSurface->lDelta;
330  DestLine -= BltInfo->DestSurface->lDelta;
331  }
332  }
333  }
334  break;
335 
336  case BMF_24BPP:
337  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
338  (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) +
339  3 * BltInfo->SourcePoint.x;
340 
341  DestLine = DestBits;
342 
343  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
344  {
345  SourceBits = SourceLine;
346  DestBits = DestLine;
347 
348  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
349  {
350  xColor = (*(SourceBits + 2) << 0x10) +
351  (*(SourceBits + 1) << 0x08) + (*(SourceBits));
352 
353  *((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(
354  BltInfo->XlateSourceToDest, xColor);
355 
356  SourceBits += 3;
357  DestBits += 2;
358  }
359  SourceLine += BltInfo->SourceSurface->lDelta;
360  DestLine += BltInfo->DestSurface->lDelta;
361  }
362  break;
363 
364  case BMF_32BPP:
365  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
366  (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) +
367  4 * BltInfo->SourcePoint.x;
368 
369  DestLine = DestBits;
370 
371  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
372  {
373  SourceBits = SourceLine;
374  DestBits = DestLine;
375 
376  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
377  {
378  *((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(
379  BltInfo->XlateSourceToDest,
380  *((PDWORD) SourceBits));
381  SourceBits += 4;
382  DestBits += 2;
383  }
384 
385  SourceLine += BltInfo->SourceSurface->lDelta;
386  DestLine += BltInfo->DestSurface->lDelta;
387  }
388  break;
389 
390  default:
391  DPRINT1("DIB_16BPP_Bitblt: Unhandled Source BPP: %u\n",
393  return FALSE;
394  }
395 
396  return TRUE;
397 }
#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
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
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
RECTL DestRect
Definition: dib.h:26
SURFOBJ * DestSurface
Definition: dib.h:22
unsigned short WORD
Definition: ntddk_ex.h:93
VOID DIB_16BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib16bpp.c:17
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
#define DPRINT1
Definition: precomp.h:8
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_16BPP_ColorFill()

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

Definition at line 401 of file dib16bpp.c.

402 {
403  LONG DestY;
404 
405 #if defined(_M_IX86) && !defined(_MSC_VER)
406  /* This is about 10% faster than the generic C code below */
407  ULONG delta = DestSurface->lDelta;
408  ULONG width = (DestRect->right - DestRect->left) ;
409  PULONG pos = (PULONG) ((PBYTE)DestSurface->pvScan0 + DestRect->top * delta + (DestRect->left<<1));
410  color = (color&0xffff); /* If the color value is "abcd", put "abcdabcd" into color */
411  color += (color<<16);
412 
413  for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
414  {
415  __asm__ __volatile__ (
416  "cld\n\t"
417  "mov %1,%%ebx\n\t"
418  "mov %2,%%edi\n\t"
419  "test $0x03, %%edi\n\t" /* Align to fullword boundary */
420  "jz 1f\n\t"
421  "stosw\n\t"
422  "dec %%ebx\n\t"
423  "jz 2f\n"
424  "1:\n\t"
425  "mov %%ebx,%%ecx\n\t" /* Setup count of fullwords to fill */
426  "shr $1,%%ecx\n\t"
427  "rep stosl\n\t" /* The actual fill */
428  "test $0x01, %%ebx\n\t" /* One left to do at the right side? */
429  "jz 2f\n\t"
430  "stosw\n"
431  "2:"
432  :
433  : "a" (color), "r" (width), "m" (pos)
434  : "%ecx", "%ebx", "%edi");
435  pos =(PULONG)((ULONG_PTR)pos + delta);
436  }
437 #else /* _M_IX86 */
438 
439  for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
440  {
441  DIB_16BPP_HLine (DestSurface, DestRect->left, DestRect->right, DestY, color);
442  }
443 #endif
444  return TRUE;
445 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
LONG lDelta
Definition: winddi.h:1213
uint32_t ULONG_PTR
Definition: typedefs.h:63
VOID DIB_16BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
Definition: dib16bpp.c:34
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
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
BYTE * PBYTE
Definition: pedump.c:66
PVOID pvScan0
Definition: winddi.h:1212

◆ DIB_16BPP_GetPixel()

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

Definition at line 26 of file dib16bpp.c.

27 {
28  PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta;
29  PWORD addr = (PWORD)byteaddr + x;
30  return (ULONG)(*addr);
31 }
LONG lDelta
Definition: winddi.h:1213
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
WORD * PWORD
Definition: pedump.c:67
GLenum const GLvoid * addr
Definition: glext.h:9621
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
unsigned int ULONG
Definition: retypes.h:1
BYTE * PBYTE
Definition: pedump.c:66
PVOID pvScan0
Definition: winddi.h:1212

Referenced by DIB_16BPP_AlphaBlend(), and DIB_1BPP_BitBltSrcCopy().

◆ DIB_16BPP_HLine()

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

Definition at line 34 of file dib16bpp.c.

35 {
36  PDWORD addr = (PDWORD)((PWORD)((PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta) + x1);
37 
38 #if defined(_M_IX86) && !defined(_MSC_VER)
39  /* This is about 10% faster than the generic C code below */
40  LONG Count = x2 - x1;
41 
42  __asm__ __volatile__ (
43  " cld\n"
44  " mov %0, %%eax\n"
45  " shl $16, %%eax\n"
46  " andl $0xffff, %0\n" /* If the pixel value is "abcd", put "abcdabcd" in %eax */
47  " or %0, %%eax\n"
48  " mov %2, %%edi\n"
49  " test $0x03, %%edi\n" /* Align to fullword boundary */
50  " jz 0f\n"
51  " stosw\n"
52  " dec %1\n"
53  " jz 1f\n"
54  "0:\n"
55  " mov %1,%%ecx\n" /* Setup count of fullwords to fill */
56  " shr $1,%%ecx\n"
57  " rep stosl\n" /* The actual fill */
58  " test $0x01, %1\n" /* One left to do at the right side? */
59  " jz 1f\n"
60  " stosw\n"
61  "1:\n"
62  : /* no output */
63  : "r"(c), "r"(Count), "m"(addr)
64  : "%eax", "%ecx", "%edi");
65 #else /* _M_IX86 */
66  LONG cx = x1;
67  DWORD cc;
68 
69  if (0 != (cx & 0x01))
70  {
71  *((PWORD) addr) = (WORD)c;
72  cx++;
73  addr = (PDWORD)((PWORD)(addr) + 1);
74  }
75  cc = ((c & 0xffff) << 16) | (c & 0xffff);
76  while(cx + 1 < x2)
77  {
78  *addr++ = cc;
79  cx += 2;
80  }
81  if (cx < x2)
82  {
83  *((PWORD) addr) = (WORD)c;
84  }
85 #endif /* _M_IX86 */
86 }
LONG lDelta
Definition: winddi.h:1213
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
long LONG
Definition: pedump.c:60
__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")
WORD * PWORD
Definition: pedump.c:67
const GLubyte * c
Definition: glext.h:8905
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum const GLvoid * addr
Definition: glext.h:9621
uint32_t cc
Definition: isohybrid.c:75
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
DWORD * PDWORD
Definition: pedump.c:68
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
_Out_opt_ int * cx
Definition: commctrl.h:570
BYTE * PBYTE
Definition: pedump.c:66
PVOID pvScan0
Definition: winddi.h:1212

Referenced by DIB_16BPP_ColorFill().

◆ DIB_16BPP_PutPixel()

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

Definition at line 17 of file dib16bpp.c.

18 {
19  PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta;
20  PWORD addr = (PWORD)byteaddr + x;
21 
22  *addr = (WORD)c;
23 }
LONG lDelta
Definition: winddi.h:1213
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
WORD * PWORD
Definition: pedump.c:67
const GLubyte * c
Definition: glext.h:8905
unsigned short WORD
Definition: ntddk_ex.h:93
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_16BPP_AlphaBlend(), and DIB_16BPP_BitBltSrcCopy().

◆ DIB_16BPP_TransparentBlt()

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

Definition at line 448 of file dib16bpp.c.

451 {
452  LONG RoundedRight, X, Y, SourceX = 0, SourceY = 0, wd;
453  ULONG *DestBits, Source, Dest;
454 
455  LONG DstHeight;
456  LONG DstWidth;
457  LONG SrcHeight;
458  LONG SrcWidth;
459 
460  DstHeight = DestRect->bottom - DestRect->top;
461  DstWidth = DestRect->right - DestRect->left;
462  SrcHeight = SourceRect->bottom - SourceRect->top;
463  SrcWidth = SourceRect->right - SourceRect->left;
464 
465  RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x1);
466  DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 +
467  (DestRect->left << 1) +
468  DestRect->top * DestSurf->lDelta);
469  wd = DestSurf->lDelta - ((DestRect->right - DestRect->left) << 1);
470 
471  for(Y = DestRect->top; Y < DestRect->bottom; Y++)
472  {
473  SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
474  for(X = DestRect->left; X < RoundedRight; X += 2, DestBits++, SourceX += 2)
475  {
476  Dest = *DestBits;
477 
478  SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
479  if (SourceX >= 0 && SourceY >= 0 &&
480  SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
481  {
482  Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
483  if(Source != iTransColor)
484  {
485  Dest &= 0xFFFF0000;
486  Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFFFF);
487  }
488  }
489 
490  SourceX = SourceRect->left+(X+1 - DestRect->left) * SrcWidth / DstWidth;
491  if (SourceX >= 0 && SourceY >= 0 &&
492  SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
493  {
494  Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
495  if(Source != iTransColor)
496  {
497  Dest &= 0xFFFF;
498  Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) << 16);
499  }
500  }
501 
502  *DestBits = Dest;
503  }
504 
506  {
507  SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
508  if (SourceX >= 0 && SourceY >= 0 &&
509  SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
510  {
511  Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
512  if(Source != iTransColor)
513  {
514  *((USHORT*)DestBits) = (USHORT)XLATEOBJ_iXlate(ColorTranslation,
515  Source);
516  }
517  }
518 
519  DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
520  }
521 
522  DestBits = (ULONG*)((ULONG_PTR)DestBits + wd);
523  }
524 
525  return TRUE;
526 }
#define TRUE
Definition: types.h:120
SIZEL sizlBitmap
Definition: winddi.h:1209
LONG lDelta
Definition: winddi.h:1213
#define Y(I)
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
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 short USHORT
Definition: pedump.c:61
unsigned int * PULONG
Definition: retypes.h:1
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
#define X(b, s)
PVOID pvScan0
Definition: winddi.h:1212

◆ DIB_16BPP_VLine()

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

Definition at line 90 of file dib16bpp.c.

91 {
92 #if defined(_M_IX86) && !defined(_MSC_VER)
93  asm volatile(
94  " testl %2, %2" "\n\t"
95  " jle 2f" "\n\t"
96  " movl %2, %%ecx" "\n\t"
97  " shrl $2, %2" "\n\t"
98  " andl $3, %%ecx" "\n\t"
99  " jz 1f" "\n\t"
100  "0:" "\n\t"
101  " movw %%ax, (%0)" "\n\t"
102  " addl %1, %0" "\n\t"
103  " decl %%ecx" "\n\t"
104  " jnz 0b" "\n\t"
105  " testl %2, %2" "\n\t"
106  " jz 2f" "\n\t"
107  "1:" "\n\t"
108  " movw %%ax, (%0)" "\n\t"
109  " addl %1, %0" "\n\t"
110  " movw %%ax, (%0)" "\n\t"
111  " addl %1, %0" "\n\t"
112  " movw %%ax, (%0)" "\n\t"
113  " addl %1, %0" "\n\t"
114  " movw %%ax, (%0)" "\n\t"
115  " addl %1, %0" "\n\t"
116  " decl %2" "\n\t"
117  " jnz 1b" "\n\t"
118  "2:" "\n\t"
119  : /* no output */
120  : "r"((PBYTE)SurfObj->pvScan0 + (y1 * SurfObj->lDelta) + (x * sizeof (WORD))),
121  "r"(SurfObj->lDelta), "r"(y2 - y1), "a"(c)
122  : "cc", "memory", "%ecx");
123 #else
124  PBYTE byteaddr = (PBYTE)(ULONG_PTR)SurfObj->pvScan0 + y1 * SurfObj->lDelta;
125  PWORD addr = (PWORD)byteaddr + x;
126  LONG lDelta = SurfObj->lDelta;
127 
128  byteaddr = (PBYTE)addr;
129  while(y1++ < y2)
130  {
131  *addr = (WORD)c;
132 
133  byteaddr += lDelta;
134  addr = (PWORD)byteaddr;
135  }
136 #endif
137 }
_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
uint32_t ULONG_PTR
Definition: typedefs.h:63
long LONG
Definition: pedump.c:60
WORD * PWORD
Definition: pedump.c:67
const GLubyte * c
Definition: glext.h:8905
unsigned short WORD
Definition: ntddk_ex.h:93
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
BYTE * PBYTE
Definition: pedump.c:66
PVOID pvScan0
Definition: winddi.h:1212