ReactOS  0.4.15-dev-2103-g9dff498
dib.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _BLTINFO
 
struct  DIB_FUNCTIONS
 

Macros

#define ROP4_BLACKNESS   ((((0x00000042) >> 8) & 0xff00) | (((0x00000042) >> 16) & 0x00ff))
 
#define ROP4_NOTSRCERASE   ((((0x001100A6) >> 8) & 0xff00) | (((0x001100A6) >> 16) & 0x00ff))
 
#define ROP4_NOTSRCCOPY   ((((0x00330008) >> 8) & 0xff00) | (((0x00330008) >> 16) & 0x00ff))
 
#define ROP4_SRCERASE   ((((0x00440328) >> 8) & 0xff00) | (((0x00440328) >> 16) & 0x00ff))
 
#define ROP4_DSTINVERT   ((((0x00550009) >> 8) & 0xff00) | (((0x00550009) >> 16) & 0x00ff))
 
#define ROP4_PATINVERT   ((((0x005A0049) >> 8) & 0xff00) | (((0x005A0049) >> 16) & 0x00ff))
 
#define ROP4_SRCINVERT   ((((0x00660046) >> 8) & 0xff00) | (((0x00660046) >> 16) & 0x00ff))
 
#define ROP4_SRCAND   ((((0x008800C6) >> 8) & 0xff00) | (((0x008800C6) >> 16) & 0x00ff))
 
#define ROP4_MERGEPAINT   ((((0x00BB0226) >> 8) & 0xff00) | (((0x00BB0226) >> 16) & 0x00ff))
 
#define ROP4_MERGECOPY   ((((0x00C000CA) >> 8) & 0xff00) | (((0x00C000CA) >> 16) & 0x00ff))
 
#define ROP4_SRCCOPY   ((((0x00CC0020) >> 8) & 0xff00) | (((0x00CC0020) >> 16) & 0x00ff))
 
#define ROP4_SRCPAINT   ((((0x00EE0086) >> 8) & 0xff00) | (((0x00EE0086) >> 16) & 0x00ff))
 
#define ROP4_PATCOPY   ((((0x00F00021) >> 8) & 0xff00) | (((0x00F00021) >> 16) & 0x00ff))
 
#define ROP4_PATPAINT   ((((0x00FB0A09) >> 8) & 0xff00) | (((0x00FB0A09) >> 16) & 0x00ff))
 
#define ROP4_WHITENESS   ((((0x00FF0062) >> 8) & 0xff00) | (((0x00FF0062) >> 16) & 0x00ff))
 
#define MASK1BPP(x)   (1<<(7-((x)&7)))
 
#define DIB_GetSource(SourceSurf, sx, sy, ColorTranslation)
 
#define DIB_GetSourceIndex(SourceSurf, sx, sy)
 

Typedefs

typedef struct _BLTINFO BLTINFO
 
typedef struct _BLTINFOPBLTINFO
 
typedef VOID(* PFN_DIB_PutPixel) (SURFOBJ *, LONG, LONG, ULONG)
 
typedef ULONG(* PFN_DIB_GetPixel) (SURFOBJ *, LONG, LONG)
 
typedef VOID(* PFN_DIB_HLine) (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
typedef VOID(* PFN_DIB_VLine) (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
typedef BOOLEAN(* PFN_DIB_BitBlt) (PBLTINFO)
 
typedef BOOLEAN(* PFN_DIB_StretchBlt) (SURFOBJ *, SURFOBJ *, SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, POINTL *, BRUSHOBJ *, POINTL *, XLATEOBJ *, ROP4)
 
typedef BOOLEAN(* PFN_DIB_TransparentBlt) (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, XLATEOBJ *, ULONG)
 
typedef BOOLEAN(* PFN_DIB_ColorFill) (SURFOBJ *, RECTL *, ULONG)
 
typedef BOOLEAN(* PFN_DIB_AlphaBlend) (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, CLIPOBJ *, XLATEOBJ *, BLENDOBJ *)
 

Functions

VOID Dummy_PutPixel (SURFOBJ *, LONG, LONG, ULONG)
 
ULONG Dummy_GetPixel (SURFOBJ *, LONG, LONG)
 
VOID Dummy_HLine (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
VOID Dummy_VLine (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
BOOLEAN Dummy_BitBlt (PBLTINFO)
 
BOOLEAN Dummy_StretchBlt (SURFOBJ *, SURFOBJ *, SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, POINTL *, BRUSHOBJ *, POINTL *, XLATEOBJ *, ROP4)
 
BOOLEAN Dummy_TransparentBlt (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, XLATEOBJ *, ULONG)
 
BOOLEAN Dummy_ColorFill (SURFOBJ *, RECTL *, ULONG)
 
BOOLEAN Dummy_AlphaBlend (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, CLIPOBJ *, XLATEOBJ *, BLENDOBJ *)
 
VOID DIB_1BPP_PutPixel (SURFOBJ *, LONG, LONG, ULONG)
 
ULONG DIB_1BPP_GetPixel (SURFOBJ *, LONG, LONG)
 
VOID DIB_1BPP_HLine (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
VOID DIB_1BPP_VLine (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
BOOLEAN DIB_1BPP_BitBlt (PBLTINFO)
 
BOOLEAN DIB_1BPP_BitBltSrcCopy (PBLTINFO)
 
BOOLEAN DIB_1BPP_TransparentBlt (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, XLATEOBJ *, ULONG)
 
BOOLEAN DIB_1BPP_ColorFill (SURFOBJ *, RECTL *, ULONG)
 
VOID DIB_4BPP_PutPixel (SURFOBJ *, LONG, LONG, ULONG)
 
ULONG DIB_4BPP_GetPixel (SURFOBJ *, LONG, LONG)
 
VOID DIB_4BPP_HLine (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
VOID DIB_4BPP_VLine (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
BOOLEAN DIB_4BPP_BitBlt (PBLTINFO)
 
BOOLEAN DIB_4BPP_BitBltSrcCopy (PBLTINFO)
 
BOOLEAN DIB_4BPP_TransparentBlt (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, XLATEOBJ *, ULONG)
 
BOOLEAN DIB_4BPP_ColorFill (SURFOBJ *, RECTL *, ULONG)
 
VOID DIB_8BPP_PutPixel (SURFOBJ *, LONG, LONG, ULONG)
 
ULONG DIB_8BPP_GetPixel (SURFOBJ *, LONG, LONG)
 
VOID DIB_8BPP_HLine (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
VOID DIB_8BPP_VLine (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
BOOLEAN DIB_8BPP_BitBlt (PBLTINFO)
 
BOOLEAN DIB_8BPP_BitBltSrcCopy (PBLTINFO)
 
BOOLEAN DIB_8BPP_TransparentBlt (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, XLATEOBJ *, ULONG)
 
BOOLEAN DIB_8BPP_ColorFill (SURFOBJ *, RECTL *, ULONG)
 
VOID DIB_16BPP_PutPixel (SURFOBJ *, LONG, LONG, ULONG)
 
ULONG DIB_16BPP_GetPixel (SURFOBJ *, LONG, LONG)
 
VOID DIB_16BPP_HLine (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
VOID DIB_16BPP_VLine (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
BOOLEAN DIB_16BPP_BitBlt (PBLTINFO)
 
BOOLEAN DIB_16BPP_BitBltSrcCopy (PBLTINFO)
 
BOOLEAN DIB_16BPP_TransparentBlt (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, XLATEOBJ *, ULONG)
 
BOOLEAN DIB_16BPP_ColorFill (SURFOBJ *, RECTL *, ULONG)
 
BOOLEAN DIB_16BPP_AlphaBlend (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, CLIPOBJ *, XLATEOBJ *, BLENDOBJ *)
 
VOID DIB_24BPP_PutPixel (SURFOBJ *, LONG, LONG, ULONG)
 
ULONG DIB_24BPP_GetPixel (SURFOBJ *, LONG, LONG)
 
VOID DIB_24BPP_HLine (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
VOID DIB_24BPP_VLine (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
BOOLEAN DIB_24BPP_BitBlt (PBLTINFO)
 
BOOLEAN DIB_24BPP_BitBltSrcCopy (PBLTINFO)
 
BOOLEAN DIB_24BPP_TransparentBlt (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, XLATEOBJ *, ULONG)
 
BOOLEAN DIB_24BPP_ColorFill (SURFOBJ *, RECTL *, ULONG)
 
BOOLEAN DIB_24BPP_AlphaBlend (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, CLIPOBJ *, XLATEOBJ *, BLENDOBJ *)
 
VOID DIB_32BPP_PutPixel (SURFOBJ *, LONG, LONG, ULONG)
 
ULONG DIB_32BPP_GetPixel (SURFOBJ *, LONG, LONG)
 
VOID DIB_32BPP_HLine (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
VOID DIB_32BPP_VLine (SURFOBJ *, LONG, LONG, LONG, ULONG)
 
BOOLEAN DIB_32BPP_BitBlt (PBLTINFO)
 
BOOLEAN DIB_32BPP_BitBltSrcCopy (PBLTINFO)
 
BOOLEAN DIB_32BPP_TransparentBlt (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, XLATEOBJ *, ULONG)
 
BOOLEAN DIB_32BPP_ColorFill (SURFOBJ *, RECTL *, ULONG)
 
BOOLEAN DIB_32BPP_AlphaBlend (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, CLIPOBJ *, XLATEOBJ *, BLENDOBJ *)
 
BOOLEAN DIB_XXBPP_StretchBlt (SURFOBJ *, SURFOBJ *, SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, POINTL *, BRUSHOBJ *, POINTL *, XLATEOBJ *, ROP4)
 
BOOLEAN DIB_XXBPP_FloodFillSolid (SURFOBJ *, BRUSHOBJ *, RECTL *, POINTL *, ULONG, UINT)
 
BOOLEAN DIB_XXBPP_AlphaBlend (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, CLIPOBJ *, XLATEOBJ *, BLENDOBJ *)
 
ULONG DIB_DoRop (ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern)
 

Variables

DIB_FUNCTIONS DibFunctionsForBitmapFormat []
 
unsigned char notmask [2]
 
unsigned char altnotmask [2]
 

Macro Definition Documentation

◆ DIB_GetSource

#define DIB_GetSource (   SourceSurf,
  sx,
  sy,
  ColorTranslation 
)
Value:
XLATEOBJ_iXlate(ColorTranslation, \
DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat]. \
DIB_GetPixel(SourceSurf, sx, sy))
DIB_FUNCTIONS DibFunctionsForBitmapFormat[]
Definition: dib.c:20
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664

Definition at line 136 of file dib.h.

◆ DIB_GetSourceIndex

#define DIB_GetSourceIndex (   SourceSurf,
  sx,
  sy 
)
Value:
DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat]. \
DIB_GetPixel(SourceSurf, sx, sy)
DIB_FUNCTIONS DibFunctionsForBitmapFormat[]
Definition: dib.c:20

Definition at line 141 of file dib.h.

◆ MASK1BPP

#define MASK1BPP (   x)    (1<<(7-((x)&7)))

Definition at line 132 of file dib.h.

◆ ROP4_BLACKNESS

#define ROP4_BLACKNESS   ((((0x00000042) >> 8) & 0xff00) | (((0x00000042) >> 16) & 0x00ff))

Definition at line 3 of file dib.h.

◆ ROP4_DSTINVERT

#define ROP4_DSTINVERT   ((((0x00550009) >> 8) & 0xff00) | (((0x00550009) >> 16) & 0x00ff))

Definition at line 7 of file dib.h.

◆ ROP4_MERGECOPY

#define ROP4_MERGECOPY   ((((0x00C000CA) >> 8) & 0xff00) | (((0x00C000CA) >> 16) & 0x00ff))

Definition at line 12 of file dib.h.

◆ ROP4_MERGEPAINT

#define ROP4_MERGEPAINT   ((((0x00BB0226) >> 8) & 0xff00) | (((0x00BB0226) >> 16) & 0x00ff))

Definition at line 11 of file dib.h.

◆ ROP4_NOTSRCCOPY

#define ROP4_NOTSRCCOPY   ((((0x00330008) >> 8) & 0xff00) | (((0x00330008) >> 16) & 0x00ff))

Definition at line 5 of file dib.h.

◆ ROP4_NOTSRCERASE

#define ROP4_NOTSRCERASE   ((((0x001100A6) >> 8) & 0xff00) | (((0x001100A6) >> 16) & 0x00ff))

Definition at line 4 of file dib.h.

◆ ROP4_PATCOPY

#define ROP4_PATCOPY   ((((0x00F00021) >> 8) & 0xff00) | (((0x00F00021) >> 16) & 0x00ff))

Definition at line 15 of file dib.h.

◆ ROP4_PATINVERT

#define ROP4_PATINVERT   ((((0x005A0049) >> 8) & 0xff00) | (((0x005A0049) >> 16) & 0x00ff))

Definition at line 8 of file dib.h.

◆ ROP4_PATPAINT

#define ROP4_PATPAINT   ((((0x00FB0A09) >> 8) & 0xff00) | (((0x00FB0A09) >> 16) & 0x00ff))

Definition at line 16 of file dib.h.

◆ ROP4_SRCAND

#define ROP4_SRCAND   ((((0x008800C6) >> 8) & 0xff00) | (((0x008800C6) >> 16) & 0x00ff))

Definition at line 10 of file dib.h.

◆ ROP4_SRCCOPY

#define ROP4_SRCCOPY   ((((0x00CC0020) >> 8) & 0xff00) | (((0x00CC0020) >> 16) & 0x00ff))

Definition at line 13 of file dib.h.

◆ ROP4_SRCERASE

#define ROP4_SRCERASE   ((((0x00440328) >> 8) & 0xff00) | (((0x00440328) >> 16) & 0x00ff))

Definition at line 6 of file dib.h.

◆ ROP4_SRCINVERT

#define ROP4_SRCINVERT   ((((0x00660046) >> 8) & 0xff00) | (((0x00660046) >> 16) & 0x00ff))

Definition at line 9 of file dib.h.

◆ ROP4_SRCPAINT

#define ROP4_SRCPAINT   ((((0x00EE0086) >> 8) & 0xff00) | (((0x00EE0086) >> 16) & 0x00ff))

Definition at line 14 of file dib.h.

◆ ROP4_WHITENESS

#define ROP4_WHITENESS   ((((0x00FF0062) >> 8) & 0xff00) | (((0x00FF0062) >> 16) & 0x00ff))

Definition at line 17 of file dib.h.

Typedef Documentation

◆ BLTINFO

◆ PBLTINFO

◆ PFN_DIB_AlphaBlend

typedef BOOLEAN(* PFN_DIB_AlphaBlend) (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, CLIPOBJ *, XLATEOBJ *, BLENDOBJ *)

Definition at line 41 of file dib.h.

◆ PFN_DIB_BitBlt

typedef BOOLEAN(* PFN_DIB_BitBlt) (PBLTINFO)

Definition at line 37 of file dib.h.

◆ PFN_DIB_ColorFill

typedef BOOLEAN(* PFN_DIB_ColorFill) (SURFOBJ *, RECTL *, ULONG)

Definition at line 40 of file dib.h.

◆ PFN_DIB_GetPixel

typedef ULONG(* PFN_DIB_GetPixel) (SURFOBJ *, LONG, LONG)

Definition at line 34 of file dib.h.

◆ PFN_DIB_HLine

typedef VOID(* PFN_DIB_HLine) (SURFOBJ *, LONG, LONG, LONG, ULONG)

Definition at line 35 of file dib.h.

◆ PFN_DIB_PutPixel

typedef VOID(* PFN_DIB_PutPixel) (SURFOBJ *, LONG, LONG, ULONG)

Definition at line 33 of file dib.h.

◆ PFN_DIB_StretchBlt

typedef BOOLEAN(* PFN_DIB_StretchBlt) (SURFOBJ *, SURFOBJ *, SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, POINTL *, BRUSHOBJ *, POINTL *, XLATEOBJ *, ROP4)

Definition at line 38 of file dib.h.

◆ PFN_DIB_TransparentBlt

typedef BOOLEAN(* PFN_DIB_TransparentBlt) (SURFOBJ *, SURFOBJ *, RECTL *, RECTL *, XLATEOBJ *, ULONG)

Definition at line 39 of file dib.h.

◆ PFN_DIB_VLine

typedef VOID(* PFN_DIB_VLine) (SURFOBJ *, LONG, LONG, LONG, ULONG)

Definition at line 36 of file dib.h.

Function Documentation

◆ DIB_16BPP_AlphaBlend()

BOOLEAN DIB_16BPP_AlphaBlend ( SURFOBJ ,
SURFOBJ ,
RECTL ,
RECTL ,
CLIPOBJ ,
XLATEOBJ ,
BLENDOBJ  
)

Definition at line 851 of file dib16bpp.c.

854 {
855  INT DstX, DstY, SrcX, SrcY;
857  NICEPIXEL32 SrcPixel32;
858  UCHAR Alpha;
859  EXLATEOBJ* pexlo;
860  EXLATEOBJ exloSrcRGB;
861 
862  DPRINT("DIB_16BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
863  SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
864  DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
865 
866  BlendFunc = BlendObj->BlendFunction;
868  {
869  DPRINT1("BlendOp != AC_SRC_OVER\n");
870  return FALSE;
871  }
872  if (BlendFunc.BlendFlags != 0)
873  {
874  DPRINT1("BlendFlags != 0\n");
875  return FALSE;
876  }
877  if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0)
878  {
879  DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat);
880  return FALSE;
881  }
882  if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 &&
883  (BitsPerFormat(Source->iBitmapFormat) != 32))
884  {
885  DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n");
886  return FALSE;
887  }
888 
889  if (!ColorTranslation)
890  {
891  DPRINT1("ColorTranslation must not be NULL!\n");
892  return FALSE;
893  }
894 
895  pexlo = CONTAINING_RECORD(ColorTranslation, EXLATEOBJ, xlo);
896  EXLATEOBJ_vInitialize(&exloSrcRGB, pexlo->ppalSrc, &gpalRGB, 0, 0, 0);
897 
898  if (pexlo->ppalDst->flFlags & PAL_RGB16_555)
899  {
900  NICEPIXEL16_555 DstPixel16;
901 
902  SrcY = SourceRect->top;
903  DstY = DestRect->top;
904  while ( DstY < DestRect->bottom )
905  {
906  SrcX = SourceRect->left;
907  DstX = DestRect->left;
908  while(DstX < DestRect->right)
909  {
910  SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo);
911  SrcPixel32.col.red = (SrcPixel32.col.red * BlendFunc.SourceConstantAlpha) / 255;
912  SrcPixel32.col.green = (SrcPixel32.col.green * BlendFunc.SourceConstantAlpha) / 255;
913  SrcPixel32.col.blue = (SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha) / 255;
914 
915  Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
916  (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha) / 255 :
918 
919  Alpha >>= 3;
920 
921  DstPixel16.us = DIB_16BPP_GetPixel(Dest, DstX, DstY) & 0xFFFF;
922  /* Perform bit loss */
923  SrcPixel32.col.red >>= 3;
924  SrcPixel32.col.green >>= 3;
925  SrcPixel32.col.blue >>= 3;
926 
927  /* Do the blend in the right bit depth */
928  DstPixel16.col.red = Clamp5((DstPixel16.col.red * (31 - Alpha)) / 31 + SrcPixel32.col.red);
929  DstPixel16.col.green = Clamp5((DstPixel16.col.green * (31 - Alpha)) / 31 + SrcPixel32.col.green);
930  DstPixel16.col.blue = Clamp5((DstPixel16.col.blue * (31 - Alpha)) / 31 + SrcPixel32.col.blue);
931 
932  DIB_16BPP_PutPixel(Dest, DstX, DstY, DstPixel16.us);
933 
934  DstX++;
935  SrcX = SourceRect->left + ((DstX-DestRect->left)*(SourceRect->right - SourceRect->left))
936  /(DestRect->right-DestRect->left);
937  }
938  DstY++;
939  SrcY = SourceRect->top + ((DstY-DestRect->top)*(SourceRect->bottom - SourceRect->top))
940  /(DestRect->bottom-DestRect->top);
941  }
942  }
943  else
944  {
945  NICEPIXEL16_565 DstPixel16;
946  UCHAR Alpha6, Alpha5;
947 
948  SrcY = SourceRect->top;
949  DstY = DestRect->top;
950  while ( DstY < DestRect->bottom )
951  {
952  SrcX = SourceRect->left;
953  DstX = DestRect->left;
954  while(DstX < DestRect->right)
955  {
956  SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo);
957  SrcPixel32.col.red = (SrcPixel32.col.red * BlendFunc.SourceConstantAlpha) / 255;
958  SrcPixel32.col.green = (SrcPixel32.col.green * BlendFunc.SourceConstantAlpha) / 255;
959  SrcPixel32.col.blue = (SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha) / 255;
960 
961  Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
962  (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha) / 255 :
964 
965  Alpha6 = Alpha >> 2;
966  Alpha5 = Alpha >> 3;
967 
968  DstPixel16.us = DIB_16BPP_GetPixel(Dest, DstX, DstY) & 0xFFFF;
969  /* Perform bit loss */
970  SrcPixel32.col.red >>= 3;
971  SrcPixel32.col.green >>= 2;
972  SrcPixel32.col.blue >>= 3;
973 
974  /* Do the blend in the right bit depth */
975  DstPixel16.col.red = Clamp5((DstPixel16.col.red * (31 - Alpha5)) / 31 + SrcPixel32.col.red);
976  DstPixel16.col.green = Clamp6((DstPixel16.col.green * (63 - Alpha6)) / 63 + SrcPixel32.col.green);
977  DstPixel16.col.blue = Clamp5((DstPixel16.col.blue * (31 - Alpha5)) / 31 + SrcPixel32.col.blue);
978 
979  DIB_16BPP_PutPixel(Dest, DstX, DstY, DstPixel16.us);
980 
981  DstX++;
982  SrcX = SourceRect->left + ((DstX-DestRect->left)*(SourceRect->right - SourceRect->left))
983  /(DestRect->right-DestRect->left);
984  }
985  DstY++;
986  SrcY = SourceRect->top + ((DstY-DestRect->top)*(SourceRect->bottom - SourceRect->top))
987  /(DestRect->bottom-DestRect->top);
988  }
989  }
990 
991  EXLATEOBJ_vCleanup(&exloSrcRGB);
992 
993  return TRUE;
994 }
struct NICEPIXEL32::@4862 col
#define TRUE
Definition: types.h:120
#define BitsPerFormat(Format)
Definition: surface.h:109
static __inline UCHAR Clamp5(ULONG val)
Definition: dib16bpp.c:845
#define AC_SRC_ALPHA
Definition: alphablend.c:9
int32_t INT
Definition: typedefs.h:58
BYTE BlendOp
Definition: wingdi.h:2758
XLATEOBJ xlo
Definition: xlateobj.h:21
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
#define FALSE
Definition: types.h:117
GLint GLint bottom
Definition: glext.h:7726
static const BLENDFUNCTION BlendFunc
Definition: general.c:32
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649
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:2760
VOID DIB_16BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib16bpp.c:21
GLdouble GLdouble right
Definition: glext.h:10859
struct NICEPIXEL16_555::@4865 col
struct NICEPIXEL16_565::@4864 col
unsigned char UCHAR
Definition: xmlstorage.h:181
BYTE BlendFlags
Definition: wingdi.h:2759
#define AC_SRC_OVER
Definition: wingdi.h:1368
FLONG flFlags
Definition: palette.h:40
ULONG DIB_16BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
Definition: dib16bpp.c:30
static __inline UCHAR Clamp6(ULONG val)
Definition: dib16bpp.c:839
#define DPRINT1
Definition: precomp.h:8
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
PALETTE gpalRGB
Definition: palette.c:20
#define DPRINT
Definition: sndvol32.h:71
PPALETTE ppalSrc
Definition: xlateobj.h:25
BYTE AlphaFormat
Definition: wingdi.h:2761
ULONG ul
Definition: alphablend.c:16
PPALETTE ppalDst
Definition: xlateobj.h:26

◆ DIB_16BPP_BitBlt()

BOOLEAN DIB_16BPP_BitBlt ( PBLTINFO  )

◆ DIB_16BPP_BitBltSrcCopy()

BOOLEAN DIB_16BPP_BitBltSrcCopy ( PBLTINFO  )

Definition at line 144 of file dib16bpp.c.

145 {
146  LONG i, j, sx, sy, xColor, f1;
147  PBYTE SourceBits, DestBits, SourceLine, DestLine;
148  PBYTE SourceBits_4BPP, SourceLine_4BPP;
149  PWORD Source32, Dest32;
150  DWORD Index, StartLeft, EndRight;
151  BOOLEAN bTopToBottom, bLeftToRight;
152 
153  DPRINT("DIB_16BPP_BitBltSrcCopy: SrcSurf cx/cy (%d/%d), DestSuft cx/cy (%d/%d) dstRect: (%d,%d)-(%d,%d)\n",
154  BltInfo->SourceSurface->sizlBitmap.cx, BltInfo->SourceSurface->sizlBitmap.cy,
155  BltInfo->DestSurface->sizlBitmap.cx, BltInfo->DestSurface->sizlBitmap.cy,
156  BltInfo->DestRect.left, BltInfo->DestRect.top, BltInfo->DestRect.right, BltInfo->DestRect.bottom);
157 
158  /* Get back left to right flip here */
159  bLeftToRight = BltInfo->DestRect.left > BltInfo->DestRect.right;
160 
161  /* Check for top to bottom flip needed. */
162  bTopToBottom = BltInfo->DestRect.top > BltInfo->DestRect.bottom;
163 
164  DPRINT("BltInfo->SourcePoint.x is '%d' & BltInfo->SourcePoint.y is '%d'.\n",
165  BltInfo->SourcePoint.x, BltInfo->SourcePoint.y);
166 
167  /* Make WellOrdered with top < bottom and left < right */
168  RECTL_vMakeWellOrdered(&BltInfo->DestRect);
169 
170  DPRINT("BPP is '%d/%d' & BltInfo->SourcePoint.x is '%d' & BltInfo->SourcePoint.y is '%d'.\n",
171  BltInfo->SourceSurface->iBitmapFormat, BltInfo->SourcePoint.x, BltInfo->SourcePoint.y);
172 
173  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + 2 * BltInfo->DestRect.left;
174 
175  switch(BltInfo->SourceSurface->iBitmapFormat)
176  {
177  case BMF_1BPP:
178  DPRINT("1BPP Case Selected with DestRect Width of '%d'.\n",
179  BltInfo->DestRect.right - BltInfo->DestRect.left);
180  sx = BltInfo->SourcePoint.x;
181 
182  /* This sets sy to the top line */
183  sy = BltInfo->SourcePoint.y;
184 
185  if (bTopToBottom)
186  {
187  /* This sets sy to the bottom line */
188  sy += BltInfo->SourceSurface->lDelta * (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1);
189  }
190 
191  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
192  {
193  sx = BltInfo->SourcePoint.x;
194 
195  if (bLeftToRight)
196  {
197  /* This sets the sx to the rightmost pixel */
198  sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
199  StartLeft = BltInfo->DestRect.left + 1;
200  EndRight = BltInfo->DestRect.right + 1;
201  }
202  else
203  {
204  StartLeft = BltInfo->DestRect.left;
205  EndRight = BltInfo->DestRect.right;
206  }
207 
208  for (i = StartLeft; i < EndRight; i++)
209  {
210  if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
211  {
212  DIB_16BPP_PutPixel(BltInfo->DestSurface, i, j,
213  XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
214  }
215  else
216  {
217  DIB_16BPP_PutPixel(BltInfo->DestSurface, i, j,
218  XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
219  }
220  DEC_OR_INC(sx, bLeftToRight, 1);
221  }
222  DEC_OR_INC(sy, bTopToBottom, 1);
223  }
224  break;
225 
226  case BMF_4BPP:
227  DPRINT("4BPP Case Selected with DestRect Width of '%d'.\n",
228  BltInfo->DestRect.right - BltInfo->DestRect.left);
229 
230  /* This sets SourceBits_4BPP to the top line */
231  SourceBits_4BPP = (PBYTE)BltInfo->SourceSurface->pvScan0 +
232  (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) +
233  (BltInfo->SourcePoint.x >> 1);
234 
235  if (bTopToBottom)
236  {
237  /* This sets SourceBits_4BPP to the bottom line */
238  SourceBits_4BPP += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;
239  }
240 
241  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
242  {
243  SourceLine_4BPP = SourceBits_4BPP;
244  sx = BltInfo->SourcePoint.x;
245  if (bLeftToRight)
246  {
247  /* This sets sx to the rightmost pixel */
248  sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
249  }
250 
251  f1 = sx & 1;
252 
253  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
254  {
255  xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
256  (*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
257  DIB_16BPP_PutPixel(BltInfo->DestSurface, i, j, xColor);
258  if(f1 == 1)
259  {
260  DEC_OR_INC(SourceLine_4BPP, bLeftToRight, 1);
261  f1 = 0;
262  }
263  else
264  {
265  f1 = 1;
266  }
267  DEC_OR_INC(sx, bLeftToRight, 1);
268  }
269  DEC_OR_INC(SourceBits_4BPP, bTopToBottom, BltInfo->SourceSurface->lDelta);
270  }
271  break;
272 
273  case BMF_8BPP:
274  DPRINT("8BPP Case Selected with DestRect Width of '%d'.\n",
275  BltInfo->DestRect.right - BltInfo->DestRect.left);
276 
277  /* This sets SourceLine to the top line */
278  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
279  (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) +
280  BltInfo->SourcePoint.x;
281  DestLine = DestBits;
282 
283  if (bTopToBottom)
284  {
285  /* This sets SourceLine to the bottom line */
286  SourceLine += BltInfo->SourceSurface->lDelta
287  * (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1);
288  }
289 
290  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
291  {
292  SourceBits = SourceLine;
293  DestBits = DestLine;
294 
295  if (bLeftToRight)
296  {
297  /* This sets SourceBits to the rightmost pixel */
298  SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
299  }
300 
301  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
302  {
303  *((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(
304  BltInfo->XlateSourceToDest, *SourceBits);
305  DEC_OR_INC(SourceBits, bLeftToRight, 1);
306  DestBits += 2;
307  }
308  DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
309  DestLine += BltInfo->DestSurface->lDelta;
310  }
311  break;
312 
313  case BMF_16BPP:
314  DPRINT("16BPP Case Selected with DestRect Width of '%d'.\n",
315  BltInfo->DestRect.right - BltInfo->DestRect.left);
316 
317  DPRINT("BMF_16BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
318  BltInfo->DestRect.left, BltInfo->DestRect.top,
319  BltInfo->DestRect.right, BltInfo->DestRect.bottom,
320  BltInfo->DestRect.right - BltInfo->DestRect.left);
321 
322  if ((BltInfo->XlateSourceToDest == NULL ||
323  (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL) != 0) &&
324  (!bTopToBottom && !bLeftToRight))
325  {
326  DPRINT("XO_TRIVIAL is TRUE.\n");
327  if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
328  {
329  /* This sets SourceBits to the top line */
330  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 +
331  (BltInfo->SourcePoint.y *
332  BltInfo->SourceSurface->lDelta) + 2 *
333  BltInfo->SourcePoint.x;
334 
335  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
336  {
337  RtlMoveMemory(DestBits, SourceBits,
338  2 * (BltInfo->DestRect.right -
339  BltInfo->DestRect.left));
340 
341  SourceBits += BltInfo->SourceSurface->lDelta;
342  DestBits += BltInfo->DestSurface->lDelta;
343  }
344  }
345  else
346  {
347  /* This sets SourceBits to the bottom line */
348  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 +
349  ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom -
350  BltInfo->DestRect.top - 1) *
351  BltInfo->SourceSurface->lDelta) + 2 *
352  BltInfo->SourcePoint.x;
353 
354  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 +
355  ((BltInfo->DestRect.bottom - 1) *
356  BltInfo->DestSurface->lDelta) + 2 *
357  BltInfo->DestRect.left;
358 
359  for (j = BltInfo->DestRect.bottom - 1;
360  BltInfo->DestRect.top <= j; j--)
361  {
362  RtlMoveMemory(DestBits, SourceBits, 2 *
363  (BltInfo->DestRect.right -
364  BltInfo->DestRect.left));
365 
366  SourceBits -= BltInfo->SourceSurface->lDelta;
367  DestBits -= BltInfo->DestSurface->lDelta;
368  }
369  }
370  }
371  else
372  {
373  DPRINT("XO_TRIVIAL is NOT TRUE.\n");
374  if (!bTopToBottom && !bLeftToRight)
375  /* **Note: Indent is purposefully less than desired to keep reviewable differences to a minimum for PR** */
376  {
377  DPRINT("Flip is None.\n");
378  if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
379  {
380  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
381  (BltInfo->SourcePoint.y *
382  BltInfo->SourceSurface->lDelta) + 2 *
383  BltInfo->SourcePoint.x;
384 
385  DestLine = DestBits;
386  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
387  {
388  SourceBits = SourceLine;
389  DestBits = DestLine;
390  for (i = BltInfo->DestRect.left; i <
391  BltInfo->DestRect.right; i++)
392  {
393  *((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(
394  BltInfo->XlateSourceToDest,
395  *((WORD *)SourceBits));
396  SourceBits += 2;
397  DestBits += 2;
398  }
399  SourceLine += BltInfo->SourceSurface->lDelta;
400  DestLine += BltInfo->DestSurface->lDelta;
401  }
402  }
403  else
404  {
405  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
406  ((BltInfo->SourcePoint.y +
407  BltInfo->DestRect.bottom -
408  BltInfo->DestRect.top - 1) *
409  BltInfo->SourceSurface->lDelta) + 2 *
410  BltInfo->SourcePoint.x;
411 
412  DestLine = (PBYTE)BltInfo->DestSurface->pvScan0 +
413  ((BltInfo->DestRect.bottom - 1) *
414  BltInfo->DestSurface->lDelta) + 2 *
415  BltInfo->DestRect.left;
416 
417  for (j = BltInfo->DestRect.bottom - 1;
418  BltInfo->DestRect.top <= j; j--)
419  {
420  SourceBits = SourceLine;
421  DestBits = DestLine;
422  for (i = BltInfo->DestRect.left; i <
423  BltInfo->DestRect.right; i++)
424  {
425  *((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(
426  BltInfo->XlateSourceToDest,
427  *((WORD *)SourceBits));
428  SourceBits += 2;
429  DestBits += 2;
430  }
431  SourceLine -= BltInfo->SourceSurface->lDelta;
432  DestLine -= BltInfo->DestSurface->lDelta;
433  }
434  }
435  }
436  else
437  {
438  /* Buffering for source and destination flip overlaps. Fixes KHMZ MirrorTest CORE-16642 */
439  BOOL TopToBottomDone = FALSE;
440 
441  if (bLeftToRight)
442  {
443  DPRINT("Flip is bLeftToRight.\n");
444 
445  /* Allocate enough pixels for a row in WORD's */
447  (BltInfo->DestRect.right - BltInfo->DestRect.left + 1) * 2, TAG_DIB);
448  if (store == NULL)
449  {
450  DPRINT1("Storage Allocation Failed.\n");
451  return FALSE;
452  }
453  WORD Index;
454 
455  /* This sets SourceBits to the bottom line */
456  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
457  + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1)
458  * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x;
459 
460  /* Sets DestBits to the bottom line */
461  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
462  + (BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta
463  + 2 * BltInfo->DestRect.left + 2;
464 
465  for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
466  {
467  /* Set Dest32 to right pixel */
468  Dest32 = (WORD *) DestBits + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
469  Source32 = (WORD *) SourceBits;
470 
471  Index = 0;
472 
473  /* Store pixels from left to right */
474  for (i = BltInfo->DestRect.right - 1; BltInfo->DestRect.left <= i; i--)
475  {
476  store[Index] = (WORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *(WORD *)Source32++);
477  Index++;
478  }
479 
480  Index = 0;
481 
482  /* Copy stored data to pixels from right to left */
483  for (i = BltInfo->DestRect.right - 1; BltInfo->DestRect.left <= i; i--)
484  {
485  *(WORD *)Dest32-- = store[Index];
486  Index++;
487  }
488 
489  SourceBits -= BltInfo->SourceSurface->lDelta;
490  DestBits -= BltInfo->DestSurface->lDelta;
491  }
492  ExFreePoolWithTag(store, TAG_DIB);
493  TopToBottomDone = TRUE;
494  }
495 
496  if (bTopToBottom)
497  {
498  DPRINT("Flip is bTopToBottom.\n");
499 
500  /* Allocate enough pixels for a column in WORD's */
502  (BltInfo->DestRect.bottom - BltInfo->DestRect.top + 1) * 2, TAG_DIB);
503  if (store == NULL)
504  {
505  DPRINT1("Storage Allocation Failed.\n");
506  return FALSE;
507  }
508 
509  /* This set SourceBits to the top line */
510  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
511  + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
512  + 2 * BltInfo->SourcePoint.x;
513 
514  /* This sets DestBits to the top line */
515  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
516  + ((BltInfo->DestRect.top) * BltInfo->DestSurface->lDelta)
517  + 2 * BltInfo->DestRect.left;
518 
519  if ((BltInfo->SourceSurface->fjBitmap & BMF_TOPDOWN) == 0)
520  {
521  DestBits += BltInfo->DestSurface->lDelta;
522  }
523 
524  if (bLeftToRight)
525  {
526  DPRINT("Adjusting DestBits for bLeftToRight.\n");
527  DestBits += 2;
528  }
529 
530  /* The TopToBottomDone flag indicates that we are flipping for bTopToBottom and bLeftToRight
531  * and have already completed the bLeftToRight. So we will lose our first flip output
532  * unless we work with its output which is at the destination site. So in this case
533  * our new Source becomes the previous outputs Destination. */
534 
535  if (TopToBottomDone)
536  {
537  /* This sets SourceBits to the top line */
538  SourceBits = DestBits;
539  }
540 
541  for (j = BltInfo->DestRect.right - 1; BltInfo->DestRect.left <= j ; j--)
542  {
543  /* Set Dest32 to bottom pixel */
544  Dest32 = (WORD *) DestBits + (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1)
545  * BltInfo->DestSurface->lDelta / 2;
546  Source32 = (WORD *) SourceBits;
547 
548  Index = 0;
549 
550  /* Store pixels from top to bottom */
551  for (i = BltInfo->DestRect.top; i <= BltInfo->DestRect.bottom - 1; i++)
552  {
553  store[Index] = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32);
554  Source32 += BltInfo->SourceSurface->lDelta / 2;
555  Index++;
556  }
557 
558  Index = 0;
559 
560  /* Copy stored data to pixels from bottom to top */
561  for (i = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= i; i--)
562  {
563  *Dest32 = store[Index];
564  Dest32 -= BltInfo->DestSurface->lDelta / 2;
565  Index++;
566  }
567  SourceBits += 2;
568  DestBits += 2;
569  }
570  ExFreePoolWithTag(store, TAG_DIB);
571  }
572 
573  }
574  }
575  break;
576 
577  case BMF_24BPP:
578 
579  DPRINT("BMF_24BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
580  BltInfo->DestRect.left, BltInfo->DestRect.top,
581  BltInfo->DestRect.right, BltInfo->DestRect.bottom,
582  BltInfo->DestRect.right - BltInfo->DestRect.left);
583 
584  /* This sets SourceLine to the top line */
585  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
586  (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) +
587  3 * BltInfo->SourcePoint.x;
588 
589  if (bTopToBottom)
590  {
591  /* This sets SourceLine to the bottom line */
592  SourceLine += BltInfo->SourceSurface->lDelta * (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1);
593  }
594  DestLine = DestBits;
595 
596  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
597  {
598  SourceBits = SourceLine;
599  DestBits = DestLine;
600 
601  if (bLeftToRight)
602  {
603  /* This sets the SourceBits to the rightmost pixel */
604  SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1) * 3;
605  }
606  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
607  {
608  xColor = (*(SourceBits + 2) << 0x10) +
609  (*(SourceBits + 1) << 0x08) + (*(SourceBits));
610 
611  *((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(
612  BltInfo->XlateSourceToDest, xColor);
613 
614  DEC_OR_INC(SourceBits, bLeftToRight, 3);
615  DestBits += 2;
616  }
617  DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
618  DestLine += BltInfo->DestSurface->lDelta;
619  }
620  break;
621 
622  case BMF_32BPP:
623  DPRINT("32BPP Case Selected with DestRect Width of '%d'.\n",
624  BltInfo->DestRect.right - BltInfo->DestRect.left);
625 
626  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
627  (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) +
628  4 * BltInfo->SourcePoint.x;
629 
630  if (bTopToBottom)
631  {
632  /* This sets SourceLine to the bottom line */
633  SourceLine += BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1;
634  }
635  DestLine = DestBits;
636 
637  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
638  {
639  SourceBits = SourceLine;
640  DestBits = DestLine;
641 
642  if (bLeftToRight)
643  {
644  /* This sets SourceBits to the rightmost pixel */
645  SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1) * 4;
646  }
647 
648  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
649  {
650  *((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(
651  BltInfo->XlateSourceToDest,
652  *((PDWORD) SourceBits));
653  DEC_OR_INC(SourceBits, bLeftToRight, 4);
654  DestBits += 2;
655  }
656 
657  DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
658  DestLine += BltInfo->DestSurface->lDelta;
659  }
660  break;
661 
662  default:
663  DPRINT1("DIB_16BPP_BitBltSrcCopy: Unhandled Source BPP: %u\n",
664  BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
665  return FALSE;
666  }
667 
668  return TRUE;
669 }
#define BMF_24BPP
Definition: winddi.h:359
#define BMF_32BPP
Definition: winddi.h:360
#define DEC_OR_INC(var, decTrue, amount)
Definition: dib16bpp.c:17
#define TRUE
Definition: types.h:120
unsigned char altnotmask[2]
Definition: dib.c:18
#define BitsPerFormat(Format)
Definition: surface.h:109
#define BMF_TOPDOWN
Definition: winddi.h:1180
Definition: xlate.c:10
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
unsigned char BOOLEAN
#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
WORD * PWORD
Definition: pedump.c:67
if(!(yy_init))
Definition: macro.lex.yy.c:714
_In_ WDFCOLLECTION _In_ ULONG Index
unsigned short WORD
Definition: ntddk_ex.h:93
#define for
Definition: utility.h:88
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID DIB_16BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib16bpp.c:21
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
ULONG DIB_1BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib1bpp.c:30
#define XO_TRIVIAL
Definition: winddi.h:1247
#define f1(x, y, z)
Definition: sha1.c:30
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
Definition: xlate.c:8
#define NULL
Definition: types.h:112
DWORD * PDWORD
Definition: pedump.c:68
#define DPRINT1
Definition: precomp.h:8
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define DPRINT
Definition: sndvol32.h:71
BYTE * PBYTE
Definition: pedump.c:66
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
Definition: xlate.c:9
#define TAG_DIB
Definition: tags.h:17

◆ DIB_16BPP_ColorFill()

BOOLEAN DIB_16BPP_ColorFill ( SURFOBJ ,
RECTL ,
ULONG   
)

Definition at line 673 of file dib16bpp.c.

674 {
675  LONG DestY;
676 
677  /* Make WellOrdered with top < bottom and left < right */
678  RECTL_vMakeWellOrdered(DestRect);
679 
680 #if defined(_M_IX86) && !defined(_MSC_VER)
681  /* This is about 10% faster than the generic C code below */
682  ULONG delta = DestSurface->lDelta;
683  ULONG width = (DestRect->right - DestRect->left) ;
684  PULONG pos = (PULONG) ((PBYTE)DestSurface->pvScan0 + DestRect->top * delta + (DestRect->left<<1));
685  color = (color&0xffff); /* If the color value is "abcd", put "abcdabcd" into color */
686  color += (color<<16);
687 
688  for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
689  {
690  __asm__ __volatile__ (
691  "cld\n\t"
692  "mov %1,%%ebx\n\t"
693  "mov %2,%%edi\n\t"
694  "test $0x03, %%edi\n\t" /* Align to fullword boundary */
695  "jz 1f\n\t"
696  "stosw\n\t"
697  "dec %%ebx\n\t"
698  "jz 2f\n"
699  "1:\n\t"
700  "mov %%ebx,%%ecx\n\t" /* Setup count of fullwords to fill */
701  "shr $1,%%ecx\n\t"
702  "rep stosl\n\t" /* The actual fill */
703  "test $0x01, %%ebx\n\t" /* One left to do at the right side? */
704  "jz 2f\n\t"
705  "stosw\n"
706  "2:"
707  :
708  : "a" (color), "r" (width), "m" (pos)
709  : "%ecx", "%ebx", "%edi");
710  pos =(PULONG)((ULONG_PTR)pos + delta);
711  }
712 #else /* _M_IX86 */
713 
714  for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
715  {
716  DIB_16BPP_HLine (DestSurface, DestRect->left, DestRect->right, DestY, color);
717  }
718 #endif
719  return TRUE;
720 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
uint32_t ULONG_PTR
Definition: typedefs.h:65
VOID DIB_16BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
Definition: dib16bpp.c:38
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")
GLint GLint bottom
Definition: glext.h:7726
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
BYTE * PBYTE
Definition: pedump.c:66
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81

◆ DIB_16BPP_GetPixel()

ULONG DIB_16BPP_GetPixel ( SURFOBJ ,
LONG  ,
LONG   
)

Definition at line 30 of file dib16bpp.c.

31 {
32  PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta;
33  PWORD addr = (PWORD)byteaddr + x;
34  return (ULONG)(*addr);
35 }
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

Referenced by DIB_16BPP_AlphaBlend(), and DIB_1BPP_BitBltSrcCopy().

◆ DIB_16BPP_HLine()

VOID DIB_16BPP_HLine ( SURFOBJ ,
LONG  ,
LONG  ,
LONG  ,
ULONG   
)

Definition at line 38 of file dib16bpp.c.

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

Referenced by DIB_16BPP_ColorFill().

◆ DIB_16BPP_PutPixel()

VOID DIB_16BPP_PutPixel ( SURFOBJ ,
LONG  ,
LONG  ,
ULONG   
)

Definition at line 21 of file dib16bpp.c.

22 {
23  PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta;
24  PWORD addr = (PWORD)byteaddr + x;
25 
26  *addr = (WORD)c;
27 }
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

Referenced by DIB_16BPP_AlphaBlend(), and DIB_16BPP_BitBltSrcCopy().

◆ DIB_16BPP_TransparentBlt()

BOOLEAN DIB_16BPP_TransparentBlt ( SURFOBJ ,
SURFOBJ ,
RECTL ,
RECTL ,
XLATEOBJ ,
ULONG   
)

Definition at line 723 of file dib16bpp.c.

726 {
727  LONG RoundedRight, X, Y, SourceX = 0, SourceY = 0, wd;
728  ULONG *DestBits, Source, Dest;
729 
730  LONG DstHeight;
731  LONG DstWidth;
732  LONG SrcHeight;
733  LONG SrcWidth;
734 
735  DstHeight = DestRect->bottom - DestRect->top;
736  DstWidth = DestRect->right - DestRect->left;
737  SrcHeight = SourceRect->bottom - SourceRect->top;
738  SrcWidth = SourceRect->right - SourceRect->left;
739 
740  RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x1);
741  DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 +
742  (DestRect->left << 1) +
743  DestRect->top * DestSurf->lDelta);
744  wd = DestSurf->lDelta - ((DestRect->right - DestRect->left) << 1);
745 
746  for(Y = DestRect->top; Y < DestRect->bottom; Y++)
747  {
748  SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
749  for(X = DestRect->left; X < RoundedRight; X += 2, DestBits++, SourceX += 2)
750  {
751  Dest = *DestBits;
752 
753  SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
754  if (SourceX >= 0 && SourceY >= 0 &&
755  SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
756  {
757  Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
758  if(Source != iTransColor)
759  {
760  Dest &= 0xFFFF0000;
761  Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFFFF);
762  }
763  }
764 
765  SourceX = SourceRect->left+(X+1 - DestRect->left) * SrcWidth / DstWidth;
766  if (SourceX >= 0 && SourceY >= 0 &&
767  SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
768  {
769  Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
770  if(Source != iTransColor)
771  {
772  Dest &= 0xFFFF;
773  Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) << 16);
774  }
775  }
776 
777  *DestBits = Dest;
778  }
779 
781  {
782  SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
783  if (SourceX >= 0 && SourceY >= 0 &&
784  SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
785  {
786  Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
787  if(Source != iTransColor)
788  {
789  *((USHORT*)DestBits) = (USHORT)XLATEOBJ_iXlate(ColorTranslation,
790  Source);
791  }
792  }
793 
794  DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
795  }
796 
797  DestBits = (ULONG*)((ULONG_PTR)DestBits + wd);
798  }
799 
800  return TRUE;
801 }
#define Y(I)
#define TRUE
Definition: types.h:120
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
_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:65
long LONG
Definition: pedump.c:60
#define DIB_GetSourceIndex(SourceSurf, sx, sy)
Definition: dib.h:141
GLint GLint bottom
Definition: glext.h:7726
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:3167
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
BYTE * PBYTE
Definition: pedump.c:66
#define X(b, s)

◆ DIB_16BPP_VLine()

VOID DIB_16BPP_VLine ( SURFOBJ ,
LONG  ,
LONG  ,
LONG  ,
ULONG   
)

Definition at line 94 of file dib16bpp.c.

95 {
96 #if defined(_M_IX86) && !defined(_MSC_VER)
97  asm volatile(
98  " testl %2, %2" "\n\t"
99  " jle 2f" "\n\t"
100  " movl %2, %%ecx" "\n\t"
101  " shrl $2, %2" "\n\t"
102  " andl $3, %%ecx" "\n\t"
103  " jz 1f" "\n\t"
104  "0:" "\n\t"
105  " movw %%ax, (%0)" "\n\t"
106  " addl %1, %0" "\n\t"
107  " decl %%ecx" "\n\t"
108  " jnz 0b" "\n\t"
109  " testl %2, %2" "\n\t"
110  " jz 2f" "\n\t"
111  "1:" "\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  " movw %%ax, (%0)" "\n\t"
117  " addl %1, %0" "\n\t"
118  " movw %%ax, (%0)" "\n\t"
119  " addl %1, %0" "\n\t"
120  " decl %2" "\n\t"
121  " jnz 1b" "\n\t"
122  "2:" "\n\t"
123  : /* no output */
124  : "r"((PBYTE)SurfObj->pvScan0 + (y1 * SurfObj->lDelta) + (x * sizeof (WORD))),
125  "r"(SurfObj->lDelta), "r"(y2 - y1), "a"(c)
126  : "cc", "memory", "%ecx");
127 #else
128  PBYTE byteaddr = (PBYTE)(ULONG_PTR)SurfObj->pvScan0 + y1 * SurfObj->lDelta;
129  PWORD addr = (PWORD)byteaddr + x;
130  LONG lDelta = SurfObj->lDelta;
131 
132  byteaddr = (PBYTE)addr;
133  while(y1++ < y2)
134  {
135  *addr = (WORD)c;
136 
137  byteaddr += lDelta;
138  addr = (PWORD)byteaddr;
139  }
140 #endif
141 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
uint32_t ULONG_PTR
Definition: typedefs.h:65
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

◆ DIB_1BPP_BitBlt()

BOOLEAN DIB_1BPP_BitBlt ( PBLTINFO  )

Definition at line 481 of file dib1bpp.c.

482 {
483  LONG DestX, DestY;
484  LONG SourceX, SourceY;
485  LONG PatternY = 0;
486  ULONG Dest, Source = 0, Pattern = 0;
487  ULONG Index;
488  BOOLEAN UsesSource;
489  BOOLEAN UsesPattern;
490  PULONG DestBits;
491  LONG RoundedRight;
492 
493  UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4);
494  UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4);
495 
496  RoundedRight = BltInfo->DestRect.right -
497  ((BltInfo->DestRect.right - BltInfo->DestRect.left) & 31);
498  SourceY = BltInfo->SourcePoint.y;
499 
500  if (UsesPattern)
501  {
502  if (BltInfo->PatternSurface)
503  {
504  PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
505  BltInfo->PatternSurface->sizlBitmap.cy;
506  }
507  else
508  {
509  /* FIXME: Shouldn't it be expanded? */
510  if (BltInfo->Brush)
511  Pattern = BltInfo->Brush->iSolidColor;
512  }
513  }
514 
515  for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
516  {
517  DestX = BltInfo->DestRect.left;
518  SourceX = BltInfo->SourcePoint.x;
519  DestBits = (PULONG)(
520  (PBYTE)BltInfo->DestSurface->pvScan0 +
521  (BltInfo->DestRect.left >> 3) +
522  DestY * BltInfo->DestSurface->lDelta);
523 
524  if (DestX & 31)
525  {
526 #if 0
527  /* FIXME: This case is completely untested!!! */
528 
529  Dest = *((PBYTE)DestBits);
530  NoBits = 31 - (DestX & 31);
531 
532  if (UsesSource)
533  {
534  Source = 0;
535  /* FIXME: This is incorrect! */
536  for (Index = 31 - NoBits; Index >= 0; Index++)
537  Source |= (DIB_GetSource(SourceSurf, SourceX + Index, SourceY, ColorTranslation) << (31 - Index));
538  }
539 
540  if (BltInfo->PatternSurface)
541  {
542  Pattern = 0;
543  for (k = 31 - NoBits; k >= 0; k++)
544  Pattern |= (DIB_GetSourceIndex(PatternObj, (X + BrushOrigin.x + k) % PatternWidth, PatternY) << (31 - k));
545  }
546 
547  Dest = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
548  Dest &= ~((1 << (31 - NoBits)) - 1);
549  Dest |= *((PBYTE)DestBits) & ((1 << (31 - NoBits)) - 1);
550 
551  *DestBits = Dest;
552 
553  DestX += NoBits;
554  SourceX += NoBits;
555 #endif
556  }
557 
558  for (; DestX < RoundedRight; DestX += 32, DestBits++, SourceX += 32)
559  {
560  Dest = *DestBits;
561 
562  if (UsesSource)
563  {
564  Source = 0;
565  for (Index = 0; Index < 8; Index++)
566  {
567  Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index, SourceY, BltInfo->XlateSourceToDest) << (7 - Index);
568  Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 8, SourceY, BltInfo->XlateSourceToDest) << (8 + (7 - Index));
569  Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 16, SourceY, BltInfo->XlateSourceToDest) << (16 + (7 - Index));
570  Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 24, SourceY, BltInfo->XlateSourceToDest) << (24 + (7 - Index));
571  }
572  }
573 
574  if (BltInfo->PatternSurface)
575  {
576  Pattern = 0;
577  for (Index = 0; Index < 8; Index++)
578  {
579  Pattern |= DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY) << (7 - Index);
580  Pattern |= DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 8) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY) << (8 + (7 - Index));
581  Pattern |= DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 16) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY) << (16 + (7 - Index));
582  Pattern |= DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 24) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY) << (24 + (7 - Index));
583  }
584  }
585 
586  *DestBits = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
587  }
588 
589  if (DestX < BltInfo->DestRect.right)
590  {
591  for (; DestX < BltInfo->DestRect.right; DestX++, SourceX++)
592  {
593  Dest = DIB_1BPP_GetPixel(BltInfo->DestSurface, DestX, DestY);
594 
595  if (UsesSource)
596  {
597  Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
598  }
599 
600  if (BltInfo->PatternSurface)
601  {
602  Pattern = DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY);
603  }
604 
605  DIB_1BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xF);
606  }
607  }
608 
609  SourceY++;
610  if (BltInfo->PatternSurface)
611  {
612  PatternY++;
613  PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
614  }
615  }
616 
617  return TRUE;
618 }
#define TRUE
Definition: types.h:120
#define DIB_GetSource(SourceSurf, sx, sy, ColorTranslation)
Definition: dib.h:136
long LONG
Definition: pedump.c:60
#define DIB_GetSourceIndex(SourceSurf, sx, sy)
Definition: dib.h:141
unsigned char BOOLEAN
#define ROP4_USES_SOURCE(Rop4)
Definition: inteng.h:45
ULONG DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern)
Definition: dib.c:92
ULONG DIB_1BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
Definition: dib1bpp.c:30
_In_ WDFCOLLECTION _In_ ULONG Index
#define ROP4_USES_PATTERN(Rop4)
Definition: inteng.h:46
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:3167
BYTE * PBYTE
Definition: pedump.c:66
int k
Definition: mpi.c:3369
VOID DIB_1BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib1bpp.c:19

◆ DIB_1BPP_BitBltSrcCopy()

BOOLEAN DIB_1BPP_BitBltSrcCopy ( PBLTINFO  )

Definition at line 272 of file dib1bpp.c.

273 {
274  ULONG Color;
275  LONG i, j, sx, sy;
276  BOOLEAN bTopToBottom, bLeftToRight;
277 
278  // This sets sy to the top line
279  sy = BltInfo->SourcePoint.y;
280 
281  DPRINT("DIB_1BPP_BitBltSrcCopy: SrcSurf cx/cy (%d/%d), DestSuft cx/cy (%d/%d) dstRect: (%d,%d)-(%d,%d)\n",
282  BltInfo->SourceSurface->sizlBitmap.cx, BltInfo->SourceSurface->sizlBitmap.cy,
283  BltInfo->DestSurface->sizlBitmap.cx, BltInfo->DestSurface->sizlBitmap.cy,
284  BltInfo->DestRect.left, BltInfo->DestRect.top, BltInfo->DestRect.right, BltInfo->DestRect.bottom);
285 
286  /* Get back left to right flip here */
287  bLeftToRight = (BltInfo->DestRect.left > BltInfo->DestRect.right);
288 
289  /* Check for top to bottom flip needed. */
290  bTopToBottom = BltInfo->DestRect.top > BltInfo->DestRect.bottom;
291 
292  // Make WellOrdered with top < bottom and left < right
293  RECTL_vMakeWellOrdered(&BltInfo->DestRect);
294 
295  DPRINT("BPP is '%d' & BltInfo->SourcePoint.x is '%d' & BltInfo->SourcePoint.y is '%d'.\n",
296  BltInfo->SourceSurface->iBitmapFormat, BltInfo->SourcePoint.x, BltInfo->SourcePoint.y);
297 
298  switch ( BltInfo->SourceSurface->iBitmapFormat )
299  {
300  case BMF_1BPP:
301  DPRINT("1BPP Case Selected with DestRect Width of '%d'.\n",
302  BltInfo->DestRect.right - BltInfo->DestRect.left);
303 
304  DIB_1BPP_BitBltSrcCopy_From1BPP ( BltInfo->DestSurface, BltInfo->SourceSurface,
305  BltInfo->XlateSourceToDest, &BltInfo->DestRect, &BltInfo->SourcePoint,
306  bTopToBottom, bLeftToRight );
307  break;
308 
309  case BMF_4BPP:
310  DPRINT("4BPP Case Selected with DestRect Width of '%d'.\n",
311  BltInfo->DestRect.right - BltInfo->DestRect.left);
312 
313  if (bTopToBottom)
314  {
315  // This sets sy to the bottom line
316  sy += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;
317  }
318 
319  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
320  {
321  sx = BltInfo->SourcePoint.x;
322 
323  if (bLeftToRight)
324  {
325  // This sets the sx to the rightmost pixel
326  sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
327  }
328 
329  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
330  {
331  Color = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_4BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
332  DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, Color);
333 
334  DEC_OR_INC(sx, bLeftToRight, 1);
335  }
336  DEC_OR_INC(sy, bTopToBottom, 1);
337  }
338  break;
339 
340  case BMF_8BPP:
341  DPRINT("8BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
342  BltInfo->DestRect.left, BltInfo->DestRect.top,
343  BltInfo->DestRect.right, BltInfo->DestRect.bottom,
344  BltInfo->DestRect.right - BltInfo->DestRect.left);
345 
346  if (bTopToBottom)
347  {
348  // This sets sy to the bottom line
349  sy += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;
350  }
351 
352  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
353  {
354  sx = BltInfo->SourcePoint.x;
355 
356  if (bLeftToRight)
357  {
358  // This sets sx to the rightmost pixel
359  sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
360  }
361 
362  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
363  {
364  Color = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_8BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
365  DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, Color);
366 
367  DEC_OR_INC(sx, bLeftToRight, 1);
368  }
369  DEC_OR_INC(sy, bTopToBottom, 1);
370  }
371  break;
372 
373  case BMF_16BPP:
374  DPRINT("16BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
375  BltInfo->DestRect.left, BltInfo->DestRect.top,
376  BltInfo->DestRect.right, BltInfo->DestRect.bottom,
377  BltInfo->DestRect.right - BltInfo->DestRect.left);
378 
379  if (bTopToBottom)
380  {
381  // This sets sy to the bottom line
382  sy += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;;
383  }
384 
385  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
386  {
387  sx = BltInfo->SourcePoint.x;
388 
389  if (bLeftToRight)
390  {
391  // This sets the sx to the rightmost pixel
392  sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
393  }
394 
395  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
396  {
397  Color = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_16BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
398  DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, Color);
399  DEC_OR_INC(sx, bLeftToRight, 1);
400  }
401  DEC_OR_INC(sy, bTopToBottom, 1);
402  }
403  break;
404 
405  case BMF_24BPP:
406 
407  DPRINT("24BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
408  BltInfo->DestRect.left, BltInfo->DestRect.top,
409  BltInfo->DestRect.right, BltInfo->DestRect.bottom,
410  BltInfo->DestRect.right - BltInfo->DestRect.left);
411 
412  if (bTopToBottom)
413  {
414  // This sets sy to the bottom line
415  sy += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;
416  }
417 
418  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
419  {
420  sx = BltInfo->SourcePoint.x;
421 
422  if (bLeftToRight)
423  {
424  // This sets the sx to the rightmost pixel
425  sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
426  }
427 
428  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
429  {
430  Color = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_24BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
431  DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, Color);
432  DEC_OR_INC(sx, bLeftToRight, 1);
433  }
434  DEC_OR_INC(sy, bTopToBottom, 1);
435  }
436  break;
437 
438  case BMF_32BPP:
439 
440  DPRINT("32BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
441  BltInfo->DestRect.left, BltInfo->DestRect.top,
442  BltInfo->DestRect.right, BltInfo->DestRect.bottom,
443  BltInfo->DestRect.right - BltInfo->DestRect.left);
444 
445  if (bTopToBottom)
446  {
447  // This sets sy to the bottom line
448  sy += BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1;
449  }
450 
451  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
452  {
453  sx = BltInfo->SourcePoint.x;
454 
455  if (bLeftToRight)
456  {
457  // This sets the sx to the rightmost pixel
458  sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
459  }
460 
461  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
462  {
463  Color = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_32BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
464  DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, Color);
465  DEC_OR_INC(sx, bLeftToRight, 1);
466  }
467  DEC_OR_INC(sy, bTopToBottom, 1);
468  }
469  break;
470 
471  default:
472  DbgPrint("DIB_1BPP_BitBlt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
473  return FALSE;
474  }
475 
476  return TRUE;
477 }
#define BMF_24BPP
Definition: winddi.h:359
#define BMF_32BPP
Definition: winddi.h:360
#define DbgPrint
Definition: loader.c:25
#define TRUE
Definition: types.h:120
ULONG DIB_16BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib16bpp.c:30
#define BitsPerFormat(Format)
Definition: surface.h:109
ULONG DIB_24BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib24bpp.c:29
ULONG DIB_32BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib32bpp.c:30
Definition: xlate.c:10
ULONG DIB_4BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib4bpp.c:26
struct Color Color
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
unsigned char BOOLEAN
#define DEC_OR_INC(var, decTrue, amount)
Definition: dib1bpp.c:15
#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
ULONG DIB_8BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib8bpp.c:29
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
Definition: xlate.c:8
static void DIB_1BPP_BitBltSrcCopy_From1BPP(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, XLATEOBJ *pxlo, PRECTL DestRect, POINTL *SourcePoint, BOOLEAN bTopToBottom, BOOLEAN bLeftToRight)
Definition: dib1bpp.c:59
unsigned int ULONG
Definition: retypes.h:1
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
#define DPRINT
Definition: sndvol32.h:71
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
VOID DIB_1BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib1bpp.c:19
Definition: xlate.c:9

◆ DIB_1BPP_ColorFill()

BOOLEAN DIB_1BPP_ColorFill ( SURFOBJ ,
RECTL ,
ULONG   
)

Definition at line 622 of file dib1bpp.c.

623 {
624  LONG DestY;
625 
626  /* Make WellOrdered with top < bottom and left < right */
627  RECTL_vMakeWellOrdered(DestRect);
628 
629  for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
630  {
631  DIB_1BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
632  }
633  return TRUE;
634 }
#define TRUE
Definition: types.h:120
VOID DIB_1BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
Definition: dib1bpp.c:38
long LONG
Definition: pedump.c:60
GLuint color
Definition: glext.h:6243
GLint GLint bottom
Definition: glext.h:7726
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81

◆ DIB_1BPP_GetPixel()

ULONG DIB_1BPP_GetPixel ( SURFOBJ ,
LONG  ,
LONG   
)

Definition at line 30 of file dib1bpp.c.

31 {
32  PBYTE addr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + (x >> 3);
33 
34  return (*addr & MASK1BPP(x) ? 1 : 0);
35 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define MASK1BPP(x)
Definition: dib.h:132
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

Referenced by DIB_16BPP_BitBltSrcCopy(), DIB_1BPP_BitBlt(), DIB_24BPP_BitBltSrcCopy(), DIB_32BPP_BitBltSrcCopy(), DIB_4BPP_BitBltSrcCopy(), and DIB_8BPP_BitBltSrcCopy().

◆ DIB_1BPP_HLine()

VOID DIB_1BPP_HLine ( SURFOBJ ,
LONG  ,
LONG  ,
LONG  ,
ULONG   
)

Definition at line 38 of file dib1bpp.c.

39 {
40  while(x1 < x2)
41  {
42  DIB_1BPP_PutPixel(SurfObj, x1, y, c);
43  x1++;
44  }
45 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
const GLubyte * c
Definition: glext.h:8905
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
VOID DIB_1BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib1bpp.c:19

Referenced by DIB_1BPP_ColorFill(), and IntGdiCreateMaskFromRLE().

◆ DIB_1BPP_PutPixel()

VOID DIB_1BPP_PutPixel ( SURFOBJ ,
LONG  ,
LONG  ,
ULONG   
)

Definition at line 19 of file dib1bpp.c.

20 {
21  PBYTE addr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + (x >> 3);
22 
23  if (0 == (c & 0x01))
24  *addr &= ~MASK1BPP(x);
25  else
26  *addr |= MASK1BPP(x);
27 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define MASK1BPP(x)
Definition: dib.h:132
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

Referenced by DIB_1BPP_BitBlt(), DIB_1BPP_BitBltSrcCopy(), DIB_1BPP_HLine(), and DIB_1BPP_VLine().

◆ DIB_1BPP_TransparentBlt()

BOOLEAN DIB_1BPP_TransparentBlt ( SURFOBJ ,
SURFOBJ ,
RECTL ,
RECTL ,
XLATEOBJ ,
ULONG   
)

Definition at line 638 of file dib1bpp.c.

641 {
642  return FALSE;
643 }
#define FALSE
Definition: types.h:117

◆ DIB_1BPP_VLine()

VOID DIB_1BPP_VLine ( SURFOBJ ,
LONG  ,
LONG  ,
LONG  ,
ULONG   
)

Definition at line 48 of file dib1bpp.c.

49 {
50  while(y1 < y2)
51  {
52  DIB_1BPP_PutPixel(SurfObj, x, y1, c);
53  y1++;
54  }
55 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
const GLubyte * c
Definition: glext.h:8905
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
VOID DIB_1BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib1bpp.c:19

◆ DIB_24BPP_AlphaBlend()

BOOLEAN DIB_24BPP_AlphaBlend ( SURFOBJ ,
SURFOBJ ,
RECTL ,
RECTL ,
CLIPOBJ ,
XLATEOBJ ,
BLENDOBJ  
)

Definition at line 725 of file dib24bpp.c.

728 {
729  INT Rows, Cols, SrcX, SrcY;
730  register PUCHAR Dst;
732  register NICEPIXEL32 DstPixel, SrcPixel;
733  UCHAR Alpha;
734  //UCHAR SrcBpp;
735 
736  DPRINT("DIB_24BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
737  SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
738  DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
739 
740  BlendFunc = BlendObj->BlendFunction;
742  {
743  DPRINT1("BlendOp != AC_SRC_OVER\n");
744  return FALSE;
745  }
746  if (BlendFunc.BlendFlags != 0)
747  {
748  DPRINT1("BlendFlags != 0\n");
749  return FALSE;
750  }
751  if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0)
752  {
753  DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat);
754  return FALSE;
755  }
756  if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 &&
757  BitsPerFormat(Source->iBitmapFormat) != 32)
758  {
759  DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n");
760  return FALSE;
761  }
762 
763  Dst = (PUCHAR)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) +
764  (DestRect->left * 3));
765  //SrcBpp = BitsPerFormat(Source->iBitmapFormat);
766 
767  Rows = 0;
768  SrcY = SourceRect->top;
769  while (++Rows <= DestRect->bottom - DestRect->top)
770  {
771  Cols = 0;
772  SrcX = SourceRect->left;
773  while (++Cols <= DestRect->right - DestRect->left)
774  {
775  SrcPixel.ul = DIB_GetSource(Source, SrcX, SrcY, ColorTranslation);
776  SrcPixel.col.red = (SrcPixel.col.red * BlendFunc.SourceConstantAlpha) / 255;
777  SrcPixel.col.green = (SrcPixel.col.green * BlendFunc.SourceConstantAlpha) / 255;
778  SrcPixel.col.blue = (SrcPixel.col.blue * BlendFunc.SourceConstantAlpha) / 255;
780  {
782  }
783  else
784  {
785  Alpha = (SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha) / 255;
786  }
787 
788  DstPixel.col.red = Clamp8((*Dst * (255 - Alpha)) / 255 + SrcPixel.col.red) ;
789  DstPixel.col.green = Clamp8((*(Dst+1) * (255 - Alpha) / 255 + SrcPixel.col.green)) ;
790  DstPixel.col.blue = Clamp8((*(Dst+2) * (255 - Alpha)) / 255 + SrcPixel.col.blue) ;
791  *Dst++ = DstPixel.col.red;
792  *Dst++ = DstPixel.col.green;
793  *Dst++ = DstPixel.col.blue;
794  SrcX = SourceRect->left + (Cols*(SourceRect->right - SourceRect->left))/(DestRect->right - DestRect->left);
795  }
796  Dst = (PUCHAR)((ULONG_PTR)Dest->pvScan0 + ((DestRect->top + Rows) * Dest->lDelta) +
797  (DestRect->left*3));
798  SrcY = SourceRect->top + (Rows*(SourceRect->bottom - SourceRect->top))/(DestRect->bottom - DestRect->top);
799  }
800 
801  return TRUE;
802 }
struct NICEPIXEL32::@4862 col
#define TRUE
Definition: types.h:120
#define BitsPerFormat(Format)
Definition: surface.h:109
unsigned char * PUCHAR
Definition: retypes.h:3
#define AC_SRC_ALPHA
Definition: alphablend.c:9
int32_t INT
Definition: typedefs.h:58
BYTE BlendOp
Definition: wingdi.h:2758
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define DIB_GetSource(SourceSurf, sx, sy, ColorTranslation)
Definition: dib.h:136
#define FALSE
Definition: types.h:117
_In_ ULONG Rows
Definition: haltypes.h:7
GLint GLint bottom
Definition: glext.h:7726
static const BLENDFUNCTION BlendFunc
Definition: general.c:32
BYTE SourceConstantAlpha
Definition: wingdi.h:2760
GLdouble GLdouble right
Definition: glext.h:10859
unsigned char UCHAR
Definition: xmlstorage.h:181
BYTE BlendFlags
Definition: wingdi.h:2759
#define AC_SRC_OVER
Definition: wingdi.h:1368
#define Dst
Definition: mesh.h:153
#define DPRINT1
Definition: precomp.h:8
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
static __inline UCHAR Clamp8(ULONG val)
Definition: dib24bpp.c:719
#define DPRINT
Definition: sndvol32.h:71
BYTE AlphaFormat
Definition: wingdi.h:2761
ULONG ul
Definition: alphablend.c:16

◆ DIB_24BPP_BitBlt()

BOOLEAN DIB_24BPP_BitBlt ( PBLTINFO  )

Definition at line 485 of file dib24bpp.c.

486 {
487  LONG DestX, DestY;
488  LONG SourceX, SourceY;
489  LONG PatternY = 0;
490  ULONG Dest, Source = 0, Pattern = 0;
491  BOOL UsesSource;
492  BOOL UsesPattern;
493  PBYTE DestBits;
494 
495  UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4);
496  UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4);
497 
498  SourceY = BltInfo->SourcePoint.y;
499  DestBits = (PBYTE)(
500  (PBYTE)BltInfo->DestSurface->pvScan0 +
501  (BltInfo->DestRect.left << 1) + BltInfo->DestRect.left +
502  BltInfo->DestRect.top * BltInfo->DestSurface->lDelta);
503 
504  if (UsesPattern)
505  {
506  if (BltInfo->PatternSurface)
507  {
508  PatternY = (BltInfo->DestRect.top - BltInfo->BrushOrigin.y) %
509  BltInfo->PatternSurface->sizlBitmap.cy;
510  }
511  else
512  {
513  if (BltInfo->Brush)
514  {
515  Pattern = BltInfo->Brush->iSolidColor;
516  }
517  }
518  }
519 
520  for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
521  {
522  SourceX = BltInfo->SourcePoint.x;
523 
524  for (DestX = BltInfo->DestRect.left; DestX < BltInfo->DestRect.right; DestX++, DestBits += 3, SourceX++)
525  {
526  Dest = *((PUSHORT)DestBits) + (*(DestBits + 2) << 16);
527 
528  if (UsesSource)
529  {
530  Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
531  }
532 
533  if (BltInfo->PatternSurface)
534  {
535  Pattern = DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX - BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY);
536  }
537 
538  Dest = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xFFFFFF;
539  *(PUSHORT)(DestBits) = Dest & 0xFFFF;
540  *(DestBits + 2) = (BYTE)(Dest >> 16);
541  }
542 
543  SourceY++;
544  if (BltInfo->PatternSurface)
545  {
546  PatternY++;
547  PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
548  }
549  DestBits -= (BltInfo->DestRect.right - BltInfo->DestRect.left) * 3;
550  DestBits += BltInfo->DestSurface->lDelta;
551  }
552 
553  return TRUE;
554 }
#define TRUE
Definition: types.h:120
#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
#define ROP4_USES_SOURCE(Rop4)
Definition: inteng.h:45
ULONG DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern)
Definition: dib.c:92
unsigned char BYTE
Definition: xxhash.c:193
#define ROP4_USES_PATTERN(Rop4)
Definition: inteng.h:46
unsigned int ULONG
Definition: retypes.h:1
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
BYTE * PBYTE
Definition: pedump.c:66
unsigned short * PUSHORT
Definition: retypes.h:2

◆ DIB_24BPP_BitBltSrcCopy()

BOOLEAN DIB_24BPP_BitBltSrcCopy ( PBLTINFO  )

Definition at line 54 of file dib24bpp.c.

55 {
56  LONG i, j, sx, sy, xColor, f1;
57  PBYTE SourceBits, DestBits, SourceLine, DestLine;
58  PBYTE SourceBits_4BPP, SourceLine_4BPP;
59  PWORD SourceBits_16BPP, SourceLine_16BPP;
60  BOOLEAN bTopToBottom, bLeftToRight;
61 
62  DPRINT("DIB_24BPP_BitBltSrcCopy: SrcSurf cx/cy (%d/%d), DestSuft cx/cy (%d/%d) dstRect: (%d,%d)-(%d,%d)\n",
63  BltInfo->SourceSurface->sizlBitmap.cx, BltInfo->SourceSurface->sizlBitmap.cy,
64  BltInfo->DestSurface->sizlBitmap.cx, BltInfo->DestSurface->sizlBitmap.cy,
65  BltInfo->DestRect.left, BltInfo->DestRect.top, BltInfo->DestRect.right, BltInfo->DestRect.bottom);
66 
67  /* Get back left to right flip here */
68  bLeftToRight = (BltInfo->DestRect.left > BltInfo->DestRect.right);
69 
70  /* Check for top to bottom flip needed. */
71  bTopToBottom = BltInfo->DestRect.top > BltInfo->DestRect.bottom;
72 
73  DPRINT("BltInfo->SourcePoint.x is '%d' and BltInfo->SourcePoint.y is '%d'.\n",
74  BltInfo->SourcePoint.x, BltInfo->SourcePoint.y);
75 
76  /* Make WellOrdered by making top < bottom and left < right */
77  RECTL_vMakeWellOrdered(&BltInfo->DestRect);
78 
79  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left * 3;
80 
81  switch(BltInfo->SourceSurface->iBitmapFormat)
82  {
83  case BMF_1BPP:
84  sx = BltInfo->SourcePoint.x;
85 
86  /* This sets sy to the top line */
87  sy = BltInfo->SourcePoint.y;
88 
89  if (bTopToBottom)
90  {
91  /* This sets sy to the bottom line */
92  sy += BltInfo->SourceSurface->lDelta * (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1);
93  }
94 
95  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
96  {
97  sx = BltInfo->SourcePoint.x;
98 
99  if (bLeftToRight)
100  {
101  /* This sets sx to the rightmost pixel */
102  sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
103  }
104 
105  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
106  {
107  if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
108  {
109  DIB_24BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
110  } else {
111  DIB_24BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
112  }
113  DEC_OR_INC(sx, bLeftToRight, 1);
114  }
115  DEC_OR_INC(sy, bTopToBottom, 1);
116  }
117  break;
118 
119  case BMF_4BPP:
120  DPRINT("4BPP Case Selected with DestRect Width of '%d'.\n",
121  BltInfo->DestRect.right - BltInfo->DestRect.left);
122 
123  /* This sets SourceBits_4BPP to the top line */
124  SourceBits_4BPP = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + (BltInfo->SourcePoint.x >> 1);
125 
126  if (bTopToBottom)
127  {
128  /* This sets SourceBits_4BPP to the bottom line */
129  SourceBits_4BPP += BltInfo->SourceSurface->lDelta * (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1);
130  }
131 
132  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
133  {
134  SourceLine_4BPP = SourceBits_4BPP;
135  DestLine = DestBits;
136  sx = BltInfo->SourcePoint.x;
137 
138  if (bLeftToRight)
139  {
140  /* This sets sx to the rightmost pixel */
141  sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
142  }
143 
144  f1 = sx & 1;
145 
146  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
147  {
148  xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
149  (*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
150  *DestLine++ = xColor & 0xff;
151  *(PWORD)DestLine = (WORD)(xColor >> 8);
152  DestLine += 2;
153  if(f1 == 1) {
154  DEC_OR_INC(SourceLine_4BPP, bLeftToRight, 1);
155  f1 = 0;
156  }
157  else
158  {
159  f1 = 1;
160  }
161  DEC_OR_INC(sx, bLeftToRight, 1);
162  }
163  DEC_OR_INC(SourceBits_4BPP, bTopToBottom, BltInfo->SourceSurface->lDelta);
164  DestBits += BltInfo->DestSurface->lDelta;
165  }
166  break;
167 
168  case BMF_8BPP:
169  DPRINT("8BPP Case Selected with DestRect Width of '%d'.\n",
170  BltInfo->DestRect.right - BltInfo->DestRect.left);
171 
172  /* This sets SourceLine to the top line */
173  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
174 
175  if (bTopToBottom)
176  {
177  /* This sets SourceLine to the bottom line */
178  SourceLine += BltInfo->SourceSurface->lDelta * (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1);
179  }
180  DestLine = DestBits;
181 
182  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
183  {
184  SourceBits = SourceLine;
185  DestBits = DestLine;
186 
187  if (bLeftToRight)
188  {
189  /* This sets the SourceBits to the rightmost pixel */
190  SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
191  }
192 
193  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
194  {
195  xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits);
196  *DestBits = xColor & 0xff;
197  *(PWORD)(DestBits + 1) = (WORD)(xColor >> 8);
198  DEC_OR_INC(SourceBits, bLeftToRight, 1);
199  DestBits += 3;
200  }
201 
202  DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
203  DestLine += BltInfo->DestSurface->lDelta;
204  }
205  break;
206 
207  case BMF_16BPP:
208  DPRINT("16BPP Case Selected with DestRect Width of '%d'.\n",
209  BltInfo->DestRect.right - BltInfo->DestRect.left);
210 
211  /* This sets SourceBits_16BPP to the top line */
212  SourceBits_16BPP = (PWORD)((PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x);
213 
214  if (bTopToBottom)
215  {
216  /* This sets SourceBits_16BPP to the bottom line */
217  SourceBits_16BPP += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;
218  }
219 
220  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
221  {
222  SourceLine_16BPP = SourceBits_16BPP;
223  DestLine = DestBits;
224 
225  if (bLeftToRight)
226  {
227  /* This sets the SourceLine_16BPP to the rightmost pixel */
228  SourceLine_16BPP += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
229  }
230 
231  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
232  {
233  xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceLine_16BPP);
234  *DestLine++ = xColor & 0xff;
235  *(PWORD)DestLine = (WORD)(xColor >> 8);
236  DestLine += 2;
237  DEC_OR_INC(SourceLine_16BPP, bLeftToRight, 1);
238  }
239  if (bTopToBottom)
240  {
241  SourceBits_16BPP = (PWORD)((PBYTE)SourceBits_16BPP - BltInfo->SourceSurface->lDelta);
242  }
243  else
244  {
245  SourceBits_16BPP = (PWORD)((PBYTE)SourceBits_16BPP + BltInfo->SourceSurface->lDelta);
246  }
247  DestBits += BltInfo->DestSurface->lDelta;
248  }
249  break;
250 
251  case BMF_24BPP:
252  DPRINT("24BPP Case Selected with DestRect Width of '%d'.\n",
253  BltInfo->DestRect.right - BltInfo->DestRect.left);
254 
255  /* Check for no flips here because we are about to use RtlMoveMemory and it can only do increasing src & dst */
256  if ((BltInfo->XlateSourceToDest == NULL ||
257  (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL) != 0) &&
258  (!bTopToBottom && !bLeftToRight))
259  {
260  DPRINT("XO_TRIVIAL is TRUE.\n");
261  if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
262  {
263  /* This sets SourceBits to the top line */
264  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x;
265  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
266  {
267  RtlMoveMemory(DestBits, SourceBits, 3 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
268  SourceBits += BltInfo->SourceSurface->lDelta;
269  DestBits += BltInfo->DestSurface->lDelta;
270  }
271  }
272  else
273  {
274  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x;
275  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 3 * BltInfo->DestRect.left;
276  for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
277  {
278  RtlMoveMemory(DestBits, SourceBits, 3 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
279  SourceBits -= BltInfo->SourceSurface->lDelta;
280  DestBits -= BltInfo->DestSurface->lDelta;
281  }
282  }
283  }
284  else
285  {
286  DPRINT("XO_TRIVIAL is NOT TRUE.\n");
287 
288  if (!bTopToBottom && !bLeftToRight)
289  /* **Note: Indent is purposefully less than desired to keep reviewable differences to a minimum for PR** */
290  {
291  sx = BltInfo->SourcePoint.x;
292  sy = BltInfo->SourcePoint.y;
293 
294  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
295  {
296  sx = BltInfo->SourcePoint.x;
297  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
298  {
299  DWORD pixel = DIB_24BPP_GetPixel(BltInfo->SourceSurface, sx, sy);
300  DIB_24BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, pixel));
301  sx++;
302  }
303  sy++;
304  }
305  }
306  else
307  {
308  /* Buffering for source and destination flip overlaps. Fixes KHMZ MirrorTest CORE-16642 */
309  BOOL TopToBottomDone = FALSE;
310 
311  if (bLeftToRight)
312  {
313  DPRINT("Flip is bLeftToRight.\n");
314  DWORD Index;
315 
316  /* Allocate enough pixels for a row in DWORD's */
318  (BltInfo->DestRect.right - BltInfo->DestRect.left + 1) * 4, TAG_DIB);
319  if (store == NULL)
320  {
321  DPRINT1("Storage Allocation Failed.\n");
322  return FALSE;
323  }
324 
325  sx = BltInfo->SourcePoint.x;
326  /* This sets sy to the top line */
327  sy = BltInfo->SourcePoint.y;
328 
329  /* This sets sx to the rightmost pixel */
330  sx = BltInfo->SourcePoint.x + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
331 
332  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
333  {
334 
335  /* This sets sx to the rightmost pixel */
336  sx = BltInfo->SourcePoint.x + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
337 
338  Index = 0;
339 
340  // Read right to left and store
341  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
342  {
343  store[Index] = DIB_24BPP_GetPixel(BltInfo->SourceSurface, sx, sy);
344  Index++;
345  sx--;
346  }
347 
348  Index = 0;
349 
350  // Write left to right to pixel
351  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
352  {
353  DIB_24BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, store[Index]));
354  Index++;
355  }
356  sy++;
357  }
358  ExFreePoolWithTag(store, TAG_DIB);
359  TopToBottomDone = TRUE;
360  }
361 
362  if (bTopToBottom)
363  {
364  DPRINT("Flip is bTopToBottom.\n");
365  DWORD Index;
366 
367  /* Allocate enough pixels for a column in DWORD's */
369  (BltInfo->DestRect.bottom - BltInfo->DestRect.top + 1) * 4, TAG_DIB);
370  if (store == NULL)
371  {
372  DPRINT1("Storage Allocation Failed.\n");
373  return FALSE;
374  }
375 
376  /* The TopToBottomDone flag indicates that we are flipping for bTopToBottom and bLeftToRight
377  * and have already completed the bLeftToRight. So we will lose our first flip output
378  * unless we work with its output which is at the destination site. So in this case
379  * our new Source becomes the previous outputs Destination.
380  */
381 
382  if (TopToBottomDone)
383  {
384  sx = BltInfo->DestRect.left;
385  sy = BltInfo->DestRect.top;
386 
387  /* This sets sy to the bottom line */
388  sy += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1);
389  }
390  else
391  {
392  sx = BltInfo->SourcePoint.x;
393 
394  /* This sets sy to the top line */
395  sy = BltInfo->SourcePoint.y;
396 
397  /* This sets sy to the bottom line */
398  sy = BltInfo->SourcePoint.y + (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1);
399  }
400 
401  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
402  {
403 
404  /* This sets sy to the bottom line */
405  sy = BltInfo->SourcePoint.y + (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1);
406  Index = 0;
407 
408  /* Read bottom to top and store */
409  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
410  {
411  if (TopToBottomDone)
412  {
413  store[Index] = DIB_24BPP_GetPixel(BltInfo->DestSurface, sx, sy);
414  }
415  else
416  {
417  store[Index] = DIB_24BPP_GetPixel(BltInfo->SourceSurface, sx, sy);
418  }
419  Index++;
420  sy--;
421  }
422 
423  Index = 0;
424 
425  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
426  {
427  DIB_24BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, store[Index]));
428  Index++;
429  }
430  sx++;
431  }
432  ExFreePoolWithTag(store, TAG_DIB);
433  }
434 
435  }
436  }
437  break;
438 
439  case BMF_32BPP:
440  DPRINT("32BPP Case Selected with DestRect Width of '%d'.\n",
441  BltInfo->DestRect.right - BltInfo->DestRect.left);
442 
443  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
444 
445  if (bTopToBottom)
446  {
447  /* This sets SourceLine to the bottom line */
448  SourceLine += BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1;
449  }
450  DestLine = DestBits;
451 
452  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
453  {
454  SourceBits = SourceLine;
455  DestBits = DestLine;
456 
457  if (bLeftToRight)
458  {
459  /* This sets SourceBits to the rightmost pixel */
460  SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1) * 4;
461  }
462  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
463  {
464  xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *((PDWORD) SourceBits));
465  *DestBits = xColor & 0xff;
466  *(PWORD)(DestBits + 1) = (WORD)(xColor >> 8);
467  DEC_OR_INC(SourceBits, bLeftToRight, 4);
468  DestBits += 3;
469  }
470 
471  DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
472  DestLine += BltInfo->DestSurface->lDelta;
473  }
474  break;
475 
476  default:
477  DbgPrint("DIB_24BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
478  return FALSE;
479  }
480 
481  return TRUE;
482 }
#define BMF_24BPP
Definition: winddi.h:359
#define BMF_32BPP
Definition: winddi.h:360
#define DbgPrint
Definition: loader.c:25
#define TRUE
Definition: types.h:120
unsigned char altnotmask[2]
Definition: dib.c:18
#define BitsPerFormat(Format)
Definition: surface.h:109
Definition: xlate.c:10
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
unsigned char BOOLEAN
VOID DIB_24BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib24bpp.c:21
#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
WORD * PWORD
Definition: pedump.c:67
_In_ WDFCOLLECTION _In_ ULONG Index
ULONG DIB_24BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
Definition: dib24bpp.c:29
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
ULONG DIB_1BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib1bpp.c:30
#define XO_TRIVIAL
Definition: winddi.h:1247
#define f1(x, y, z)
Definition: sha1.c:30
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
Definition: xlate.c:8
#define NULL
Definition: types.h:112
DWORD * PDWORD
Definition: pedump.c:68
#define DPRINT1
Definition: precomp.h:8
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define DPRINT
Definition: sndvol32.h:71
#define DEC_OR_INC(var, decTrue, amount)
Definition: dib24bpp.c:17
BYTE * PBYTE
Definition: pedump.c:66
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
Definition: xlate.c:9
#define TAG_DIB
Definition: tags.h:17

◆ DIB_24BPP_ColorFill()

BOOLEAN DIB_24BPP_ColorFill ( SURFOBJ ,
RECTL ,
ULONG   
)

Definition at line 558 of file dib24bpp.c.

559 {
560  LONG DestY;
561 
562  /* Make WellOrdered by making top < bottom and left < right */
563  RECTL_vMakeWellOrdered(DestRect);
564 
565 #if defined(_M_IX86) && !defined(_MSC_VER)
566  PBYTE xaddr = (PBYTE)DestSurface->pvScan0 + DestRect->top * DestSurface->lDelta + (DestRect->left << 1) + DestRect->left;
567  PBYTE addr;
568  ULONG Count;
569  ULONG xCount=DestRect->right - DestRect->left;
570 
571  for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
572  {
573  Count = xCount;
574  addr = xaddr;
575  xaddr = (PBYTE)((ULONG_PTR)addr + DestSurface->lDelta);
576 
577  if (Count < 8)
578  {
579  /* For small fills, don't bother doing anything fancy */
580  while (Count--)
581  {
582  *(PUSHORT)(addr) = color;
583  addr += 2;
584  *(addr) = color >> 16;
585  addr += 1;
586  }
587  }
588  else
589  {
590  /* Align to 4-byte address */
591  while (0 != ((ULONG_PTR) addr & 0x3))
592  {
593  *(PUSHORT)(addr) = color;
594  addr += 2;
595  *(addr) = color >> 16;
596  addr += 1;
597  Count--;
598  }
599  /* If the color we need to fill with is 0ABC, then the final mem pattern
600  * (note little-endianness) would be:
601  *
602  * |C.B.A|C.B.A|C.B.A|C.B.A| <- pixel borders
603  * |C.B.A.C|B.A.C.B|A.C.B.A| <- ULONG borders
604  *
605  * So, taking endianness into account again, we need to fill with these
606  * ULONGs: CABC BCAB ABCA */
607 
608  /* This is about 30% faster than the generic C code below */
609  __asm__ __volatile__ (
610  "movl %1, %%ecx\n\t"
611  "andl $0xffffff, %%ecx\n\t" /* 0ABC */
612  "movl %%ecx, %%ebx\n\t" /* Construct BCAB in ebx */
613  "shrl $8, %%ebx\n\t"
614  "movl %%ecx, %%eax\n\t"
615  "shll $16, %%eax\n\t"
616  "orl %%eax, %%ebx\n\t"
617  "movl %%ecx, %%edx\n\t" /* Construct ABCA in edx */
618  "shll $8, %%edx\n\t"
619  "movl %%ecx, %%eax\n\t"
620  "shrl $16, %%eax\n\t"
621  "orl %%eax, %%edx\n\t"
622  "movl %%ecx, %%eax\n\t" /* Construct CABC in eax */
623  "shll $24, %%eax\n\t"
624  "orl %%ecx, %%eax\n\t"
625  "movl %2, %%ecx\n\t" /* Load count */
626  "shr $2, %%ecx\n\t"
627  "movl %3, %%edi\n" /* Load dest */
628  "1:\n\t"
629  "movl %%eax, (%%edi)\n\t" /* Store 4 pixels, 12 bytes */
630  "movl %%ebx, 4(%%edi)\n\t"
631  "movl %%edx, 8(%%edi)\n\t"
632  "addl $12, %%edi\n\t"
633  "dec %%ecx\n\t"
634  "jnz 1b\n\t"
635  "movl %%edi, %0"
636  : "=m"(addr)
637  : "m"(color), "m"(Count), "m"(addr)
638  : "%eax", "%ebx", "%ecx", "%edx", "%edi");
639  Count = Count & 0x03;
640  while (0 != Count--)
641  {
642  *(PUSHORT)(addr) = color;
643  addr += 2;
644  *(addr) = color >> 16;
645  addr += 1;
646  }
647  }
648  }
649 #else
650 
651  for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
652  {
653  DIB_24BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
654  }
655 #endif
656  return TRUE;
657 }
VOID DIB_24BPP_HLine(SURFOBJ *, LONG, LONG, LONG, ULONG)
Definition: dib24bppc.c:16
#define TRUE
Definition: types.h:120
uint32_t ULONG_PTR
Definition: typedefs.h:65
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")
GLint GLint bottom
Definition: glext.h:7726
int Count
Definition: noreturn.cpp:7
GLenum const GLvoid * addr
Definition: glext.h:9621
unsigned int ULONG
Definition: retypes.h:1
BYTE * PBYTE
Definition: pedump.c:66
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
unsigned short * PUSHORT
Definition: retypes.h:2

◆ DIB_24BPP_GetPixel()

ULONG DIB_24BPP_GetPixel ( SURFOBJ ,
LONG  ,
LONG   
)

Definition at line 29 of file dib24bpp.c.

30 {
31  PBYTE addr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + (x << 1) + x;
32  return *(PUSHORT)(addr) + (*(addr + 2) << 16);
33 }
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

Referenced by DIB_1BPP_BitBltSrcCopy(), and DIB_24BPP_BitBltSrcCopy().

◆ DIB_24BPP_HLine()

VOID DIB_24BPP_HLine ( SURFOBJ ,
LONG  ,
LONG  ,
LONG  ,
ULONG   
)

Definition at line 16 of file dib24bppc.c.

17 {
18  PBYTE addr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + (x1 << 1) + x1;
19  ULONG Count = x2 - x1;
20 
21  if (Count < 8)
22  {
23  /* For small fills, don't bother doing anything fancy */
24  while (Count--)
25  {
26  *(PUSHORT)(addr) = c;
27  addr += 2;
28  *(addr) = c >> 16;
29  addr += 1;
30  }
31  }
32  else
33  {
34  ULONG Fill[3];
35  ULONG MultiCount;
36 
37  /* Align to 4-byte address */
38  while (0 != ((ULONG_PTR) addr & 0x3))
39  {
40  *(PUSHORT)(addr) = c;
41  addr += 2;
42  *(addr) = c >> 16;
43  addr += 1;
44  Count--;
45  }
46  /* If the color we need to fill with is 0ABC, then the final mem pattern
47  * (note little-endianness) would be:
48  *
49  * |C.B.A|C.B.A|C.B.A|C.B.A| <- pixel borders
50  * |C.B.A.C|B.A.C.B|A.C.B.A| <- ULONG borders
51  *
52  * So, taking endianness into account again, we need to fill with these
53  * ULONGs: CABC BCAB ABCA */
54 
55  c = c & 0xffffff; /* 0ABC */
56  Fill[0] = c | (c << 24); /* CABC */
57  Fill[1] = (c >> 8) | (c << 16); /* BCAB */
58  Fill[2] = (c << 8) | (c >> 16); /* ABCA */
59  MultiCount = Count / 4;
60  do
61  {
62  *(PULONG)addr = Fill[0];
63  addr += 4;
64  *(PULONG)addr = Fill[1];
65  addr += 4;
66  *(PULONG)addr = Fill[2];
67  addr += 4;
68  }
69  while (0 != --MultiCount);
70 
71  Count = Count & 0x03;
72  while (0 != Count--)
73  {
74  *(PUSHORT)(addr) = c;
75  addr += 2;
76  *(addr) = c >> 16;
77  addr += 1;
78  }
79  }
80 }
void Fill(HDC hdc, LONG x, LONG y, COLORREF color)
Definition: drawing.cpp:109
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
uint32_t ULONG_PTR
Definition: typedefs.h:65
int Count
Definition: noreturn.cpp:7
const GLubyte * c
Definition: glext.h:8905
GLenum const GLvoid * addr
Definition: glext.h:9621
unsigned int * PULONG
Definition: retypes.h:1
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
#define c
Definition: ke_i.h:80
unsigned int ULONG
Definition: retypes.h:1
BYTE * PBYTE
Definition: pedump.c:66
unsigned short * PUSHORT
Definition: retypes.h:2

Referenced by DIB_24BPP_ColorFill().

◆ DIB_24BPP_PutPixel()

VOID DIB_24BPP_PutPixel ( SURFOBJ ,
LONG  ,
LONG  ,
ULONG   
)

Definition at line 21 of file dib24bpp.c.

22 {
23  PBYTE addr = (PBYTE)SurfObj->pvScan0 + (y * SurfObj->lDelta) + (x << 1) + x;
24  *(PUSHORT)(addr) = c & 0xFFFF;
25  *(addr + 2) = (c >> 16) & 0xFF;
26 }
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

Referenced by DIB_24BPP_BitBltSrcCopy().

◆ DIB_24BPP_TransparentBlt()

BOOLEAN DIB_24BPP_TransparentBlt ( SURFOBJ ,
SURFOBJ ,
RECTL ,
RECTL ,
XLATEOBJ ,
ULONG   
)

Definition at line 660 of file dib24bpp.c.

663 {
664  LONG X, Y, SourceX, SourceY = 0, wd;
665  ULONG Source = 0, Dest;
666  BYTE *DestBits;
667 
668  LONG DstHeight;
669  LONG DstWidth;
670  LONG SrcHeight;
671  LONG SrcWidth;
672 
673  DstHeight = DestRect->bottom - DestRect->top;
674  DstWidth = DestRect->right - DestRect->left;
675  SrcHeight = SourceRect->bottom - SourceRect->top;
676  SrcWidth = SourceRect->right - SourceRect->left;
677 
678  DestBits = (BYTE*)((PBYTE)DestSurf->pvScan0 +
679  (DestRect->left * 3) +
680  DestRect->top * DestSurf->lDelta);
681  wd = DestSurf->lDelta - ((DestRect->right - DestRect->left) * 3);
682 
683  for(Y = DestRect->top; Y < DestRect->bottom; Y++)
684  {
685  SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
686  for(X = DestRect->left; X < DestRect->right; X++, DestBits += 3)
687  {
688  SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
689  if (SourceX >= 0 && SourceY >= 0 &&
690  SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
691  {
692  Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
693  if(Source != iTransColor)
694  {
695  Dest = XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFFFFFF;
696  *(PUSHORT)(DestBits) = Dest & 0xFFFF;
697  *(DestBits + 2) = (BYTE)(Dest >> 16);
698  }
699  }
700  }
701 
702  DestBits = (BYTE*)((ULONG_PTR)DestBits + wd);
703  }
704 
705  return TRUE;
706 }
#define Y(I)
#define TRUE
Definition: types.h:120
_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:65
long LONG
Definition: pedump.c:60
#define DIB_GetSourceIndex(SourceSurf, sx, sy)
Definition: dib.h:141
GLint GLint bottom
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
unsigned char BYTE
Definition: xxhash.c:193
unsigned int ULONG
Definition: retypes.h:1
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
BYTE * PBYTE
Definition: pedump.c:66
unsigned short * PUSHORT
Definition: retypes.h:2
#define X(b, s)

◆ DIB_24BPP_VLine()

VOID DIB_24BPP_VLine ( SURFOBJ ,
LONG  ,
LONG  ,
LONG  ,
ULONG   
)

Definition at line 38 of file dib24bpp.c.

39 {
40  PBYTE addr = (PBYTE)SurfObj->pvScan0 + y1 * SurfObj->lDelta + (x << 1) + x;
41  LONG lDelta = SurfObj->lDelta;
42 
43  c &= 0xFFFFFF;
44  while(y1++ < y2)
45  {
46  *(PUSHORT)(addr) = c & 0xFFFF;
47  *(addr + 2) = (BYTE)(c >> 16);
48 
49  addr += lDelta;
50  }
51 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
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
_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
unsigned short * PUSHORT
Definition: retypes.h:2

◆ DIB_32BPP_AlphaBlend()

BOOLEAN DIB_32BPP_AlphaBlend ( SURFOBJ ,
SURFOBJ ,
RECTL ,
RECTL ,
CLIPOBJ ,
XLATEOBJ ,
BLENDOBJ  
)

Definition at line 763 of file dib32bpp.c.

766 {
767  INT Rows, Cols, SrcX, SrcY;
768  register PULONG Dst;
770  register NICEPIXEL32 DstPixel, SrcPixel;
771  UCHAR Alpha, SrcBpp;
772 
773  DPRINT("DIB_32BPP_AlphaBlend: SourceRect: (%d,%d)-(%d,%d), DestRect: (%d,%d)-(%d,%d)\n",
774  SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
775  DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
776 
777  BlendFunc = BlendObj->BlendFunction;
779  {
780  DPRINT1("BlendOp != AC_SRC_OVER\n");
781  return FALSE;
782  }
783  if (BlendFunc.BlendFlags != 0)
784  {
785  DPRINT1("BlendFlags != 0\n");
786  return FALSE;
787  }
788  if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0)
789  {
790  DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat);
791  return FALSE;
792  }
793  if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 &&
794  BitsPerFormat(Source->iBitmapFormat) != 32)
795  {
796  DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n");
797  return FALSE;
798  }
799 
800  Dst = (PULONG)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) +
801  (DestRect->left << 2));
802  SrcBpp = BitsPerFormat(Source->iBitmapFormat);
803 
804  Rows = 0;
805  SrcY = SourceRect->top;
806  while (++Rows <= DestRect->bottom - DestRect->top)
807  {
808  Cols = 0;
809  SrcX = SourceRect->left;
810  while (++Cols <= DestRect->right - DestRect->left)
811  {
812  SrcPixel.ul = DIB_GetSource(Source, SrcX, SrcY, ColorTranslation);
813  SrcPixel.col.red = (SrcPixel.col.red * BlendFunc.SourceConstantAlpha) / 255;
814  SrcPixel.col.green = (SrcPixel.col.green * BlendFunc.SourceConstantAlpha) / 255;
815  SrcPixel.col.blue = (SrcPixel.col.blue * BlendFunc.SourceConstantAlpha) / 255;
816  SrcPixel.col.alpha = (32 == SrcBpp) ?
817  (SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha) / 255 :
819 
820  Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
821  SrcPixel.col.alpha : BlendFunc.SourceConstantAlpha ;
822 
823  DstPixel.ul = *Dst;
824  DstPixel.col.red = Clamp8((DstPixel.col.red * (255 - Alpha)) / 255 + SrcPixel.col.red) ;
825  DstPixel.col.green = Clamp8((DstPixel.col.green * (255 - Alpha)) / 255 + SrcPixel.col.green) ;
826  DstPixel.col.blue = Clamp8((DstPixel.col.blue * (255 - Alpha)) / 255 + SrcPixel.col.blue) ;
827  DstPixel.col.alpha = Clamp8((DstPixel.col.alpha * (255 - Alpha)) / 255 + SrcPixel.col.alpha) ;
828  *Dst++ = DstPixel.ul;
829  SrcX = SourceRect->left + (Cols*(SourceRect->right - SourceRect->left))/(DestRect->right - DestRect->left);
830  }
831  Dst = (PULONG)((ULONG_PTR)Dest->pvScan0 + ((DestRect->top + Rows) * Dest->lDelta) +
832  (DestRect->left << 2));
833  SrcY = SourceRect->top + (Rows*(SourceRect->bottom - SourceRect->top))/(DestRect->bottom - DestRect->top);
834  }
835 
836  return TRUE;
837 }
struct NICEPIXEL32::@4862 col
#define TRUE
Definition: types.h:120
#define BitsPerFormat(Format)
Definition: surface.h:109
#define AC_SRC_ALPHA
Definition: alphablend.c:9
int32_t INT
Definition: typedefs.h:58
BYTE BlendOp
Definition: wingdi.h:2758
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define DIB_GetSource(SourceSurf, sx, sy, ColorTranslation)
Definition: dib.h:136
#define FALSE
Definition: types.h:117
_In_ ULONG Rows
Definition: haltypes.h:7
GLint GLint bottom
Definition: glext.h:7726
static const BLENDFUNCTION BlendFunc
Definition: general.c:32
BYTE SourceConstantAlpha
Definition: wingdi.h:2760
GLdouble GLdouble right
Definition: glext.h:10859
unsigned char UCHAR
Definition: xmlstorage.h:181
static __inline UCHAR Clamp8(ULONG val)
Definition: dib32bpp.c:757
BYTE BlendFlags
Definition: wingdi.h:2759
#define AC_SRC_OVER
Definition: wingdi.h:1368
#define Dst
Definition: mesh.h:153
unsigned int * PULONG
Definition: retypes.h:1
#define DPRINT1
Definition: precomp.h:8
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
#define DPRINT
Definition: sndvol32.h:71
BYTE AlphaFormat
Definition: wingdi.h:2761
ULONG ul
Definition: alphablend.c:16

◆ DIB_32BPP_BitBlt()

BOOLEAN DIB_32BPP_BitBlt ( PBLTINFO  )

◆ DIB_32BPP_BitBltSrcCopy()

BOOLEAN DIB_32BPP_BitBltSrcCopy ( PBLTINFO  )

Definition at line 54 of file dib32bpp.c.

55 {
56  LONG i, j, sx, sy, xColor, f1;
57  PBYTE SourceBits, DestBits, SourceLine, DestLine;
58  PBYTE SourceBitsT, SourceBitsB, DestBitsT, DestBitsB;
59  PBYTE SourceBits_4BPP, SourceLine_4BPP;
60  PDWORD Source32, Dest32;
61  DWORD Index, DestWidth, DestHeight;
62  BOOLEAN bTopToBottom, bLeftToRight;
63  BOOLEAN blDeltaSrcNeg, blDeltaDestNeg;
64  BOOLEAN blDeltaAdjustDone = FALSE;
65 
66  DPRINT("DIB_32BPP_BitBltSrcCopy: SourcePoint (%d, %d), SourceSurface cx/cy (%d/%d), "
67  "DestSurface cx/cy (%d/%d) DestRect: (%d,%d)-(%d,%d)\n",
68  BltInfo->SourcePoint.x, BltInfo->SourcePoint.y,
69  BltInfo->SourceSurface->sizlBitmap.cx, BltInfo->SourceSurface->sizlBitmap.cy,
70  BltInfo->DestSurface->sizlBitmap.cx, BltInfo->DestSurface->sizlBitmap.cy,
71  BltInfo->DestRect.left, BltInfo->DestRect.top, BltInfo->DestRect.right, BltInfo->DestRect.bottom);
72 
73  DPRINT("BltInfo->DestSurface->lDelta is '%d' and BltInfo->SourceSurface->lDelta is '%d'.\n",
74  BltInfo->DestSurface->lDelta, BltInfo->SourceSurface->lDelta);
75 
76  DPRINT("iBitmapFormat is %d and width,height is (%d,%d).\n", BltInfo->SourceSurface->iBitmapFormat,
77  BltInfo->DestRect.right - BltInfo->DestRect.left, BltInfo->DestRect.bottom - BltInfo->DestRect.top);
78 
79  DPRINT("BltInfo->SourcePoint.x is '%d' and BltInfo->SourcePoint.y is '%d'.\n",
80  BltInfo->SourcePoint.x, BltInfo->SourcePoint.y);
81 
82  /* Do not deal with negative numbers for these values */
83  if ((BltInfo->DestRect.left < 0) || (BltInfo->DestRect.top < 0) ||
84  (BltInfo->DestRect.right < 0) || (BltInfo->DestRect.bottom < 0))
85  return FALSE;
86 
87  /* Detect negative lDelta's meaning Bottom-Up bitmaps */
88  blDeltaSrcNeg = BltInfo->SourceSurface->lDelta < 0;
89  blDeltaDestNeg = BltInfo->DestSurface->lDelta < 0;
90 
91  /* Get back left to right flip here */
92  bLeftToRight = BltInfo->DestRect.left > BltInfo->DestRect.right;
93 
94  /* Check for top to bottom flip needed. */
95  bTopToBottom = BltInfo->DestRect.top > BltInfo->DestRect.bottom;
96 
97  DPRINT("bTopToBottom is '%d' and DestSurface->lDelta < 0 is '%d' and SourceSurface->lDelta < 0 is '%d'.\n",
98  bTopToBottom, BltInfo->DestSurface->lDelta < 0 ? 1 : 0, BltInfo->SourceSurface->lDelta < 0 ? 1 : 0);
99 
100  /* Make WellOrdered with top < bottom and left < right */
101  RECTL_vMakeWellOrdered(&BltInfo->DestRect);
102 
103  DestWidth = BltInfo->DestRect.right - BltInfo->DestRect.left;
104  DestHeight = BltInfo->DestRect.bottom - BltInfo->DestRect.top;
105 
106  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
107  + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta)
108  + 4 * BltInfo->DestRect.left;
109 
110  DPRINT("iBitmapFormat is %d and width,height is (%d,%d).\n", BltInfo->SourceSurface->iBitmapFormat,
111  DestWidth, DestHeight);
112 
113  switch (BltInfo->SourceSurface->iBitmapFormat)
114  {
115  case BMF_1BPP:
116  DPRINT("1BPP Case Selected with DestRect Width of '%d'.\n",
117  DestWidth);
118 
119  if (bLeftToRight || bTopToBottom)
120  DPRINT("bLeftToRight is '%d' and bTopToBottom is '%d'.\n", bLeftToRight, bTopToBottom);
121 
122  sx = BltInfo->SourcePoint.x;
123 
124  /* This sets sy to the top line */
125  sy = BltInfo->SourcePoint.y;
126 
127  if (bTopToBottom)
128  {
129  /* This sets sy to the bottom line */
130  sy += BltInfo->SourceSurface->lDelta * (DestHeight - 1);
131  }
132 
133  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
134  {
135  sx = BltInfo->SourcePoint.x;
136 
137  if (bLeftToRight)
138  {
139  /* This sets the sx to the rightmost pixel */
140  sx += (DestWidth - 1);
141  }
142 
143  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
144  {
145  if (DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
146  {
147  DIB_32BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
148  }
149  else
150  {
151  DIB_32BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
152  }
153 
154  DEC_OR_INC(sx, bLeftToRight, 1);
155  }
156  DEC_OR_INC(sy, bTopToBottom, 1);
157  }
158  break;
159 
160  case BMF_4BPP:
161  DPRINT("4BPP Case Selected with DestRect Width of '%d'.\n",
162  DestWidth);
163 
164  if (bLeftToRight || bTopToBottom)
165  DPRINT("bLeftToRight is '%d' and bTopToBottom is '%d'.\n", bLeftToRight, bTopToBottom);
166 
167  /* This sets SourceBits_4BPP to the top line */
168  SourceBits_4BPP = (PBYTE)BltInfo->SourceSurface->pvScan0
169  + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
170  + (BltInfo->SourcePoint.x >> 1);
171 
172  if (bTopToBottom)
173  {
174  /* This sets SourceBits_4BPP to the bottom line */
175  SourceBits_4BPP += BltInfo->SourceSurface->lDelta * (DestHeight - 1);
176  }
177 
178  for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
179  {
180  SourceLine_4BPP = SourceBits_4BPP;
181  sx = BltInfo->SourcePoint.x;
182 
183  if (bLeftToRight)
184  {
185  /* This sets sx to the rightmost pixel */
186  sx += (DestWidth - 1);
187  }
188 
189  f1 = sx & 1;
190 
191  for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
192  {
193  xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
194  (*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
195  DIB_32BPP_PutPixel(BltInfo->DestSurface, i, j, xColor);
196  if (f1 == 1) {
197  DEC_OR_INC(SourceLine_4BPP, bLeftToRight, 1);
198  f1 = 0;
199  } else {
200  f1 = 1;
201  }
202  DEC_OR_INC(sx, bLeftToRight, 1);
203  }
204  DEC_OR_INC(SourceBits_4BPP, bTopToBottom, BltInfo->SourceSurface->lDelta);
205  }
206  break;
207 
208  case BMF_8BPP:
209  DPRINT("8BPP Case Selected with DestRect Width of '%d'.\n",
210  DestWidth);
211 
212  if (bLeftToRight || bTopToBottom)
213  DPRINT("bLeftToRight is '%d' and bTopToBottom is '%d'.\n", bLeftToRight, bTopToBottom);
214 
215  /* This sets SourceLine to the top line */
216  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0
217  + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
218  + BltInfo->SourcePoint.x;
219  DestLine = DestBits;
220 
221  if (bTopToBottom)
222  {
223  /* This sets SourceLine to the bottom line */
224  SourceLine += BltInfo->SourceSurface->lDelta * (DestHeight - 1);
225  }
226 
227  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
228  {
229  SourceBits = SourceLine;
230  DestBits = DestLine;
231 
232  if (bLeftToRight)
233  {
234  /* This sets the SourceBits to the rightmost pixel */
235  SourceBits += (DestWidth - 1);
236  }
237 
238  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
239  {
240  xColor = *SourceBits;
241  *((PDWORD) DestBits) = (DWORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
242  DEC_OR_INC(SourceBits, bLeftToRight, 1);
243  DestBits += 4;
244  }
245  DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
246  DestLine += BltInfo->DestSurface->lDelta;
247  }
248  break;
249 
250  case BMF_16BPP:
251  DPRINT("16BPP Case Selected with DestRect Width of '%d'.\n",
252  DestWidth);
253 
254  if (bLeftToRight || bTopToBottom)
255  DPRINT("bLeftToRight is '%d' and bTopToBottom is '%d'.\n", bLeftToRight, bTopToBottom);
256 
257  /* This sets SourceLine to the top line */
258  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0
259  + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
260  + 2 * BltInfo->SourcePoint.x;
261  DestLine = DestBits;
262 
263  if (bTopToBottom)
264  {
265  /* This sets SourceLine to the bottom line */
266  SourceLine += BltInfo->SourceSurface->lDelta * (DestHeight - 1);
267  }
268 
269  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
270  {
271  SourceBits = SourceLine;
272  DestBits = DestLine;
273 
274  if (bLeftToRight)
275  {
276  /* This sets the SourceBits to the rightmost pixel */
277  SourceBits += (DestWidth - 1) * 2;
278  }
279 
280  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
281  {
282  xColor = *((PWORD) SourceBits);
283  *((PDWORD) DestBits) = (DWORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
284  DEC_OR_INC(SourceBits, bLeftToRight, 2);
285  DestBits += 4;
286  }
287 
288  DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
289  DestLine += BltInfo->DestSurface->lDelta;
290  }
291  break;
292 
293  case BMF_24BPP:
294  DPRINT("24BPP Case Selected with DestRect Width of '%d'.\n",
295  DestWidth);
296 
297  if (bLeftToRight || bTopToBottom)
298  DPRINT("bLeftToRight is '%d' and bTopToBottom is '%d'.\n", bLeftToRight, bTopToBottom);
299 
300  /* This sets SourceLine to the top line */
301  SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0
302  + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
303  + 3 * BltInfo->SourcePoint.x;
304 
305  if (bTopToBottom)
306  {
307  /* This sets SourceLine to the bottom line */
308  SourceLine += BltInfo->SourceSurface->lDelta * (DestHeight - 1);
309  }
310 
311  DestLine = DestBits;
312 
313  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
314  {
315  SourceBits = SourceLine;
316  DestBits = DestLine;
317 
318  if (bLeftToRight)
319  {
320  /* This sets the SourceBits to the rightmost pixel */
321  SourceBits += (DestWidth - 1) * 3;
322  }
323 
324  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
325  {
326  xColor = (*(SourceBits + 2) << 0x10) +
327  (*(SourceBits + 1) << 0x08) +
328  (*(SourceBits));
329  *((PDWORD)DestBits) = (DWORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
330  DEC_OR_INC(SourceBits, bLeftToRight, 3);
331  DestBits += 4;
332  }
333 
334  DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
335  DestLine += BltInfo->DestSurface->lDelta;
336  }
337  break;
338 
339  case BMF_32BPP:
340  DPRINT("32BPP Case Selected with SourcePoint (%d,%d) and DestRect Width/height of '%d/%d' DestRect: (%d,%d)-(%d,%d).\n",
341  BltInfo->SourcePoint.x, BltInfo->SourcePoint.y, DestWidth, DestHeight,
342  BltInfo->DestRect.left, BltInfo->DestRect.top, BltInfo->DestRect.right, BltInfo->DestRect.bottom);
343 
344  if (bLeftToRight || bTopToBottom)
345  DPRINT("bLeftToRight is '%d' and bTopToBottom is '%d'.\n", bLeftToRight, bTopToBottom);
346 
347  /* This handles the negative lDelta's which represent Top-to-Bottom bitmaps */
348  if (((blDeltaSrcNeg || blDeltaDestNeg) && !(blDeltaSrcNeg && blDeltaDestNeg)) && bTopToBottom)
349  {
350  DPRINT("Adjusting for lDelta's here.\n");
351  if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
352  {
353  /* SourceBits points to top-left pixel for lDelta < 0 and bottom-left for lDelta > 0 */
354  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
355  + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
356  + 4 * BltInfo->SourcePoint.x;
357  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
358  {
359  RtlMoveMemory(DestBits, SourceBits, 4 * DestWidth);
360  SourceBits += BltInfo->SourceSurface->lDelta;
361  DestBits += BltInfo->DestSurface->lDelta;
362  }
363  }
364  else
365  {
366  /* SourceBits points to bottom-left pixel for lDelta < 0 and top-left for lDelta > 0 */
367  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
368  + ((BltInfo->SourcePoint.y
369  + DestHeight - 1) * BltInfo->SourceSurface->lDelta)
370  + 4 * BltInfo->SourcePoint.x;
371  /* SourceBits points to bottom-left pixel for lDelta < 0 and top-left for lDelta > 0 */
372  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
373  + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta)
374  + 4 * BltInfo->DestRect.left;
375  for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
376  {
377  RtlMoveMemory(DestBits, SourceBits, 4 * DestWidth);
378  SourceBits -= BltInfo->SourceSurface->lDelta;
379  DestBits -= BltInfo->DestSurface->lDelta;
380  }
381  }
382  blDeltaAdjustDone = TRUE;
383  }
384 
385  /* This tests for whether we can use simplified/quicker code below.
386  * It works for increasing source and destination areas only and there is no overlap and no flip.
387  */
388  if ((BltInfo->XlateSourceToDest == NULL ||
389  (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL) != 0) &&
390  (!bTopToBottom && !bLeftToRight))
391  {
392  DPRINT("XO_TRIVIAL is TRUE.\n");
393 
394  if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
395  {
396  /* SourceBits points to top-left pixel for lDelta < 0 and bottom-left for lDelta > 0 */
397  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
398  + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
399  + 4 * BltInfo->SourcePoint.x;
400  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
401  {
402  RtlMoveMemory(DestBits, SourceBits, 4 * DestWidth);
403  SourceBits += BltInfo->SourceSurface->lDelta;
404  DestBits += BltInfo->DestSurface->lDelta;
405  }
406  }
407  else
408  {
409  /* SourceBits points to bottom-left pixel for lDelta < 0 and top-left for lDelta > 0 */
410  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
411  + ((BltInfo->SourcePoint.y
412  + DestHeight - 1) * BltInfo->SourceSurface->lDelta)
413  + 4 * BltInfo->SourcePoint.x;
414  /* SourceBits points to bottom-left pixel for lDelta < 0 and top-left for lDelta > 0 */
415  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
416  + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta)
417  + 4 * BltInfo->DestRect.left;
418  for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
419  {
420  RtlMoveMemory(DestBits, SourceBits, 4 * DestWidth);
421  SourceBits -= BltInfo->SourceSurface->lDelta;
422  DestBits -= BltInfo->DestSurface->lDelta;
423  }
424  }
425  }
426  else
427  {
428  DPRINT("XO_TRIVIAL is NOT TRUE.\n");
429 
430  if (!bTopToBottom && !bLeftToRight)
431  {
432  if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
433  {
434  SourceBits = ((PBYTE)BltInfo->SourceSurface->pvScan0
435  + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
436  + 4 * BltInfo->SourcePoint.x);
437  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
438  {
439  if (BltInfo->DestRect.left < BltInfo->SourcePoint.x)
440  {
441  Dest32 = (DWORD *) DestBits;
442  Source32 = (DWORD *) SourceBits;
443  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
444  {
445  *Dest32++ = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32++);
446  }
447  }
448  else
449  {
450  Dest32 = (DWORD *) DestBits + (DestWidth - 1);
451  Source32 = (DWORD *) SourceBits + (DestWidth - 1);
452  for (i = BltInfo->DestRect.right - 1; BltInfo->DestRect.left <= i; i--)
453  {
454  *Dest32-- = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32--);
455  }
456  }
457  SourceBits += BltInfo->SourceSurface->lDelta;
458  DestBits += BltInfo->DestSurface->lDelta;
459  }
460  }
461  else
462  {
463  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
464  + ((BltInfo->SourcePoint.y
465  + DestHeight - 1) * BltInfo->SourceSurface->lDelta)
466  + 4 * BltInfo->SourcePoint.x;
467  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
468  + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta)
469  + 4 * BltInfo->DestRect.left;
470  for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
471  {
472  if (BltInfo->DestRect.left < BltInfo->SourcePoint.x)
473  {
474  Dest32 = (DWORD *) DestBits;
475  Source32 = (DWORD *) SourceBits;
476  for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
477  {
478  *Dest32++ = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32++);
479  }
480  }
481  else
482  {
483  Dest32 = (DWORD *) DestBits + (DestWidth - 1);
484  Source32 = (DWORD *) SourceBits + (DestWidth - 1);
485  for (i = BltInfo->DestRect.right - 1; BltInfo->DestRect.left <= i; i--)
486  {
487  *Dest32-- = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32--);
488  }
489  }
490  SourceBits -= BltInfo->SourceSurface->lDelta;
491  DestBits -= BltInfo->DestSurface->lDelta;
492  }
493  }
494  }
495  else
496  {
497  /* Buffering for source and destination flip overlaps. Fixes KHMZ MirrorTest CORE-16642 */
498  BOOL TopToBottomDone = FALSE;
499 
500  /* No need to flip a LeftToRight bitmap only one pixel wide */
501  if ((bLeftToRight) && (DestWidth > 1))
502  {
503  DPRINT("Flip is bLeftToRight.\n");
504 
505  /* Allocate enough pixels for a row in DWORD's */
507  (DestWidth + 1) * 4, TAG_DIB);
508  if (store == NULL)
509  {
510  DPRINT1("Storage Allocation Failed.\n");
511  return FALSE;
512  }
513 
514  /* This sets SourceBits to the bottom line */
515  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
516  + ((BltInfo->SourcePoint.y + DestHeight - 1)
517  * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
518 
519  /* This sets DestBits to the bottom line */
520  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
521  + (BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta
522  + 4 * BltInfo->DestRect.left;
523 
524  for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
525  {
526 
527  /* Set Dest32 to right pixel */
528  Dest32 = (DWORD *) DestBits + (DestWidth - 1);
529  Source32 = (DWORD *) SourceBits;
530 
531  Index = 0;
532 
533  /* Store pixels from left to right */
534  for (i = BltInfo->DestRect.right - 1; BltInfo->DestRect.left <= i; i--)
535  {
536  store[Index] = *Source32++;
537  Index++;
538  }
539 
540  Index = 0;
541 
542  /* Copy stored dat to pixels from right to left */
543  for (i = BltInfo->DestRect.right - 1; BltInfo->DestRect.left <= i; i--)
544  {
545  *Dest32-- = store[Index];
546  Index++;
547  }
548  SourceBits -= BltInfo->SourceSurface->lDelta;
549  DestBits -= BltInfo->DestSurface->lDelta;
550  }
551  ExFreePoolWithTag(store, TAG_DIB);
552  TopToBottomDone = TRUE;
553  }
554 
555  /* Top to Botoom Handling if bitmap more than one pixel high */
556  if ((bTopToBottom) && (DestHeight > 1))
557  {
558  /* Note: It is very important that this code remain optimized for time used.
559  * Otherwise you will have random crashes in ReactOS that are undesirable.
560  * For an example of this just try executing the code here two times.
561  */
562 
563  DPRINT("Flip is bTopToBottom.\n");
564 
565  /* Allocate enough pixels for a row in DWORD's */
567  (DestWidth + 1) * 4, TAG_DIB);
568  if (store == NULL)
569  {
570  DPRINT1("Storage Allocation Failed.\n");
571  return FALSE;
572  }
573 
574  /* This set DestBitsT to the top line */
575  DestBitsT = (PBYTE)BltInfo->DestSurface->pvScan0
576  + ((BltInfo->DestRect.top) * BltInfo->DestSurface->lDelta)
577  + 4 * BltInfo->DestRect.left;
578 
579  /* This sets DestBitsB to the bottom line */
580  DestBitsB = (PBYTE)BltInfo->DestSurface->pvScan0
581  + (BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta
582  + 4 * BltInfo->DestRect.left;
583 
584  /* The TopToBottomDone flag indicates that we are flipping for bTopToBottom and bLeftToRight
585  * and have already completed the bLeftToRight. So we will lose our first flip output
586  * unless we work with its output which is at the destination site. So in this case
587  * our new Source becomes the previous outputs Destination.
588  * Also in we use the same logic when we have corrected for negative lDelta's above
589  * and already completed a flip from Source to Destination for the first step
590  */
591 
592  if (TopToBottomDone || blDeltaAdjustDone)
593  {
594  /* This sets SourceBitsB to the bottom line */
595  SourceBitsB = DestBitsB;
596 
597  /* This sets SourceBitsT to the top line */
598  SourceBitsT = DestBitsT;
599  }
600  else
601  {
602  /* This sets SourceBitsB to the bottom line */
603  SourceBitsB = (PBYTE)BltInfo->SourceSurface->pvScan0
604  + ((BltInfo->SourcePoint.y + DestHeight - 1)
605  * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
606 
607  /* This sets SourceBitsT to the top line */
608  SourceBitsT = (PBYTE)BltInfo->SourceSurface->pvScan0
609  + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
610  }
611 
612  /* Overlaps and Vertical flips do not mix well. So we test for this and handle it
613  * by using two operations. First we just do a copy of the source to the destination.
614  * Then we do a flip in place at the destination location and we are done.
615  */
616  if ((BltInfo->SourcePoint.y != BltInfo->DestRect.top) && // The values are not equal and
617  (abs(BltInfo->SourcePoint.y - BltInfo->DestRect.top) < (DestHeight + 2)) && // they are NOT seperated by > DestHeight
618  (BltInfo->SourceSurface->pvScan0 == BltInfo->DestSurface->pvScan0)) // and same surface (probably screen)
619  {
620  DPRINT("Flips Need Adjustments, so do move here.\n");
621 
622  if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
623  {
624  /* SourceBits points to top-left pixel for lDelta < 0 and bottom-left for lDelta > 0 */
625  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
626  + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
627  + 4 * BltInfo->SourcePoint.x;
628  for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
629  {
630  RtlMoveMemory(DestBits, SourceBits, 4 * DestWidth);
631  SourceBits += BltInfo->SourceSurface->lDelta;
632  DestBits += BltInfo->DestSurface->lDelta;
633  }
634  }
635  else
636  {
637  /* SourceBits points to bottom-left pixel for lDelta < 0 and top-left for lDelta > 0 */
638  SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
639  + ((BltInfo->SourcePoint.y
640  + DestHeight - 1) * BltInfo->SourceSurface->lDelta)
641  + 4 * BltInfo->SourcePoint.x;
642  /* SourceBits points to bottom-left pixel for lDelta < 0 and top-left for lDelta > 0 */
643  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
644  + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta)
645  + 4 * BltInfo->DestRect.left;
646  for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
647  {
648  RtlMoveMemory(DestBits, SourceBits, 4 * DestWidth);
649  SourceBits -= BltInfo->SourceSurface->lDelta;
650  DestBits -= BltInfo->DestSurface->lDelta;
651  }
652  }
653 
654  /* This sets SourceBitsB to the bottom line */
655  SourceBitsB = DestBitsB;
656 
657  /* This sets SourceBitsT to the top line */
658  SourceBitsT = DestBitsT;
659  }
660 
661  /* Vertical Flip code starts here */
662  for (j = 0; j < DestHeight / 2 ; j++)
663  {
664  /* Store bottom row of Source pixels */
665  RtlMoveMemory(store, SourceBitsB, 4 * DestWidth);
666 
667  /* Copy top Source row to bottom Destination row overwriting it */
668  RtlMoveMemory(DestBitsB, SourceBitsT, 4 * DestWidth);
669 
670  /* Copy stored bottom row of Source pixels to Destination top row of pixels */
671  RtlMoveMemory(DestBitsT, store, 4 * DestWidth);
672 
673  /* Index top rows down and bottom rows up */
674  SourceBitsT += BltInfo->SourceSurface->lDelta;
675  SourceBitsB -= BltInfo->SourceSurface->lDelta;
676 
677  DestBitsT += BltInfo->DestSurface->lDelta;
678  DestBitsB -= BltInfo->DestSurface->lDelta;
679  }
680  if (DestHeight % 2)
681  {
682  /* If we had an odd number of lines we handle the center one here */
683  DPRINT("Handling Top To Bottom with Odd Number of lines.\n");
684  RtlMoveMemory(DestBitsB, SourceBitsT, 4 * DestWidth);
685  }
686  ExFreePoolWithTag(store, TAG_DIB);
687  }
688  }
689  }
690  break;
691 
692  default:
693  DPRINT1("DIB_32BPP_BitBltSrcCopy: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
694  return FALSE;
695  }
696 
697  return TRUE;
698 }
#define BMF_24BPP
Definition: winddi.h:359
#define abs(i)
Definition: fconv.c:206
#define BMF_32BPP
Definition: winddi.h:360
#define TRUE
Definition: types.h:120
unsigned char altnotmask[2]
Definition: dib.c:18
#define BitsPerFormat(Format)
Definition: surface.h:109
#define DWORD
Definition: nt_native.h:44
VOID DIB_32BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib32bpp.c:21
Definition: xlate.c:10
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
unsigned char BOOLEAN
#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
WORD * PWORD
Definition: pedump.c:67
if(!(yy_init))
Definition: macro.lex.yy.c:714
_In_ WDFCOLLECTION _In_ ULONG Index
#define DEC_OR_INC(var, decTrue, amount)
Definition: dib32bpp.c:17
#define for
Definition: utility.h:88
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
ULONG DIB_1BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib1bpp.c:30
#define XO_TRIVIAL
Definition: winddi.h:1247
#define f1(x, y, z)
Definition: sha1.c:30
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
Definition: xlate.c:8
#define NULL
Definition: types.h:112
DWORD * PDWORD
Definition: pedump.c:68
#define DPRINT1
Definition: precomp.h:8
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define DPRINT
Definition: sndvol32.h:71
BYTE * PBYTE
Definition: pedump.c:66
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
Definition: xlate.c:9
#define TAG_DIB
Definition: tags.h:17

◆ DIB_32BPP_ColorFill()

BOOLEAN DIB_32BPP_ColorFill ( SURFOBJ ,
RECTL ,
ULONG   
)

Definition at line 31 of file dib32bppc.c.

32 {
33  ULONG DestY;
34 
35  /* Make WellOrdered by making top < bottom and left < right */
36  RECTL_vMakeWellOrdered(DestRect);
37 
38  for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
39  {
40  DIB_32BPP_HLine (DestSurface, DestRect->left, DestRect->right, DestY, color);
41  }
42 
43  return TRUE;
44 }
#define TRUE
Definition: types.h:120
GLuint color
Definition: glext.h:6243
GLint GLint bottom
Definition: glext.h:7726
VOID DIB_32BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
Definition: dib32bppc.c:16
unsigned int ULONG
Definition: retypes.h:1
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81

◆ DIB_32BPP_GetPixel()

ULONG DIB_32BPP_GetPixel ( SURFOBJ ,
LONG  ,
LONG   
)

Definition at line 30 of file dib32bpp.c.

31 {
32  PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta;
33  PDWORD addr = (PDWORD)byteaddr + x;
34 
35  return (ULONG)(*addr);
36 }
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
DWORD * PDWORD
Definition: pedump.c:68
unsigned int ULONG
Definition: retypes.h:1
BYTE * PBYTE
Definition: pedump.c:66

Referenced by DIB_1BPP_BitBltSrcCopy().

◆ DIB_32BPP_HLine()

VOID DIB_32BPP_HLine ( SURFOBJ ,
LONG  ,
LONG  ,
LONG  ,
ULONG   
)

Definition at line 16 of file dib32bppc.c.

17 {
18  PBYTE byteaddr = (PBYTE)((ULONG_PTR)SurfObj->pvScan0 + y * SurfObj->lDelta);
19  PDWORD addr = (PDWORD)byteaddr + x1;
20  LONG cx = x1;
21 
22  while(cx < x2)
23  {
24  *addr = (DWORD)c;
25  ++addr;
26  ++cx;
27  }
28 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
#define DWORD
Definition: nt_native.h:44
uint32_t ULONG_PTR
Definition: typedefs.h:65
long LONG
Definition: pedump.c:60
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
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:581
BYTE * PBYTE
Definition: pedump.c:66

Referenced by DIB_32BPP_ColorFill().

◆ DIB_32BPP_PutPixel()

VOID DIB_32BPP_PutPixel ( SURFOBJ ,
LONG  ,
LONG  ,
ULONG   
)

Definition at line 21 of file dib32bpp.c.

22 {
23  PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta;
24  PDWORD addr = (PDWORD)byteaddr + x;
25 
26  *addr = c;
27 }
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
DWORD * PDWORD
Definition: pedump.c:68
#define c
Definition: ke_i.h:80
BYTE * PBYTE
Definition: pedump.c:66

Referenced by DIB_32BPP_BitBltSrcCopy().

◆ DIB_32BPP_TransparentBlt()

BOOLEAN DIB_32BPP_TransparentBlt ( SURFOBJ ,
SURFOBJ ,
RECTL ,
RECTL ,
XLATEOBJ ,
ULONG   
)

Definition at line 701 of file dib32bpp.c.

704 {
705  LONG X, Y, SourceX, SourceY = 0, wd;
706  ULONG *DestBits, Source = 0;
707 
708  LONG DstHeight;
709  LONG DstWidth;
710  LONG SrcHeight;
711  LONG SrcWidth;
712 
713  DstHeight = DestRect->bottom - DestRect->top;
714  DstWidth = DestRect->right - DestRect->left;
715  SrcHeight = SourceRect->bottom - SourceRect->top;
716  SrcWidth = SourceRect->right - SourceRect->left;
717 
718  DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 +
719  (DestRect->left << 2) +
720  DestRect->top * DestSurf->lDelta);
721  wd = DestSurf->lDelta - ((DestRect->right - DestRect->left) << 2);
722 
723  for (Y = DestRect->top; Y < DestRect->bottom; Y++)
724  {
725  SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
726  for (X = DestRect->left; X < DestRect->right; X++, DestBits++)
727  {
728  SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
729  if (SourceX >= 0 && SourceY >= 0 &&
730  SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
731  {
732  Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
733  if ((0x00FFFFFF & Source) != (0x00FFFFFF & iTransColor))
734  {
735  *DestBits = XLATEOBJ_iXlate(ColorTranslation, Source);
736  }
737  }
738  }
739 
740  DestBits = (ULONG*)((ULONG_PTR)DestBits + wd);
741  }
742 
743  return TRUE;
744 }
#define Y(I)
#define TRUE
Definition: types.h:120
_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:65
long LONG
Definition: pedump.c:60
#define DIB_GetSourceIndex(SourceSurf, sx, sy)
Definition: dib.h:141
GLint GLint bottom
Definition: glext.h:7726
GLdouble GLdouble right
Definition: glext.h:10859
unsigned int ULONG
Definition: retypes.h:1
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
BYTE * PBYTE
Definition: pedump.c:66
#define X(b, s)

◆ DIB_32BPP_VLine()

VOID DIB_32BPP_VLine ( SURFOBJ ,
LONG  ,
LONG  ,
LONG  ,
ULONG   
)

Definition at line 39 of file dib32bpp.c.

40 {
41  PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y1 * SurfObj->lDelta;
42  PDWORD addr = (PDWORD)byteaddr + x;
43  LONG lDelta = SurfObj->lDelta >> 2; // >> 2 == / sizeof(DWORD)
44 
45  byteaddr = (PBYTE)addr;
46  while (y1++ < y2)
47  {
48  *addr = (DWORD)c;
49  addr += lDelta;
50  }
51 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define DWORD
Definition: nt_native.h:44
long LONG
Definition: pedump.c:60
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
DWORD * PDWORD
Definition: pedump.c:68
BYTE * PBYTE
Definition: pedump.c:66

◆ DIB_4BPP_BitBlt()

BOOLEAN DIB_4BPP_BitBlt ( PBLTINFO  )

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 }
#define TRUE
Definition: types.h:120
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
uint32_t ULONG_PTR
Definition: typedefs.h:65
#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
unsigned char BOOLEAN
#define ROP4_USES_SOURCE(Rop4)
Definition: inteng.h:45
ULONG DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern)
Definition: dib.c:92
ULONG DIB_4BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
Definition: dib4bpp.c:26
#define ROP4_USES_PATTERN(Rop4)
Definition: inteng.h:46
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:3167
BYTE * PBYTE
Definition: pedump.c:66

◆ DIB_4BPP_BitBltSrcCopy()

BOOLEAN DIB_4BPP_BitBltSrcCopy ( PBLTINFO  )

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",
72  BltInfo->SourceSurface->sizlBitmap.cx, BltInfo->SourceSurface->sizlBitmap.cy,
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 */
83  RECTL_vMakeWellOrdered(&BltInfo->DestRect);
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  {
123  DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
124  }
125  else
126  {
127  DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
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,
164  XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
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",
361  BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
362  return FALSE;
363  }
364  return(TRUE);
365 }
#define BMF_24BPP
Definition: winddi.h:359
#define BMF_32BPP
Definition: winddi.h:360
#define DbgPrint
Definition: loader.c:25
#define TRUE
Definition: types.h:120
#define BitsPerFormat(Format)
Definition: surface.h:109
Definition: xlate.c:10
#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
unsigned char BOOLEAN
unsigned char notmask[2]
Definition: dib.c:17
#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
WORD * PWORD
Definition: pedump.c:67
#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
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
Definition: xlate.c:8
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
DWORD * PDWORD
Definition: pedump.c:68
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 &)
BYTE * PBYTE
Definition: pedump.c:66
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
Definition: xlate.c:9

◆ DIB_4BPP_ColorFill()

BOOLEAN DIB_4BPP_ColorFill ( SURFOBJ ,
RECTL ,
ULONG   
)

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 LONG
Definition: pedump.c:60
GLuint color
Definition: glext.h:6243
GLint GLint bottom
Definition: glext.h:7726
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81

◆ DIB_4BPP_GetPixel()

ULONG DIB_4BPP_GetPixel ( SURFOBJ ,
LONG  ,
LONG   
)

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 }
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

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

◆ DIB_4BPP_HLine()

VOID DIB_4BPP_HLine ( SURFOBJ ,
LONG  ,
LONG  ,
LONG  ,
ULONG   
)

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 }
_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:581
BYTE * PBYTE
Definition: pedump.c:66

Referenced by DIB_4BPP_ColorFill().

◆ DIB_4BPP_PutPixel()

VOID DIB_4BPP_PutPixel ( SURFOBJ ,
LONG  ,
LONG  ,
ULONG   
)

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 }
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

Referenced by DIB_4BPP_BitBlt(), and DIB_4BPP_BitBltSrcCopy().

◆ DIB_4BPP_TransparentBlt()

BOOLEAN DIB_4BPP_TransparentBlt ( SURFOBJ ,
SURFOBJ ,
RECTL ,
RECTL ,
XLATEOBJ ,
ULONG   
)

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 ,
LONG  ,
LONG  ,
LONG  ,
ULONG   
)

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
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

◆ DIB_8BPP_BitBlt()

BOOLEAN DIB_8BPP_BitBlt ( PBLTINFO  )

◆ DIB_8BPP_BitBltSrcCopy()

BOOLEAN DIB_8BPP_BitBltSrcCopy ( PBLTINFO  )

Definition at line 59 of file dib8bpp.c.

60 {
61  LONG i, j, sx, sy, xColor, f1;
62  PBYTE SourceBits, DestBits, SourceLine, DestLine;
63  PBYTE SourceBits_4BPP, SourceLine_4BPP;
64  BOOLEAN bTopToBottom, bLeftToRight;
65 
66  DPRINT("DIB_8BPP_BitBltSrcCopy: SrcSurf cx/cy (%d/%d), DestSuft cx/cy (%d/%d) dstRect: (%d,%d)-(%d,%d)\n",
67  BltInfo->SourceSurface->sizlBitmap.cx, BltInfo->SourceSurface->sizlBitmap.cy,
68  BltInfo->DestSurface->sizlBitmap.cx, BltInfo->DestSurface->sizlBitmap.cy,
69  BltInfo->DestRect.left, BltInfo->DestRect.top, BltInfo->DestRect.right, BltInfo->DestRect.bottom);
70 
71  /* Get back left to right flip here */
72  bLeftToRight = (BltInfo->DestRect.left > BltInfo->DestRect.right);
73 
74  /* Check for top to bottom flip needed. */
75  bTopToBottom = BltInfo->DestRect.top > BltInfo->DestRect.bottom;
76 
77  DPRINT("bTopToBottom is '%d' and bLeftToRight is '%d'.\n", bTopToBottom, bLeftToRight);
78 
79  /* Make WellOrdered by making top < bottom and left < right */
80  RECTL_vMakeWellOrdered(&BltInfo->DestRect);
81 
82  DPRINT("BPP is '%d' & BltInfo->SourcePoint.x is '%d' & BltInfo->SourcePoint.y is '%d'.\n",
83  BltInfo->SourceSurface->iBitmapFormat, BltInfo->SourcePoint.x, BltInfo->SourcePoint.y);
84 
85  DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left;
86 
87  switch(BltInfo->SourceSurface->iBitmapFormat)
88  {
89  case BMF_1BPP:
90  DPRINT("1BPP Case Selected with DestRect Width of '%d'.\n",
91  BltInfo->DestRect.right - BltInfo->DestRect.left);
92 
93  sx = BltInfo->SourcePoint.x;
94 
95  /* This sets sy to the top line */
96  sy = BltInfo->SourcePoint.y;
97