ReactOS 0.4.16-dev-1948-gd260c1d
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)

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 Dest,
SURFOBJ Source,
RECTL DestRect,
RECTL SourceRect,
CLIPOBJ ClipRegion,
XLATEOBJ ColorTranslation,
BLENDOBJ BlendObj 
)

Definition at line 857 of file dib16bpp.c.

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

◆ DIB_16BPP_BitBlt()

BOOLEAN DIB_16BPP_BitBlt ( PBLTINFO  )

◆ DIB_16BPP_BitBltSrcCopy()

BOOLEAN DIB_16BPP_BitBltSrcCopy ( PBLTINFO  BltInfo)

Definition at line 150 of file dib16bpp.c.

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

◆ DIB_16BPP_ColorFill()

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

Definition at line 679 of file dib16bpp.c.

680{
681 LONG DestY;
682
683 /* Make WellOrdered with top < bottom and left < right */
684 RECTL_vMakeWellOrdered(DestRect);
685
686#if defined(_M_IX86) && !defined(_MSC_VER)
687 /* This is about 10% faster than the generic C code below */
688 ULONG delta = DestSurface->lDelta;
689 ULONG width = (DestRect->right - DestRect->left) ;
690 PULONG pos = (PULONG) ((PBYTE)DestSurface->pvScan0 + DestRect->top * delta + (DestRect->left<<1));
691 color = (color&0xffff); /* If the color value is "abcd", put "abcdabcd" into color */
692 color += (color<<16);
693
694 for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
695 {
696 __asm__ __volatile__ (
697 "cld\n\t"
698 "mov %1,%%ebx\n\t"
699 "mov %2,%%edi\n\t"
700 "test $0x03, %%edi\n\t" /* Align to fullword boundary */
701 "jz 1f\n\t"
702 "stosw\n\t"
703 "dec %%ebx\n\t"
704 "jz 2f\n"
705 "1:\n\t"
706 "mov %%ebx,%%ecx\n\t" /* Setup count of fullwords to fill */
707 "shr $1,%%ecx\n\t"
708 "rep stosl\n\t" /* The actual fill */
709 "test $0x01, %%ebx\n\t" /* One left to do at the right side? */
710 "jz 2f\n\t"
711 "stosw\n"
712 "2:"
713 :
714 : "a" (color), "r" (width), "m" (pos)
715 : "%ecx", "%ebx", "%edi");
716 pos =(PULONG)((ULONG_PTR)pos + delta);
717 }
718#else /* _M_IX86 */
719
720 for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
721 {
722 DIB_16BPP_HLine (DestSurface, DestRect->left, DestRect->right, DestY, color);
723 }
724#endif
725 return TRUE;
726}
VOID DIB_16BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
Definition: dib16bpp.c:38
GLint GLint GLsizei width
Definition: gl.h:1546
GLuint color
Definition: glext.h:6243
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tsub %rbp, %rax\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tsub $32, %rsp\n" "\t.seh_stackalloc 32\n" "\t.seh_endprologue\n" "\tsub %rax, %rdx\n" "\tmov %rdx, %rbp\n" "\tjmp *%r8\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $32, %rsp\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")
uint32_t * PULONG
Definition: typedefs.h:59
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59

◆ DIB_16BPP_GetPixel()

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

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
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLenum const GLvoid * addr
Definition: glext.h:9621

Referenced by DIB_16BPP_AlphaBlend(), and DIB_1BPP_BitBltSrcCopy().

◆ DIB_16BPP_HLine()

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

Definition at line 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 if (x1 >= x2)
47 return;
48
49 __asm__ __volatile__ (
50 " cld\n"
51 " mov %0, %%eax\n"
52 " shl $16, %%eax\n"
53 " andl $0xffff, %0\n" /* If the pixel value is "abcd", put "abcdabcd" in %eax */
54 " or %0, %%eax\n"
55 " mov %2, %%edi\n"
56 " test $0x03, %%edi\n" /* Align to fullword boundary */
57 " jz 0f\n"
58 " stosw\n"
59 " dec %1\n"
60 " jz 1f\n"
61 "0:\n"
62 " mov %1,%%ecx\n" /* Setup count of fullwords to fill */
63 " shr $1,%%ecx\n"
64 " rep stosl\n" /* The actual fill */
65 " test $0x01, %1\n" /* One left to do at the right side? */
66 " jz 1f\n"
67 " stosw\n"
68 "1:\n"
69 : /* no output */
70 : "r"(c), "r"(Count), "m"(addr)
71 : "%eax", "%ecx", "%edi");
72#else /* _M_IX86 */
73 LONG cx = x1;
74 DWORD cc;
75
76 if (x1 >= x2)
77 return;
78
79 if (0 != (cx & 0x01))
80 {
81 *((PWORD) addr) = (WORD)c;
82 cx++;
83 addr = (PDWORD)((PWORD)(addr) + 1);
84 }
85 cc = ((c & 0xffff) << 16) | (c & 0xffff);
86 while(cx + 1 < x2)
87 {
88 *addr++ = cc;
89 cx += 2;
90 }
91 if (cx < x2)
92 {
93 *((PWORD) addr) = (WORD)c;
94 }
95#endif /* _M_IX86 */
96}
const GLubyte * c
Definition: glext.h:8905
uint32_t cc
Definition: isohybrid.c:75
int Count
Definition: noreturn.cpp:7
_Out_opt_ int * cx
Definition: commctrl.h:585
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710

Referenced by DIB_16BPP_ColorFill().

◆ DIB_16BPP_PutPixel()

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

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}

Referenced by DIB_16BPP_AlphaBlend(), and DIB_16BPP_BitBltSrcCopy().

◆ DIB_16BPP_TransparentBlt()

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

Definition at line 729 of file dib16bpp.c.

732{
733 LONG RoundedRight, X, Y, SourceX = 0, SourceY = 0, wd;
734 ULONG *DestBits, Source, Dest;
735
736 LONG DstHeight;
737 LONG DstWidth;
738 LONG SrcHeight;
739 LONG SrcWidth;
740
741 DstHeight = DestRect->bottom - DestRect->top;
742 DstWidth = DestRect->right - DestRect->left;
743 SrcHeight = SourceRect->bottom - SourceRect->top;
744 SrcWidth = SourceRect->right - SourceRect->left;
745
746 RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x1);
747 DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 +
748 (DestRect->left << 1) +
749 DestRect->top * DestSurf->lDelta);
750 wd = DestSurf->lDelta - ((DestRect->right - DestRect->left) << 1);
751
752 for(Y = DestRect->top; Y < DestRect->bottom; Y++)
753 {
754 SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
755 for(X = DestRect->left; X < RoundedRight; X += 2, DestBits++, SourceX += 2)
756 {
757 Dest = *DestBits;
758
759 SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
760 if (SourceX >= 0 && SourceY >= 0 &&
761 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
762 {
763 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
764 if(Source != iTransColor)
765 {
766 Dest &= 0xFFFF0000;
767 Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFFFF);
768 }
769 }
770
771 SourceX = SourceRect->left+(X+1 - DestRect->left) * SrcWidth / DstWidth;
772 if (SourceX >= 0 && SourceY >= 0 &&
773 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
774 {
775 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
776 if(Source != iTransColor)
777 {
778 Dest &= 0xFFFF;
779 Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) << 16);
780 }
781 }
782
783 *DestBits = Dest;
784 }
785
786 if(X < DestRect->right)
787 {
788 SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
789 if (SourceX >= 0 && SourceY >= 0 &&
790 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
791 {
792 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
793 if(Source != iTransColor)
794 {
795 *((USHORT*)DestBits) = (USHORT)XLATEOBJ_iXlate(ColorTranslation,
796 Source);
797 }
798 }
799
800 DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
801 }
802
803 DestBits = (ULONG*)((ULONG_PTR)DestBits + wd);
804 }
805
806 return TRUE;
807}
#define Y(I)
#define X(b, s)
unsigned short USHORT
Definition: pedump.c:61
#define DIB_GetSourceIndex(SourceSurf, sx, sy)
Definition: dib.h:141
_In_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_ RECTL _In_ ULONG iTransColor
Definition: winddi.h:4195

◆ DIB_16BPP_VLine()

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

Definition at line 100 of file dib16bpp.c.

101{
102#if defined(_M_IX86) && !defined(_MSC_VER)
103 asm volatile(
104 " testl %2, %2" "\n\t"
105 " jle 2f" "\n\t"
106 " movl %2, %%ecx" "\n\t"
107 " shrl $2, %2" "\n\t"
108 " andl $3, %%ecx" "\n\t"
109 " jz 1f" "\n\t"
110 "0:" "\n\t"
111 " movw %%ax, (%0)" "\n\t"
112 " addl %1, %0" "\n\t"
113 " decl %%ecx" "\n\t"
114 " jnz 0b" "\n\t"
115 " testl %2, %2" "\n\t"
116 " jz 2f" "\n\t"
117 "1:" "\n\t"
118 " movw %%ax, (%0)" "\n\t"
119 " addl %1, %0" "\n\t"
120 " movw %%ax, (%0)" "\n\t"
121 " addl %1, %0" "\n\t"
122 " movw %%ax, (%0)" "\n\t"
123 " addl %1, %0" "\n\t"
124 " movw %%ax, (%0)" "\n\t"
125 " addl %1, %0" "\n\t"
126 " decl %2" "\n\t"
127 " jnz 1b" "\n\t"
128 "2:" "\n\t"
129 : /* no output */
130 : "r"((PBYTE)SurfObj->pvScan0 + (y1 * SurfObj->lDelta) + (x * sizeof (WORD))),
131 "r"(SurfObj->lDelta), "r"(y2 - y1), "a"(c)
132 : "cc", "memory", "%ecx");
133#else
134 PBYTE byteaddr = (PBYTE)(ULONG_PTR)SurfObj->pvScan0 + y1 * SurfObj->lDelta;
135 PWORD addr = (PWORD)byteaddr + x;
136 LONG lDelta = SurfObj->lDelta;
137
138 byteaddr = (PBYTE)addr;
139 while(y1++ < y2)
140 {
141 *addr = (WORD)c;
142
143 byteaddr += lDelta;
144 addr = (PWORD)byteaddr;
145 }
146#endif
147}
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711

◆ DIB_1BPP_BitBlt()

BOOLEAN DIB_1BPP_BitBlt ( PBLTINFO  BltInfo)

Definition at line 367 of file dib1bpp.c.

368{
369 LONG DestX, DestY;
370 LONG SourceX, SourceY;
371 LONG PatternY = 0;
372 ULONG Dest, Source = 0, Pattern = 0;
373 ULONG Index;
374 BOOLEAN UsesSource;
375 BOOLEAN UsesPattern;
376 PULONG DestBits;
377 LONG RoundedRight;
378
379 UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4);
380 UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4);
381
382 RoundedRight = BltInfo->DestRect.right -
383 ((BltInfo->DestRect.right - BltInfo->DestRect.left) & 31);
384 SourceY = BltInfo->SourcePoint.y;
385
386 if (UsesPattern)
387 {
388 if (BltInfo->PatternSurface)
389 {
390 PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
391 BltInfo->PatternSurface->sizlBitmap.cy;
392 }
393 else
394 {
395 /* FIXME: Shouldn't it be expanded? */
396 if (BltInfo->Brush)
397 Pattern = BltInfo->Brush->iSolidColor;
398 }
399 }
400
401 for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
402 {
403 DestX = BltInfo->DestRect.left;
404 SourceX = BltInfo->SourcePoint.x;
405 DestBits = (PULONG)(
406 (PBYTE)BltInfo->DestSurface->pvScan0 +
407 (BltInfo->DestRect.left >> 3) +
408 DestY * BltInfo->DestSurface->lDelta);
409
410 if (DestX & 31)
411 {
412#if 0
413 /* FIXME: This case is completely untested!!! */
414
415 Dest = *((PBYTE)DestBits);
416 NoBits = 31 - (DestX & 31);
417
418 if (UsesSource)
419 {
420 Source = 0;
421 /* FIXME: This is incorrect! */
422 for (Index = 31 - NoBits; Index >= 0; Index++)
423 Source |= (DIB_GetSource(SourceSurf, SourceX + Index, SourceY, ColorTranslation) << (31 - Index));
424 }
425
426 if (BltInfo->PatternSurface)
427 {
428 Pattern = 0;
429 for (k = 31 - NoBits; k >= 0; k++)
430 Pattern |= (DIB_GetSourceIndex(PatternObj, (X + BrushOrigin.x + k) % PatternWidth, PatternY) << (31 - k));
431 }
432
433 Dest = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
434 Dest &= ~((1 << (31 - NoBits)) - 1);
435 Dest |= *((PBYTE)DestBits) & ((1 << (31 - NoBits)) - 1);
436
437 *DestBits = Dest;
438
439 DestX += NoBits;
440 SourceX += NoBits;
441#endif
442 }
443
444 for (; DestX < RoundedRight; DestX += 32, DestBits++, SourceX += 32)
445 {
446 Dest = *DestBits;
447
448 if (UsesSource)
449 {
450 Source = 0;
451 for (Index = 0; Index < 8; Index++)
452 {
453 Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index, SourceY, BltInfo->XlateSourceToDest) << (7 - Index);
454 Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 8, SourceY, BltInfo->XlateSourceToDest) << (8 + (7 - Index));
455 Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 16, SourceY, BltInfo->XlateSourceToDest) << (16 + (7 - Index));
456 Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 24, SourceY, BltInfo->XlateSourceToDest) << (24 + (7 - Index));
457 }
458 }
459
460 if (BltInfo->PatternSurface)
461 {
462 Pattern = 0;
463 for (Index = 0; Index < 8; Index++)
464 {
465 Pattern |= DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY) << (7 - Index);
466 Pattern |= DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 8) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY) << (8 + (7 - Index));
467 Pattern |= DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 16) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY) << (16 + (7 - Index));
468 Pattern |= DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 24) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY) << (24 + (7 - Index));
469 }
470 }
471
472 *DestBits = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
473 }
474
475 if (DestX < BltInfo->DestRect.right)
476 {
477 for (; DestX < BltInfo->DestRect.right; DestX++, SourceX++)
478 {
479 Dest = DIB_1BPP_GetPixel(BltInfo->DestSurface, DestX, DestY);
480
481 if (UsesSource)
482 {
483 Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
484 }
485
486 if (BltInfo->PatternSurface)
487 {
488 Pattern = DIB_GetSourceIndex(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY);
489 }
490
491 DIB_1BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xF);
492 }
493 }
494
495 SourceY++;
496 if (BltInfo->PatternSurface)
497 {
498 PatternY++;
499 PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
500 }
501 }
502
503 return TRUE;
504}
VOID DIB_1BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib1bpp.c:19
ULONG DIB_1BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
Definition: dib1bpp.c:30
#define ROP4_USES_PATTERN(Rop4)
Definition: inteng.h:46
#define ROP4_USES_SOURCE(Rop4)
Definition: inteng.h:45
int k
Definition: mpi.c:3369
POINTL BrushOrigin
Definition: dib.h:29
ROP4 Rop4
Definition: dib.h:30
SURFOBJ * PatternSurface
Definition: dib.h:24
BRUSHOBJ * Brush
Definition: dib.h:28
ULONG iSolidColor
Definition: winddi.h:234
ULONG DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern)
Definition: dib.c:92

◆ DIB_1BPP_BitBltSrcCopy()

BOOLEAN DIB_1BPP_BitBltSrcCopy ( PBLTINFO  BltInfo)

Definition at line 159 of file dib1bpp.c.

160{
161 ULONG Color;
162 LONG i, j, sx, sy;
163 BOOLEAN bTopToBottom, bLeftToRight;
164
165 // This sets sy to the top line
166 sy = BltInfo->SourcePoint.y;
167
168 DPRINT("DIB_1BPP_BitBltSrcCopy: SrcSurf cx/cy (%d/%d), DestSuft cx/cy (%d/%d) dstRect: (%d,%d)-(%d,%d)\n",
170 BltInfo->DestSurface->sizlBitmap.cx, BltInfo->DestSurface->sizlBitmap.cy,
171 BltInfo->DestRect.left, BltInfo->DestRect.top, BltInfo->DestRect.right, BltInfo->DestRect.bottom);
172
173 /* Get back left to right flip here */
174 bLeftToRight = (BltInfo->DestRect.left > BltInfo->DestRect.right);
175
176 /* Check for top to bottom flip needed. */
177 bTopToBottom = BltInfo->DestRect.top > BltInfo->DestRect.bottom;
178
179 // Make WellOrdered with top < bottom and left < right
181
182 DPRINT("BPP is '%d' & BltInfo->SourcePoint.x is '%d' & BltInfo->SourcePoint.y is '%d'.\n",
183 BltInfo->SourceSurface->iBitmapFormat, BltInfo->SourcePoint.x, BltInfo->SourcePoint.y);
184
185 switch ( BltInfo->SourceSurface->iBitmapFormat )
186 {
187 case BMF_1BPP:
188 DPRINT("1BPP Case Selected with DestRect Width of '%d'.\n",
189 BltInfo->DestRect.right - BltInfo->DestRect.left);
190
192 BltInfo->XlateSourceToDest, &BltInfo->DestRect, &BltInfo->SourcePoint,
193 bTopToBottom, bLeftToRight );
194
195 case BMF_4BPP:
196 DPRINT("4BPP Case Selected with DestRect Width of '%d'.\n",
197 BltInfo->DestRect.right - BltInfo->DestRect.left);
198
199 if (bTopToBottom)
200 {
201 // This sets sy to the bottom line
202 sy += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;
203 }
204
205 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
206 {
207 sx = BltInfo->SourcePoint.x;
208
209 if (bLeftToRight)
210 {
211 // This sets the sx to the rightmost pixel
212 sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
213 }
214
215 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
216 {
219
220 DEC_OR_INC(sx, bLeftToRight, 1);
221 }
222 DEC_OR_INC(sy, bTopToBottom, 1);
223 }
224 break;
225
226 case BMF_8BPP:
227 DPRINT("8BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
228 BltInfo->DestRect.left, BltInfo->DestRect.top,
229 BltInfo->DestRect.right, BltInfo->DestRect.bottom,
230 BltInfo->DestRect.right - BltInfo->DestRect.left);
231
232 if (bTopToBottom)
233 {
234 // This sets sy to the bottom line
235 sy += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;
236 }
237
238 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
239 {
240 sx = BltInfo->SourcePoint.x;
241
242 if (bLeftToRight)
243 {
244 // This sets sx to the rightmost pixel
245 sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
246 }
247
248 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
249 {
252
253 DEC_OR_INC(sx, bLeftToRight, 1);
254 }
255 DEC_OR_INC(sy, bTopToBottom, 1);
256 }
257 break;
258
259 case BMF_16BPP:
260 DPRINT("16BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
261 BltInfo->DestRect.left, BltInfo->DestRect.top,
262 BltInfo->DestRect.right, BltInfo->DestRect.bottom,
263 BltInfo->DestRect.right - BltInfo->DestRect.left);
264
265 if (bTopToBottom)
266 {
267 // This sets sy to the bottom line
268 sy += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;;
269 }
270
271 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
272 {
273 sx = BltInfo->SourcePoint.x;
274
275 if (bLeftToRight)
276 {
277 // This sets the sx to the rightmost pixel
278 sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
279 }
280
281 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
282 {
285 DEC_OR_INC(sx, bLeftToRight, 1);
286 }
287 DEC_OR_INC(sy, bTopToBottom, 1);
288 }
289 break;
290
291 case BMF_24BPP:
292
293 DPRINT("24BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
294 BltInfo->DestRect.left, BltInfo->DestRect.top,
295 BltInfo->DestRect.right, BltInfo->DestRect.bottom,
296 BltInfo->DestRect.right - BltInfo->DestRect.left);
297
298 if (bTopToBottom)
299 {
300 // This sets sy to the bottom line
301 sy += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;
302 }
303
304 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
305 {
306 sx = BltInfo->SourcePoint.x;
307
308 if (bLeftToRight)
309 {
310 // This sets the sx to the rightmost pixel
311 sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
312 }
313
314 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
315 {
318 DEC_OR_INC(sx, bLeftToRight, 1);
319 }
320 DEC_OR_INC(sy, bTopToBottom, 1);
321 }
322 break;
323
324 case BMF_32BPP:
325
326 DPRINT("32BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
327 BltInfo->DestRect.left, BltInfo->DestRect.top,
328 BltInfo->DestRect.right, BltInfo->DestRect.bottom,
329 BltInfo->DestRect.right - BltInfo->DestRect.left);
330
331 if (bTopToBottom)
332 {
333 // This sets sy to the bottom line
334 sy += BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1;
335 }
336
337 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
338 {
339 sx = BltInfo->SourcePoint.x;
340
341 if (bLeftToRight)
342 {
343 // This sets the sx to the rightmost pixel
344 sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
345 }
346
347 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
348 {
351 DEC_OR_INC(sx, bLeftToRight, 1);
352 }
353 DEC_OR_INC(sy, bTopToBottom, 1);
354 }
355 break;
356
357 default:
358 DbgPrint("DIB_1BPP_BitBlt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
359 return FALSE;
360 }
361
362 return TRUE;
363}
#define DEC_OR_INC(var, decTrue, amount)
Definition: dib1bpp.c:15
static BOOLEAN DIB_1BPP_BitBltSrcCopy_From1BPP(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, XLATEOBJ *pxlo, PRECTL DestRect, POINTL *SourcePoint, BOOLEAN bTopToBottom, BOOLEAN bLeftToRight)
Definition: dib1bpp.c:59
#define DbgPrint
Definition: hal.h:12
ULONG DIB_8BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib8bpp.c:29
ULONG DIB_24BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib24bpp.c:29
ULONG DIB_4BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib4bpp.c:26
ULONG DIB_16BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib16bpp.c:30
ULONG DIB_32BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib32bpp.c:30

◆ DIB_1BPP_ColorFill()

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

Definition at line 508 of file dib1bpp.c.

509{
510 LONG DestY;
511
512 /* Make WellOrdered with top < bottom and left < right */
513 RECTL_vMakeWellOrdered(DestRect);
514
515 for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
516 {
517 DIB_1BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
518 }
519 return TRUE;
520}
VOID DIB_1BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
Definition: dib1bpp.c:38

◆ DIB_1BPP_GetPixel()

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

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}
#define MASK1BPP(x)
Definition: dib.h:132

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

◆ DIB_1BPP_HLine()

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

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}

Referenced by DIB_1BPP_ColorFill(), and IntGdiCreateMaskFromRLE().

◆ DIB_1BPP_PutPixel()

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

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}

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

◆ DIB_1BPP_TransparentBlt()

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

Definition at line 524 of file dib1bpp.c.

527{
528 return FALSE;
529}

◆ DIB_1BPP_VLine()

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

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}

◆ DIB_24BPP_AlphaBlend()

BOOLEAN DIB_24BPP_AlphaBlend ( SURFOBJ Dest,
SURFOBJ Source,
RECTL DestRect,
RECTL SourceRect,
CLIPOBJ ClipRegion,
XLATEOBJ ColorTranslation,
BLENDOBJ 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}
static __inline UCHAR Clamp8(ULONG val)
Definition: dib24bpp.c:719
#define Dst
Definition: mesh.h:153
unsigned char * PUCHAR
Definition: typedefs.h:53
_In_ ULONG Rows
Definition: haltypes.h:7

◆ DIB_24BPP_BitBlt()

BOOLEAN DIB_24BPP_BitBlt ( PBLTINFO  BltInfo)

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}
uint16_t * PUSHORT
Definition: typedefs.h:56
unsigned char BYTE
Definition: xxhash.c:193

◆ DIB_24BPP_BitBltSrcCopy()

BOOLEAN DIB_24BPP_BitBltSrcCopy ( PBLTINFO  BltInfo)

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",
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 */
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 {
110 } else {
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);
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 {
354 Index++;
355 }
356 sy++;
357 }
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 {
428 Index++;
429 }
430 sx++;
431 }
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 DEC_OR_INC(var, decTrue, amount)
Definition: dib24bpp.c:17
VOID DIB_24BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib24bpp.c:21
ULONG DIB_24BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
Definition: dib24bpp.c:29

◆ DIB_24BPP_ColorFill()

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

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

◆ DIB_24BPP_GetPixel()

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

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}

Referenced by DIB_1BPP_BitBltSrcCopy(), and DIB_24BPP_BitBltSrcCopy().

◆ DIB_24BPP_HLine()

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

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

Referenced by DIB_24BPP_ColorFill().

◆ DIB_24BPP_PutPixel()

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

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}

Referenced by DIB_24BPP_BitBltSrcCopy().

◆ DIB_24BPP_TransparentBlt()

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

Definition at line 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}

◆ DIB_24BPP_VLine()

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

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}

◆ DIB_32BPP_AlphaBlend()

BOOLEAN DIB_32BPP_AlphaBlend ( SURFOBJ Dest,
SURFOBJ Source,
RECTL DestRect,
RECTL SourceRect,
CLIPOBJ ClipRegion,
XLATEOBJ ColorTranslation,
BLENDOBJ 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}
static __inline UCHAR Clamp8(ULONG val)
Definition: dib32bpp.c:757

◆ DIB_32BPP_BitBlt()

BOOLEAN DIB_32BPP_BitBlt ( PBLTINFO  )

◆ DIB_32BPP_BitBltSrcCopy()

BOOLEAN DIB_32BPP_BitBltSrcCopy ( PBLTINFO  BltInfo)

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;
62 LONG DestWidth, DestHeight;
63 BOOLEAN bTopToBottom, bLeftToRight;
64 BOOLEAN blDeltaSrcNeg, blDeltaDestNeg;
65 BOOLEAN blDeltaAdjustDone = FALSE;
66
67 DPRINT("DIB_32BPP_BitBltSrcCopy: SourcePoint (%d, %d), SourceSurface cx/cy (%d/%d), "
68 "DestSurface cx/cy (%d/%d) DestRect: (%d,%d)-(%d,%d)\n",
69 BltInfo->SourcePoint.x, BltInfo->SourcePoint.y,
71 BltInfo->DestSurface->sizlBitmap.cx, BltInfo->DestSurface->sizlBitmap.cy,
72 BltInfo->DestRect.left, BltInfo->DestRect.top, BltInfo->DestRect.right, BltInfo->DestRect.bottom);
73
74 DPRINT("BltInfo->DestSurface->lDelta is '%d' and BltInfo->SourceSurface->lDelta is '%d'.\n",
75 BltInfo->DestSurface->lDelta, BltInfo->SourceSurface->lDelta);
76
77 DPRINT("iBitmapFormat is %d and width,height is (%d,%d).\n", BltInfo->SourceSurface->iBitmapFormat,
78 BltInfo->DestRect.right - BltInfo->DestRect.left, BltInfo->DestRect.bottom - BltInfo->DestRect.top);
79
80 DPRINT("BltInfo->SourcePoint.x is '%d' and BltInfo->SourcePoint.y is '%d'.\n",
81 BltInfo->SourcePoint.x, BltInfo->SourcePoint.y);
82
83 /* Do not deal with negative numbers for these values */
84 if ((BltInfo->DestRect.left < 0) || (BltInfo->DestRect.top < 0) ||
85 (BltInfo->DestRect.right < 0) || (BltInfo->DestRect.bottom < 0))
86 return FALSE;
87
88 /* Detect negative lDelta's meaning Bottom-Up bitmaps */
89 blDeltaSrcNeg = BltInfo->SourceSurface->lDelta < 0;
90 blDeltaDestNeg = BltInfo->DestSurface->lDelta < 0;
91
92 /* Get back left to right flip here */
93 bLeftToRight = BltInfo->DestRect.left > BltInfo->DestRect.right;
94
95 /* Check for top to bottom flip needed. */
96 bTopToBottom = BltInfo->DestRect.top > BltInfo->DestRect.bottom;
97
98 DPRINT("bTopToBottom is '%d' and DestSurface->lDelta < 0 is '%d' and SourceSurface->lDelta < 0 is '%d'.\n",
99 bTopToBottom, BltInfo->DestSurface->lDelta < 0 ? 1 : 0, BltInfo->SourceSurface->lDelta < 0 ? 1 : 0);
100
101 /* Make WellOrdered with top < bottom and left < right */
103
104 DestWidth = BltInfo->DestRect.right - BltInfo->DestRect.left;
105 DestHeight = BltInfo->DestRect.bottom - BltInfo->DestRect.top;
106
107 DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
108 + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta)
109 + 4 * BltInfo->DestRect.left;
110
111 DPRINT("iBitmapFormat is %d and width,height is (%d,%d).\n", BltInfo->SourceSurface->iBitmapFormat,
112 DestWidth, DestHeight);
113
114 switch (BltInfo->SourceSurface->iBitmapFormat)
115 {
116 case BMF_1BPP:
117 DPRINT("1BPP Case Selected with DestRect Width of '%d'.\n",
118 DestWidth);
119
120 if (bLeftToRight || bTopToBottom)
121 DPRINT("bLeftToRight is '%d' and bTopToBottom is '%d'.\n", bLeftToRight, bTopToBottom);
122
123 sx = BltInfo->SourcePoint.x;
124
125 /* This sets sy to the top line */
126 sy = BltInfo->SourcePoint.y;
127
128 if (bTopToBottom)
129 {
130 /* This sets sy to the bottom line */
131 sy += BltInfo->SourceSurface->lDelta * (DestHeight - 1);
132 }
133
134 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
135 {
136 sx = BltInfo->SourcePoint.x;
137
138 if (bLeftToRight)
139 {
140 /* This sets the sx to the rightmost pixel */
141 sx += (DestWidth - 1);
142 }
143
144 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
145 {
146 if (DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
147 {
149 }
150 else
151 {
153 }
154
155 DEC_OR_INC(sx, bLeftToRight, 1);
156 }
157 DEC_OR_INC(sy, bTopToBottom, 1);
158 }
159 break;
160
161 case BMF_4BPP:
162 DPRINT("4BPP Case Selected with DestRect Width of '%d'.\n",
163 DestWidth);
164
165 if (bLeftToRight || bTopToBottom)
166 DPRINT("bLeftToRight is '%d' and bTopToBottom is '%d'.\n", bLeftToRight, bTopToBottom);
167
168 /* This sets SourceBits_4BPP to the top line */
169 SourceBits_4BPP = (PBYTE)BltInfo->SourceSurface->pvScan0
170 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
171 + (BltInfo->SourcePoint.x >> 1);
172
173 if (bTopToBottom)
174 {
175 /* This sets SourceBits_4BPP to the bottom line */
176 SourceBits_4BPP += BltInfo->SourceSurface->lDelta * (DestHeight - 1);
177 }
178
179 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
180 {
181 SourceLine_4BPP = SourceBits_4BPP;
182 sx = BltInfo->SourcePoint.x;
183
184 if (bLeftToRight)
185 {
186 /* This sets sx to the rightmost pixel */
187 sx += (DestWidth - 1);
188 }
189
190 f1 = sx & 1;
191
192 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
193 {
194 xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
195 (*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
196 DIB_32BPP_PutPixel(BltInfo->DestSurface, i, j, xColor);
197 if (f1 == 1) {
198 DEC_OR_INC(SourceLine_4BPP, bLeftToRight, 1);
199 f1 = 0;
200 } else {
201 f1 = 1;
202 }
203 DEC_OR_INC(sx, bLeftToRight, 1);
204 }
205 DEC_OR_INC(SourceBits_4BPP, bTopToBottom, BltInfo->SourceSurface->lDelta);
206 }
207 break;
208
209 case BMF_8BPP:
210 DPRINT("8BPP Case Selected with DestRect Width of '%d'.\n",
211 DestWidth);
212
213 if (bLeftToRight || bTopToBottom)
214 DPRINT("bLeftToRight is '%d' and bTopToBottom is '%d'.\n", bLeftToRight, bTopToBottom);
215
216 /* This sets SourceLine to the top line */
217 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0
218 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
219 + BltInfo->SourcePoint.x;
220 DestLine = DestBits;
221
222 if (bTopToBottom)
223 {
224 /* This sets SourceLine to the bottom line */
225 SourceLine += BltInfo->SourceSurface->lDelta * (DestHeight - 1);
226 }
227
228 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
229 {
230 SourceBits = SourceLine;
231 DestBits = DestLine;
232
233 if (bLeftToRight)
234 {
235 /* This sets the SourceBits to the rightmost pixel */
236 SourceBits += (DestWidth - 1);
237 }
238
239 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
240 {
241 xColor = *SourceBits;
242 *((PDWORD) DestBits) = (DWORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
243 DEC_OR_INC(SourceBits, bLeftToRight, 1);
244 DestBits += 4;
245 }
246 DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
247 DestLine += BltInfo->DestSurface->lDelta;
248 }
249 break;
250
251 case BMF_16BPP:
252 DPRINT("16BPP Case Selected with DestRect Width of '%d'.\n",
253 DestWidth);
254
255 if (bLeftToRight || bTopToBottom)
256 DPRINT("bLeftToRight is '%d' and bTopToBottom is '%d'.\n", bLeftToRight, bTopToBottom);
257
258 /* This sets SourceLine to the top line */
259 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0
260 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
261 + 2 * BltInfo->SourcePoint.x;
262 DestLine = DestBits;
263
264 if (bTopToBottom)
265 {
266 /* This sets SourceLine to the bottom line */
267 SourceLine += BltInfo->SourceSurface->lDelta * (DestHeight - 1);
268 }
269
270 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
271 {
272 SourceBits = SourceLine;
273 DestBits = DestLine;
274
275 if (bLeftToRight)
276 {
277 /* This sets the SourceBits to the rightmost pixel */
278 SourceBits += (DestWidth - 1) * 2;
279 }
280
281 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
282 {
283 xColor = *((PWORD) SourceBits);
284 *((PDWORD) DestBits) = (DWORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
285 DEC_OR_INC(SourceBits, bLeftToRight, 2);
286 DestBits += 4;
287 }
288
289 DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
290 DestLine += BltInfo->DestSurface->lDelta;
291 }
292 break;
293
294 case BMF_24BPP:
295 DPRINT("24BPP Case Selected with DestRect Width of '%d'.\n",
296 DestWidth);
297
298 if (bLeftToRight || bTopToBottom)
299 DPRINT("bLeftToRight is '%d' and bTopToBottom is '%d'.\n", bLeftToRight, bTopToBottom);
300
301 /* This sets SourceLine to the top line */
302 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0
303 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
304 + 3 * BltInfo->SourcePoint.x;
305
306 if (bTopToBottom)
307 {
308 /* This sets SourceLine to the bottom line */
309 SourceLine += BltInfo->SourceSurface->lDelta * (DestHeight - 1);
310 }
311
312 DestLine = DestBits;
313
314 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
315 {
316 SourceBits = SourceLine;
317 DestBits = DestLine;
318
319 if (bLeftToRight)
320 {
321 /* This sets the SourceBits to the rightmost pixel */
322 SourceBits += (DestWidth - 1) * 3;
323 }
324
325 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
326 {
327 xColor = (*(SourceBits + 2) << 0x10) +
328 (*(SourceBits + 1) << 0x08) +
329 (*(SourceBits));
330 *((PDWORD)DestBits) = (DWORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
331 DEC_OR_INC(SourceBits, bLeftToRight, 3);
332 DestBits += 4;
333 }
334
335 DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
336 DestLine += BltInfo->DestSurface->lDelta;
337 }
338 break;
339
340 case BMF_32BPP:
341 DPRINT("32BPP Case Selected with SourcePoint (%d,%d) and DestRect Width/height of '%d/%d' DestRect: (%d,%d)-(%d,%d).\n",
342 BltInfo->SourcePoint.x, BltInfo->SourcePoint.y, DestWidth, DestHeight,
343 BltInfo->DestRect.left, BltInfo->DestRect.top, BltInfo->DestRect.right, BltInfo->DestRect.bottom);
344
345 if (bLeftToRight || bTopToBottom)
346 DPRINT("bLeftToRight is '%d' and bTopToBottom is '%d'.\n", bLeftToRight, bTopToBottom);
347
348 /* This handles the negative lDelta's which represent Top-to-Bottom bitmaps */
349 if (((blDeltaSrcNeg || blDeltaDestNeg) && !(blDeltaSrcNeg && blDeltaDestNeg)) && bTopToBottom)
350 {
351 DPRINT("Adjusting for lDelta's here.\n");
352 if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
353 {
354 /* SourceBits points to top-left pixel for lDelta < 0 and bottom-left for lDelta > 0 */
355 SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
356 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
357 + 4 * BltInfo->SourcePoint.x;
358 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
359 {
360 RtlMoveMemory(DestBits, SourceBits, 4 * DestWidth);
361 SourceBits += BltInfo->SourceSurface->lDelta;
362 DestBits += BltInfo->DestSurface->lDelta;
363 }
364 }
365 else
366 {
367 /* SourceBits points to bottom-left pixel for lDelta < 0 and top-left for lDelta > 0 */
368 SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
369 + ((BltInfo->SourcePoint.y + DestHeight - 1) * BltInfo->SourceSurface->lDelta)
370 + 4 * BltInfo->SourcePoint.x;
371 /* DestBits 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 }
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 separated 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 }
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 DEC_OR_INC(var, decTrue, amount)
Definition: dib32bpp.c:17
VOID DIB_32BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib32bpp.c:21
#define abs(i)
Definition: fconv.c:206
#define DWORD
Definition: nt_native.h:44

◆ DIB_32BPP_ColorFill()

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

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}
VOID DIB_32BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
Definition: dib32bppc.c:16

◆ DIB_32BPP_GetPixel()

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

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}

Referenced by DIB_1BPP_BitBltSrcCopy().

◆ DIB_32BPP_HLine()

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

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}

Referenced by DIB_32BPP_ColorFill().

◆ DIB_32BPP_PutPixel()

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

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}

Referenced by DIB_32BPP_BitBltSrcCopy().

◆ DIB_32BPP_TransparentBlt()

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

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}

◆ DIB_32BPP_VLine()

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

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}

◆ DIB_4BPP_BitBlt()

BOOLEAN DIB_4BPP_BitBlt ( PBLTINFO  BltInfo)

Definition at line 368 of file dib4bpp.c.

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

◆ DIB_4BPP_BitBltSrcCopy()

BOOLEAN DIB_4BPP_BitBltSrcCopy ( PBLTINFO  BltInfo)

Definition at line 63 of file dib4bpp.c.

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

◆ DIB_4BPP_ColorFill()

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

Definition at line 508 of file dib4bpp.c.

509{
510 LONG DestY;
511
512 /* Make WellOrdered by making top < bottom and left < right */
513 RECTL_vMakeWellOrdered(DestRect);
514
515 for (DestY = DestRect->top; DestY < DestRect->bottom; DestY++)
516 {
517 DIB_4BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
518 }
519 return TRUE;
520}
VOID DIB_4BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
Definition: dib4bpp.c:33

◆ DIB_4BPP_GetPixel()

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

Definition at line 26 of file dib4bpp.c.

27{
28 PBYTE addr = (PBYTE)SurfObj->pvScan0 + (x>>1) + y * SurfObj->lDelta;
29 return (*addr >> ((1-(x&1))<<2)) & 0x0f;
30}

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

◆ DIB_4BPP_HLine()

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

Definition at line 33 of file dib4bpp.c.

34{
35 PBYTE addr = (PBYTE)SurfObj->pvScan0 + (x1>>1) + y * SurfObj->lDelta;
36 LONG cx = x1;
37
38 while(cx < x2)
39 {
40 *addr = (*addr & notmask[x1&1]) | (BYTE)(c << ((1-(x1&1))<<2));
41 if((++x1 & 1) == 0)
42 ++addr;
43 ++cx;
44 }
45}

Referenced by DIB_4BPP_ColorFill().

◆ DIB_4BPP_PutPixel()

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

Definition at line 19 of file dib4bpp.c.

20{
21 PBYTE addr = (PBYTE)SurfObj->pvScan0 + (x>>1) + y * SurfObj->lDelta;
22 *addr = (*addr & notmask[x&1]) | (BYTE)(c << ((1-(x&1))<<2));
23}

Referenced by DIB_4BPP_BitBlt(), and DIB_4BPP_BitBltSrcCopy().

◆ DIB_4BPP_TransparentBlt()

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

Definition at line 524 of file dib4bpp.c.

527{
528 return FALSE;
529}

◆ DIB_4BPP_VLine()

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

Definition at line 48 of file dib4bpp.c.

49{
50 PBYTE addr = SurfObj->pvScan0;
51 int lDelta = SurfObj->lDelta;
52
53 addr += (x>>1) + y1 * lDelta;
54 while(y1++ < y2)
55 {
56 *addr = (*addr & notmask[x&1]) | (BYTE)(c << ((1-(x&1))<<2));
57 addr += lDelta;
58 }
59}

◆ DIB_8BPP_BitBlt()

BOOLEAN DIB_8BPP_BitBlt ( PBLTINFO  )

◆ DIB_8BPP_BitBltSrcCopy()

BOOLEAN DIB_8BPP_BitBltSrcCopy ( PBLTINFO  BltInfo)

Definition at line 62 of file dib8bpp.c.

63{
64 LONG i, j, sx, sy, xColor, f1;
65 PBYTE SourceBits, DestBits, SourceLine, DestLine;
66 PBYTE SourceBits_4BPP, SourceLine_4BPP;
67 BOOLEAN bTopToBottom, bLeftToRight;
68
69 DPRINT("DIB_8BPP_BitBltSrcCopy: SrcSurf cx/cy (%d/%d), DestSuft cx/cy (%d/%d) dstRect: (%d,%d)-(%d,%d)\n",
71 BltInfo->DestSurface->sizlBitmap.cx, BltInfo->DestSurface->sizlBitmap.cy,
72 BltInfo->DestRect.left, BltInfo->DestRect.top, BltInfo->DestRect.right, BltInfo->DestRect.bottom);
73
74 /* Get back left to right flip here */
75 bLeftToRight = (BltInfo->DestRect.left > BltInfo->DestRect.right);
76
77 /* Check for top to bottom flip needed. */
78 bTopToBottom = BltInfo->DestRect.top > BltInfo->DestRect.bottom;
79
80 DPRINT("bTopToBottom is '%d' and bLeftToRight is '%d'.\n", bTopToBottom, bLeftToRight);
81
82 /* Make WellOrdered by making top < bottom and left < right */
84
85 DPRINT("BPP is '%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 + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left;
89
90 switch(BltInfo->SourceSurface->iBitmapFormat)
91 {
92 case BMF_1BPP:
93 DPRINT("1BPP Case Selected with DestRect Width of '%d'.\n",
94 BltInfo->DestRect.right - BltInfo->DestRect.left);
95
96 sx = BltInfo->SourcePoint.x;
97
98 /* This sets sy to the top line */
99 sy = BltInfo->SourcePoint.y;
100
101 if (bTopToBottom)
102 {
103 /* This sets sy to the bottom line */
104 sy += BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1;
105 }
106
107 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
108 {
109 sx = BltInfo->SourcePoint.x;
110
111 if (bLeftToRight)
112 {
113 /* This sets the sx to the rightmost pixel */
114 sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
115 }
116
117 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
118 {
119 if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
120 {
122 }
123 else
124 {
126 }
127 DEC_OR_INC(sx, bLeftToRight, 1);
128 }
129 DEC_OR_INC(sy, bTopToBottom, 1);
130 }
131 break;
132
133 case BMF_4BPP:
134 DPRINT("4BPP Case Selected with DestRect Width of '%d'.\n",
135 BltInfo->DestRect.right - BltInfo->DestRect.left);
136
137 /* This sets SourceBits_4BPP to the top line */
138 SourceBits_4BPP = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + (BltInfo->SourcePoint.x >> 1);
139
140 if (bTopToBottom)
141 {
142 /* This sets SourceBits_4BPP to the bottom line */
143 SourceBits_4BPP += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;
144 }
145
146 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
147 {
148 SourceLine_4BPP = SourceBits_4BPP;
149 sx = BltInfo->SourcePoint.x;
150
151 if (bLeftToRight)
152 {
153 /* This sets sx to the rightmost pixel */
154 sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
155 }
156
157 f1 = sx & 1;
158
159 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
160 {
161 xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
162 (*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
163 DIB_8BPP_PutPixel(BltInfo->DestSurface, i, j, xColor);
164 if(f1 == 1)
165 {
166 DEC_OR_INC(SourceLine_4BPP, bLeftToRight, 1);
167 f1 = 0;
168 }
169 else
170 {
171 f1 = 1;
172 }
173
174 DEC_OR_INC(sx, bLeftToRight, 1);
175 }
176 DEC_OR_INC(SourceBits_4BPP, bTopToBottom, BltInfo->SourceSurface->lDelta);
177 }
178 break;
179
180 case BMF_8BPP:
181 DPRINT("8BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
182 BltInfo->DestRect.left, BltInfo->DestRect.top,
183 BltInfo->DestRect.right, BltInfo->DestRect.bottom,
184 BltInfo->DestRect.right - BltInfo->DestRect.left);
185
186 if ((BltInfo->XlateSourceToDest == NULL ||
187 (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL) != 0) &&
188 (!bTopToBottom && !bLeftToRight))
189 {
190 if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
191 {
192 DPRINT("BltInfo->DestRect.top < BltInfo->SourcePoint.y.\n");
193 SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
194 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
195 {
196 RtlMoveMemory(DestBits, SourceBits, BltInfo->DestRect.right - BltInfo->DestRect.left);
197 SourceBits += BltInfo->SourceSurface->lDelta;
198 DestBits += BltInfo->DestSurface->lDelta;
199 }
200 }
201 else
202 {
203 DPRINT("BltInfo->DestRect.top >= BltInfo->SourcePoint.y.\n");
204 SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
205 DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left;
206 for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
207 {
208 RtlMoveMemory(DestBits, SourceBits, BltInfo->DestRect.right - BltInfo->DestRect.left);
209 SourceBits -= BltInfo->SourceSurface->lDelta;
210 DestBits -= BltInfo->DestSurface->lDelta;
211 }
212 }
213 }
214 else
215 {
216 DPRINT("XO_TRIVIAL is NOT TRUE or we have flips.\n");
217
218 if (!bTopToBottom && !bLeftToRight)
219 /* **Note: Indent is purposefully less than desired to keep reviewable differences to a minimum for PR** */
220 {
221 if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
222 {
223 DPRINT("Dest.top < SourcePoint.y.\n");
224 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
225 DestLine = DestBits;
226 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
227 {
228 SourceBits = SourceLine;
229 DestBits = DestLine;
230 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
231 {
232 *DestBits++ = (BYTE)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits++);
233 }
234 SourceLine += BltInfo->SourceSurface->lDelta;
235 DestLine += BltInfo->DestSurface->lDelta;
236 }
237 }
238 else
239 {
240 DPRINT("Dest.top >= SourcePoint.y.\n");
241 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
242 DestLine = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left;
243 for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
244 {
245 SourceBits = SourceLine;
246 DestBits = DestLine;
247 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
248 {
249 *DestBits++ = (BYTE)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits++);
250 }
251 SourceLine -= BltInfo->SourceSurface->lDelta;
252 DestLine -= BltInfo->DestSurface->lDelta;
253 }
254 }
255 }
256 else
257 {
258 /* Buffering for source and destination flip overlaps. Fixes KHMZ MirrorTest CORE-16642 */
259 BOOL OneDone = FALSE;
260
261 if (bLeftToRight)
262 {
263 DPRINT("Flip is bLeftToRight.\n");
264
265 /* Allocate enough pixels for a row in BYTE's */
267 BltInfo->DestRect.right - BltInfo->DestRect.left + 1, TAG_DIB);
268 if (store == NULL)
269 {
270 DPRINT1("Storage Allocation Failed.\n");
271 return FALSE;
272 }
273 WORD Index;
274
275 /* This sets SourceLine to the top line */
276 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
277 (BltInfo->SourcePoint.y *
278 BltInfo->SourceSurface->lDelta) +
279 BltInfo->SourcePoint.x;
280
281 /* This set the DestLine to the top line */
282 DestLine = (PBYTE)BltInfo->DestSurface->pvScan0 +
283 (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) +
284 BltInfo->DestRect.left;
285
286 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
287 {
288 SourceBits = SourceLine;
289 DestBits = DestLine;
290
291 /* This sets SourceBits to the rightmost pixel */
292 SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
293
294 Index = 0;
295
296 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
297 {
298 store[Index] = (BYTE)XLATEOBJ_iXlate(
299 BltInfo->XlateSourceToDest,
300 *SourceBits);
301 SourceBits--;
302 Index++;
303 }
304
305 Index = 0;
306
307 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
308 {
309 *DestBits = store[Index];
310 DestBits++;
311 Index++;
312 }
313
314 SourceLine += BltInfo->SourceSurface->lDelta;
315 DestLine += BltInfo->DestSurface->lDelta;
316 }
318 OneDone = TRUE;
319 }
320
321 if (bTopToBottom)
322 {
323 DPRINT("Flip is bTopToBottom.\n");
324
325 DWORD Index;
326
327 /* Allocate enough pixels for a column in BYTE's */
329 BltInfo->DestRect.bottom - BltInfo->DestRect.top + 1, TAG_DIB);
330 if (store == NULL)
331 {
332 DPRINT1("Storage Allocation Failed.\n");
333 return FALSE;
334 }
335
336 /* The OneDone flag indicates that we are flipping for bTopToBottom and bLeftToRight
337 * and have already completed the bLeftToRight. So we will lose our first flip output
338 * unless we work with its output which is at the destination site. So in this case
339 * our new Source becomes the previous outputs Destination. */
340
341 if (OneDone)
342 {
343 /* This sets SourceLine to the bottom line of our previous destination */
344 SourceLine = (PBYTE)BltInfo->DestSurface->pvScan0 +
345 (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left +
346 (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->DestSurface->lDelta;
347 }
348 else
349 {
350 /* This sets SourceLine to the bottom line */
351 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
352 ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1)
353 * BltInfo->SourceSurface->lDelta) +
354 BltInfo->SourcePoint.x;
355 }
356
357 /* This set the DestLine to the top line */
358 DestLine = (PBYTE)BltInfo->DestSurface->pvScan0 +
359 (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) +
360 BltInfo->DestRect.left;
361
362 /* Read columns */
363 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
364 {
365
366 DestBits = DestLine;
367 SourceBits = SourceLine;
368
369 Index = 0;
370
371 /* Read up the column and store the pixels */
372 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
373 {
374 store[Index] = (BYTE)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits);
375 /* Go up a line */
376 SourceBits -= BltInfo->SourceSurface->lDelta;
377 Index++;
378 }
379
380 Index = 0;
381
382 /* Get the stored pixel and copy then down the column */
383 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
384 {
385 *DestBits = store[Index];
386 /* Go down a line */
387 DestBits += BltInfo->SourceSurface->lDelta;
388 Index++;
389 }
390 /* Index to next column */
391 SourceLine += 1;
392 DestLine += 1;
393 }
395 }
396
397 }
398 }
399 break;
400
401 case BMF_16BPP:
402 DPRINT("16BPP Case Selected with DestRect Width of '%d'.\n",
403 BltInfo->DestRect.right - BltInfo->DestRect.left);
404
405 DPRINT("BMF_16BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
406 BltInfo->DestRect.left, BltInfo->DestRect.top,
407 BltInfo->DestRect.right, BltInfo->DestRect.bottom,
408 BltInfo->DestRect.right - BltInfo->DestRect.left);
409
410 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x;
411
412 if (bTopToBottom)
413 {
414 /* This sets SourceLine to the bottom line */
415 SourceLine += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;;
416 }
417 DestLine = DestBits;
418
419 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
420 {
421 SourceBits = SourceLine;
422
423 if (bLeftToRight)
424 {
425 /* This sets SourceBits to the rightmost pixel */
426 SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1) * 2;
427 }
428 DestBits = DestLine;
429
430 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
431 {
432 xColor = *((PWORD) SourceBits);
433 *DestBits = (BYTE)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
434
435 DEC_OR_INC(SourceBits, bLeftToRight, 2);
436 DestBits += 1;
437 }
438 DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
439 DestLine += BltInfo->DestSurface->lDelta;
440 }
441 break;
442
443 case BMF_24BPP:
444 DPRINT("24BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
445 BltInfo->DestRect.left, BltInfo->DestRect.top,
446 BltInfo->DestRect.right, BltInfo->DestRect.bottom,
447 BltInfo->DestRect.right - BltInfo->DestRect.left);
448
449 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x;
450 DestLine = DestBits;
451
452 if (bTopToBottom)
453 {
454 /* This sets SourceLine to the bottom line */
455 SourceLine += BltInfo->SourceSurface->lDelta * (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1);
456 }
457
458 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
459 {
460 SourceBits = SourceLine;
461 DestBits = DestLine;
462
463 if (bLeftToRight)
464 {
465 /* This sets the SourceBits to the rightmost pixel */
466 SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1) * 3;
467 }
468
469 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
470 {
471 xColor = (*(SourceBits + 2) << 0x10) +
472 (*(SourceBits + 1) << 0x08) +
473 (*(SourceBits));
474 *DestBits = (BYTE)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
475 DEC_OR_INC(SourceBits, bLeftToRight, 3);
476 DestBits += 1;
477 }
478 DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
479 DestLine += BltInfo->DestSurface->lDelta;
480 }
481 break;
482
483 case BMF_32BPP:
484 DPRINT("32BPP Case Selected with DestRect Width of '%d'.\n",
485 BltInfo->DestRect.right - BltInfo->DestRect.left);
486
487 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
488
489 if (bTopToBottom)
490 {
491 /* This sets SourceLine to the bottom line */
492 SourceLine += BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1;
493 }
494 DestLine = DestBits;
495
496 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
497 {
498 SourceBits = SourceLine;
499 DestBits = DestLine;
500
501 if (bLeftToRight)
502 {
503 /* This sets SourceBits to the rightmost pixel */
504 SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1) * 4;
505 }
506
507 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
508 {
509 xColor = *((PDWORD) SourceBits);
510 *DestBits = (BYTE)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
511
512 DEC_OR_INC(SourceBits, bLeftToRight, 4);
513 DestBits += 1;
514 }
515 DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
516 DestLine += BltInfo->DestSurface->lDelta;
517 }
518 break;
519
520 default:
521 DPRINT1("DIB_8BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
522 return FALSE;
523 }
524
525 return TRUE;
526}
#define DEC_OR_INC(var, decTrue, amount)
Definition: dib8bpp.c:17
VOID DIB_8BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib8bpp.c:21

◆ DIB_8BPP_ColorFill()

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

Definition at line 530 of file dib8bpp.c.

531{
532 LONG DestY;
533
534 /* Make WellOrdered by making top < bottom and left < right */
535 RECTL_vMakeWellOrdered(DestRect);
536
537 for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
538 {
539 DIB_8BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
540 }
541 return TRUE;
542}
VOID DIB_8BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
Definition: dib8bpp.c:37

◆ DIB_8BPP_GetPixel()

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

Definition at line 29 of file dib8bpp.c.

30{
31 PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + x;
32
33 return (ULONG)(*byteaddr);
34}
return
Definition: dirsup.c:529

Referenced by DIB_1BPP_BitBltSrcCopy().

◆ DIB_8BPP_HLine()

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

Definition at line 37 of file dib8bpp.c.

38{
39 if (x1 >= x2)
40 return;
41
42 memset((PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + x1, (BYTE) c, x2 - x1);
43}
#define memset(x, y, z)
Definition: compat.h:39

Referenced by DIB_8BPP_ColorFill().

◆ DIB_8BPP_PutPixel()

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

Definition at line 21 of file dib8bpp.c.

22{
23 PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + x;
24
25 *byteaddr = (BYTE)c;
26}

Referenced by DIB_8BPP_BitBltSrcCopy().

◆ DIB_8BPP_TransparentBlt()

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

Definition at line 546 of file dib8bpp.c.

549{
550 LONG RoundedRight, X, Y, SourceX = 0, SourceY = 0;
551 ULONG *DestBits, Source, Dest;
552
553 LONG DstHeight;
554 LONG DstWidth;
555 LONG SrcHeight;
556 LONG SrcWidth;
557
558 DstHeight = DestRect->bottom - DestRect->top;
559 DstWidth = DestRect->right - DestRect->left;
560 SrcHeight = SourceRect->bottom - SourceRect->top;
561 SrcWidth = SourceRect->right - SourceRect->left;
562
563 RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x3);
564 DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 + DestRect->left +
565 (DestRect->top * DestSurf->lDelta));
566
567 for(Y = DestRect->top; Y < DestRect->bottom; Y++)
568 {
569 DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 + DestRect->left +
570 (Y * DestSurf->lDelta));
571 SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
572 for (X = DestRect->left; X < RoundedRight; X += 4, DestBits++)
573 {
574 Dest = *DestBits;
575
576 SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
577 if (SourceX >= 0 && SourceY >= 0 &&
578 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
579 {
580 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
581 if(Source != iTransColor)
582 {
583 Dest &= 0xFFFFFF00;
584 Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFF);
585 }
586 }
587
588 SourceX = SourceRect->left+(X+1 - DestRect->left) * SrcWidth / DstWidth;
589 if (SourceX >= 0 && SourceY >= 0 &&
590 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
591 {
592 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
593 if(Source != iTransColor)
594 {
595 Dest &= 0xFFFF00FF;
596 Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 8) & 0xFF00);
597 }
598 }
599
600 SourceX = SourceRect->left+(X+2 - DestRect->left) * SrcWidth / DstWidth;
601 if (SourceX >= 0 && SourceY >= 0 &&
602 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
603 {
604 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
605 if(Source != iTransColor)
606 {
607 Dest &= 0xFF00FFFF;
608 Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 16) & 0xFF0000);
609 }
610 }
611
612 SourceX = SourceRect->left+(X+3 - DestRect->left) * SrcWidth / DstWidth;
613 if (SourceX >= 0 && SourceY >= 0 &&
614 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
615 {
616 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
617 if(Source != iTransColor)
618 {
619 Dest &= 0x00FFFFFF;
620 Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 24) & 0xFF000000);
621 }
622 }
623
624 *DestBits = Dest;
625 }
626
627 if(X < DestRect->right)
628 {
629 for (; X < DestRect->right; X++)
630 {
631 SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
632 if (SourceX >= 0 && SourceY >= 0 &&
633 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
634 {
635 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
636 if(Source != iTransColor)
637 {
638 *((BYTE*)DestBits) = (BYTE)(XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFF);
639 }
640 }
641 DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
642 }
643 }
644 }
645
646 return TRUE;
647}

◆ DIB_8BPP_VLine()

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

Definition at line 46 of file dib8bpp.c.

47{
48 PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y1 * SurfObj->lDelta;
49 PBYTE addr = byteaddr + x;
50 LONG lDelta = SurfObj->lDelta;
51
52 byteaddr = addr;
53 while(y1++ < y2)
54 {
55 *addr = (BYTE)c;
56
57 addr += lDelta;
58 }
59}

◆ DIB_DoRop()

ULONG DIB_DoRop ( ULONG  Rop,
ULONG  Dest,
ULONG  Source,
ULONG  Pattern 
)

Definition at line 92 of file dib.c.

93{
94 ULONG ResultNibble;
95 ULONG Result = 0;
96 ULONG i;
97static const ULONG ExpandDest[16] =
98 {
99 0x55555555 /* 0000 */,
100 0x555555AA /* 0001 */,
101 0x5555AA55 /* 0010 */,
102 0x5555AAAA /* 0011 */,
103 0x55AA5555 /* 0100 */,
104 0x55AA55AA /* 0101 */,
105 0x55AAAA55 /* 0110 */,
106 0x55AAAAAA /* 0111 */,
107 0xAA555555 /* 1000 */,
108 0xAA5555AA /* 1001 */,
109 0xAA55AA55 /* 1010 */,
110 0xAA55AAAA /* 1011 */,
111 0xAAAA5555 /* 1100 */,
112 0xAAAA55AA /* 1101 */,
113 0xAAAAAA55 /* 1110 */,
114 0xAAAAAAAA /* 1111 */,
115 };
116 static const ULONG ExpandSource[16] =
117 {
118 0x33333333 /* 0000 */,
119 0x333333CC /* 0001 */,
120 0x3333CC33 /* 0010 */,
121 0x3333CCCC /* 0011 */,
122 0x33CC3333 /* 0100 */,
123 0x33CC33CC /* 0101 */,
124 0x33CCCC33 /* 0110 */,
125 0x33CCCCCC /* 0111 */,
126 0xCC333333 /* 1000 */,
127 0xCC3333CC /* 1001 */,
128 0xCC33CC33 /* 1010 */,
129 0xCC33CCCC /* 1011 */,
130 0xCCCC3333 /* 1100 */,
131 0xCCCC33CC /* 1101 */,
132 0xCCCCCC33 /* 1110 */,
133 0xCCCCCCCC /* 1111 */,
134 };
135 static const ULONG ExpandPattern[16] =
136 {
137 0x0F0F0F0F /* 0000 */,
138 0x0F0F0FF0 /* 0001 */,
139 0x0F0FF00F /* 0010 */,
140 0x0F0FF0F0 /* 0011 */,
141 0x0FF00F0F /* 0100 */,
142 0x0FF00FF0 /* 0101 */,
143 0x0FF0F00F /* 0110 */,
144 0x0FF0F0F0 /* 0111 */,
145 0xF00F0F0F /* 1000 */,
146 0xF00F0FF0 /* 1001 */,
147 0xF00FF00F /* 1010 */,
148 0xF00FF0F0 /* 1011 */,
149 0xF0F00F0F /* 1100 */,
150 0xF0F00FF0 /* 1101 */,
151 0xF0F0F00F /* 1110 */,
152 0xF0F0F0F0 /* 1111 */,
153 };
154
155 Rop &=0xFF;
156 switch(Rop)
157 {
158
159 /* Optimized code for the various named rop codes. */
160 case R3_OPINDEX_NOOP: return(Dest);
161 case R3_OPINDEX_BLACKNESS: return(0);
162 case R3_OPINDEX_NOTSRCERASE: return(~(Dest | Source));
163 case R3_OPINDEX_NOTSRCCOPY: return(~Source);
164 case R3_OPINDEX_SRCERASE: return((~Dest) & Source);
165 case R3_OPINDEX_DSTINVERT: return(~Dest);
166 case R3_OPINDEX_PATINVERT: return(Dest ^ Pattern);
167 case R3_OPINDEX_SRCINVERT: return(Dest ^ Source);
168 case R3_OPINDEX_SRCAND: return(Dest & Source);
169 case R3_OPINDEX_MERGEPAINT: return(Dest | (~Source));
170 case R3_OPINDEX_SRCPAINT: return(Dest | Source);
171 case R3_OPINDEX_MERGECOPY: return(Source & Pattern);
172 case R3_OPINDEX_SRCCOPY: return(Source);
173 case R3_OPINDEX_PATCOPY: return(Pattern);
174 case R3_OPINDEX_PATPAINT: return(Dest | (~Source) | Pattern);
175 case R3_OPINDEX_WHITENESS: return(0xFFFFFFFF);
176 }
177
178 /* Expand the ROP operation to all four bytes */
179 Rop |= (Rop << 24) | (Rop << 16) | (Rop << 8);
180 /* Do the operation on four bits simultaneously. */
181 Result = 0;
182 for (i = 0; i < 8; i++)
183 {
184 ResultNibble = Rop & ExpandDest[Dest & 0xF] & ExpandSource[Source & 0xF] & ExpandPattern[Pattern & 0xF];
185 Result |= (((ResultNibble & 0xFF000000) ? 0x8 : 0x0) | ((ResultNibble & 0x00FF0000) ? 0x4 : 0x0) |
186 ((ResultNibble & 0x0000FF00) ? 0x2 : 0x0) | ((ResultNibble & 0x000000FF) ? 0x1 : 0x0)) << (i * 4);
187 Dest >>= 4;
188 Source >>= 4;
189 Pattern >>= 4;
190 }
191 return(Result);
192}
#define R3_OPINDEX_SRCCOPY
Definition: bitblt.h:27
#define R3_OPINDEX_NOOP
Definition: bitblt.h:28
@ R3_OPINDEX_PATINVERT
Definition: inteng.h:28
@ R3_OPINDEX_MERGEPAINT
Definition: inteng.h:31
@ R3_OPINDEX_NOTSRCCOPY
Definition: inteng.h:25
@ R3_OPINDEX_WHITENESS
Definition: inteng.h:37
@ R3_OPINDEX_BLACKNESS
Definition: inteng.h:23
@ R3_OPINDEX_PATCOPY
Definition: inteng.h:35
@ R3_OPINDEX_SRCPAINT
Definition: inteng.h:34
@ R3_OPINDEX_DSTINVERT
Definition: inteng.h:27
@ R3_OPINDEX_SRCERASE
Definition: inteng.h:26
@ R3_OPINDEX_MERGECOPY
Definition: inteng.h:32
@ R3_OPINDEX_SRCAND
Definition: inteng.h:30
@ R3_OPINDEX_NOTSRCERASE
Definition: inteng.h:24
@ R3_OPINDEX_SRCINVERT
Definition: inteng.h:29
@ R3_OPINDEX_PATPAINT
Definition: inteng.h:36
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by BltMask(), DIB_1BPP_BitBlt(), DIB_24BPP_BitBlt(), DIB_4BPP_BitBlt(), and DIB_XXBPP_StretchBlt().

◆ DIB_XXBPP_AlphaBlend()

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

Definition at line 33 of file alphablend.c.

36{
37 INT DstX, DstY, SrcX, SrcY;
39 register NICEPIXEL32 DstPixel32;
40 register NICEPIXEL32 SrcPixel32;
41 UCHAR Alpha, SrcBpp = BitsPerFormat(Source->iBitmapFormat);
42 EXLATEOBJ* pexlo;
43 EXLATEOBJ exloSrcRGB, exloDstRGB, exloRGBSrc;
45
46 DPRINT("DIB_XXBPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
47 SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
48 DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
49
50 BlendFunc = BlendObj->BlendFunction;
52 {
53 DPRINT1("BlendOp != AC_SRC_OVER\n");
54 return FALSE;
55 }
56 if (BlendFunc.BlendFlags != 0)
57 {
58 DPRINT1("BlendFlags != 0\n");
59 return FALSE;
60 }
62 {
63 DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat);
64 return FALSE;
65 }
66 if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 &&
67 SrcBpp != 32)
68 {
69 DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n");
70 return FALSE;
71 }
72
73 if (!ColorTranslation)
74 {
75 DPRINT1("ColorTranslation must not be NULL!\n");
76 return FALSE;
77 }
78
79 pexlo = CONTAINING_RECORD(ColorTranslation, EXLATEOBJ, xlo);
80 EXLATEOBJ_vInitialize(&exloSrcRGB, pexlo->ppalSrc, &gpalRGB, 0, 0, 0);
81 EXLATEOBJ_vInitialize(&exloDstRGB, pexlo->ppalDst, &gpalRGB, 0, 0, 0);
82 EXLATEOBJ_vInitialize(&exloRGBSrc, &gpalRGB, pexlo->ppalSrc, 0, 0, 0);
83
84 SrcY = SourceRect->top;
85 DstY = DestRect->top;
86 while ( DstY < DestRect->bottom )
87 {
88 SrcX = SourceRect->left;
89 DstX = DestRect->left;
90 while(DstX < DestRect->right)
91 {
92 SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo);
93 SrcPixel32.col.red = (SrcPixel32.col.red * BlendFunc.SourceConstantAlpha) / 255;
94 SrcPixel32.col.green = (SrcPixel32.col.green * BlendFunc.SourceConstantAlpha) / 255;
95 SrcPixel32.col.blue = (SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha) / 255;
96
97 Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
98 (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha) / 255 :
100
101 DstPixel32.ul = DIB_GetSource(Dest, DstX, DstY, &exloDstRGB.xlo);
102 DstPixel32.col.red = Clamp8((DstPixel32.col.red * (255 - Alpha)) / 255 + SrcPixel32.col.red) ;
103 DstPixel32.col.green = Clamp8((DstPixel32.col.green * (255 - Alpha)) / 255 + SrcPixel32.col.green) ;
104 DstPixel32.col.blue = Clamp8((DstPixel32.col.blue * (255 - Alpha)) / 255 + SrcPixel32.col.blue) ;
105 DstPixel32.ul = XLATEOBJ_iXlate(&exloRGBSrc.xlo, DstPixel32.ul);
106 pfnDibPutPixel(Dest, DstX, DstY, XLATEOBJ_iXlate(ColorTranslation, DstPixel32.ul));
107
108 DstX++;
109 SrcX = SourceRect->left + ((DstX-DestRect->left)*(SourceRect->right - SourceRect->left))
110 /(DestRect->right-DestRect->left);
111 }
112 DstY++;
113 SrcY = SourceRect->top + ((DstY-DestRect->top)*(SourceRect->bottom - SourceRect->top))
114 /(DestRect->bottom-DestRect->top);
115 }
116
117 EXLATEOBJ_vCleanup(&exloDstRGB);
118 EXLATEOBJ_vCleanup(&exloRGBSrc);
119 EXLATEOBJ_vCleanup(&exloSrcRGB);
120
121 return TRUE;
122}
PFN_DIB_PutPixel DIB_PutPixel
Definition: dib.h:45
static __inline UCHAR Clamp8(ULONG val)
Definition: alphablend.c:27
DIB_FUNCTIONS DibFunctionsForBitmapFormat[]
Definition: dib.c:20
VOID(* PFN_DIB_PutPixel)(SURFOBJ *, LONG, LONG, ULONG)
Definition: dib.h:33

◆ DIB_XXBPP_FloodFillSolid()

BOOLEAN DIB_XXBPP_FloodFillSolid ( SURFOBJ DstSurf,
BRUSHOBJ Brush,
RECTL DstRect,
POINTL Origin,
ULONG  ConvColor,
UINT  FillType 
)

Definition at line 86 of file floodfill.c.

92{
93 ULONG x, y;
94 ULONG BrushColor;
95 FLOODINFO flood = {0, NULL, NULL};
96
97 BrushColor = Brush->iSolidColor;
98 x = Origin->x;
99 y = Origin->y;
100
101 if (FillType == FLOODFILLBORDER)
102 {
103 /* Check if the start pixel has the border color */
104 if (DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_GetPixel(DstSurf, x, y) == ConvColor)
105 {
106 return FALSE;
107 }
108
109 if (initFlood(&flood, DstRect) == FALSE)
110 {
111 return FALSE;
112 }
113 addItemFlood(&flood, x, y, DstSurf, DstRect, ConvColor, FALSE);
114 while (flood.floodLen != 0)
115 {
116 x = flood.floodStart->x;
117 y = flood.floodStart->y;
118 removeItemFlood(&flood);
119
120 DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_PutPixel(DstSurf, x, y, BrushColor);
121 if (flood.floodStart - 4 < flood.floodData)
122 {
123 DPRINT1("Can't finish flooding!\n");
124 finalizeFlood(&flood);
125 return FALSE;
126 }
127 addItemFlood(&flood, x, y + 1, DstSurf, DstRect, ConvColor, FALSE);
128 addItemFlood(&flood, x, y - 1, DstSurf, DstRect, ConvColor, FALSE);
129 addItemFlood(&flood, x + 1, y, DstSurf, DstRect, ConvColor, FALSE);
130 addItemFlood(&flood, x - 1, y, DstSurf, DstRect, ConvColor, FALSE);
131 }
132 finalizeFlood(&flood);
133 }
134 else if (FillType == FLOODFILLSURFACE)
135 {
136 /* Check if the start pixel has the surface color */
137 if (DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_GetPixel(DstSurf, x, y) != ConvColor)
138 {
139 return FALSE;
140 }
141
142 if (initFlood(&flood, DstRect) == FALSE)
143 {
144 return FALSE;
145 }
146 addItemFlood(&flood, x, y, DstSurf, DstRect, ConvColor, TRUE);
147 while (flood.floodLen != 0)
148 {
149 x = flood.floodStart->x;
150 y = flood.floodStart->y;
151 removeItemFlood(&flood);
152
153 DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_PutPixel(DstSurf, x, y, BrushColor);
154 if (flood.floodStart - 4 < flood.floodData)
155 {
156 DPRINT1("Can't finish flooding!\n");
157 finalizeFlood(&flood);
158 return FALSE;
159 }
160 addItemFlood(&flood, x, y + 1, DstSurf, DstRect, ConvColor, TRUE);
161 addItemFlood(&flood, x, y - 1, DstSurf, DstRect, ConvColor, TRUE);
162 addItemFlood(&flood, x + 1, y, DstSurf, DstRect, ConvColor, TRUE);
163 addItemFlood(&flood, x - 1, y, DstSurf, DstRect, ConvColor, TRUE);
164 }
165 finalizeFlood(&flood);
166 }
167 else
168 {
169 DPRINT1("Unsupported FloodFill type!\n");
170 return FALSE;
171 }
172 return TRUE;
173}
static __inline VOID removeItemFlood(FLOODINFO *info)
Definition: floodfill.c:80
static __inline VOID addItemFlood(FLOODINFO *info, ULONG x, ULONG y, SURFOBJ *DstSurf, RECTL *DstRect, ULONG Color, BOOL isSurf)
Definition: floodfill.c:54
static __inline VOID finalizeFlood(FLOODINFO *info)
Definition: floodfill.c:50
static __inline BOOL initFlood(FLOODINFO *info, RECTL *DstRect)
Definition: floodfill.c:37
PFN_DIB_GetPixel DIB_GetPixel
Definition: dib.h:46
FLOODITEM * floodData
Definition: floodfill.c:34
ULONG floodLen
Definition: floodfill.c:32
FLOODITEM * floodStart
Definition: floodfill.c:33
ULONG x
Definition: floodfill.c:26
ULONG y
Definition: floodfill.c:27
#define FLOODFILLBORDER
Definition: wingdi.h:644
#define FLOODFILLSURFACE
Definition: wingdi.h:645

Referenced by NtGdiExtFloodFill().

◆ DIB_XXBPP_StretchBlt()

BOOLEAN DIB_XXBPP_StretchBlt ( SURFOBJ DestSurf,
SURFOBJ SourceSurf,
SURFOBJ MaskSurf,
SURFOBJ PatternSurface,
RECTL DestRect,
RECTL SourceRect,
POINTL MaskOrigin,
BRUSHOBJ Brush,
POINTL BrushOrigin,
XLATEOBJ ColorTranslation,
ROP4  ROP 
)

Definition at line 17 of file stretchblt.c.

23{
24 LONG sx = 0;
25 LONG sy = 0;
26 LONG DesX;
27 LONG DesY;
28
29 LONG DstHeight;
30 LONG DstWidth;
31 LONG SrcHeight;
32 LONG SrcWidth;
33 LONG MaskCy;
34 LONG SourceCy;
35
37 ULONG Dest, Source = 0, Pattern = 0;
38 ULONG xxBPPMask;
39 BOOLEAN CanDraw;
40
41 PFN_DIB_GetPixel fnSource_GetPixel = NULL;
42 PFN_DIB_GetPixel fnDest_GetPixel = NULL;
43 PFN_DIB_PutPixel fnDest_PutPixel = NULL;
44 PFN_DIB_GetPixel fnPattern_GetPixel = NULL;
45 PFN_DIB_GetPixel fnMask_GetPixel = NULL;
46
47 LONG PatternX = 0, PatternY = 0;
48
49 BOOL UsesSource = ROP4_USES_SOURCE(ROP);
50 BOOL UsesPattern = ROP4_USES_PATTERN(ROP);
51 BOOLEAN bTopToBottom, bLeftToRight;
52
54
55 fnDest_GetPixel = DibFunctionsForBitmapFormat[DestSurf->iBitmapFormat].DIB_GetPixel;
56 fnDest_PutPixel = DibFunctionsForBitmapFormat[DestSurf->iBitmapFormat].DIB_PutPixel;
57
58 DPRINT("Dest BPP: %u, DestRect: (%d,%d)-(%d,%d)\n",
59 BitsPerFormat(DestSurf->iBitmapFormat), DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
60
61 DstHeight = DestRect->bottom - DestRect->top;
62 DstWidth = DestRect->right - DestRect->left;
63 SrcHeight = SourceRect->bottom - SourceRect->top;
64 SrcWidth = SourceRect->right - SourceRect->left;
65
66 /* Here we do the tests and set our conditions */
67 if (((SrcWidth < 0) && (DstWidth < 0)) || ((SrcWidth >= 0) && (DstWidth >= 0)))
68 bLeftToRight = FALSE;
69 else
70 bLeftToRight = TRUE;
71
72 if (((SrcHeight < 0) && (DstHeight < 0)) || ((SrcHeight >= 0) && (DstHeight >= 0)))
73 bTopToBottom = FALSE;
74 else
75 bTopToBottom = TRUE;
76
77 /* Make Well Ordered to start */
78 RECTL_vMakeWellOrdered(DestRect);
79
80 if (UsesSource)
81 {
82 SourceCy = SourceSurf->sizlBitmap.cy;
83 fnSource_GetPixel = DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat].DIB_GetPixel;
84 DPRINT("Source BPP: %u, SourceRect: (%d,%d)-(%d,%d)\n",
85 BitsPerFormat(SourceSurf->iBitmapFormat), SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom);
86 }
87
88 if (MaskSurf)
89 {
90 DPRINT("MaskSurf is not NULL.\n");
91 fnMask_GetPixel = DibFunctionsForBitmapFormat[MaskSurf->iBitmapFormat].DIB_GetPixel;
92 MaskCy = MaskSurf->sizlBitmap.cy;
93 }
94
95 DstHeight = DestRect->bottom - DestRect->top;
96 DstWidth = DestRect->right - DestRect->left;
97 SrcHeight = SourceRect->bottom - SourceRect->top;
98 SrcWidth = SourceRect->right - SourceRect->left;
99
100 /* FIXME: MaskOrigin? */
101
102 switch(DestSurf->iBitmapFormat)
103 {
104 case BMF_1BPP: xxBPPMask = 0x1; break;
105 case BMF_4BPP: xxBPPMask = 0xF; break;
106 case BMF_8BPP: xxBPPMask = 0xFF; break;
107 case BMF_16BPP: xxBPPMask = 0xFFFF; break;
108 case BMF_24BPP: xxBPPMask = 0xFFFFFF; break;
109 default:
110 xxBPPMask = 0xFFFFFFFF;
111 }
112 DPRINT("xxBPPMask is 0x%x.\n", xxBPPMask);
113
114 if (UsesPattern)
115 {
116 DPRINT("UsesPattern is not NULL.\n");
117 if (PatternSurface)
118 {
119 PatternY = (DestRect->top - BrushOrigin->y) % PatternSurface->sizlBitmap.cy;
120 if (PatternY < 0)
121 {
122 PatternY += PatternSurface->sizlBitmap.cy;
123 }
124 fnPattern_GetPixel = DibFunctionsForBitmapFormat[PatternSurface->iBitmapFormat].DIB_GetPixel;
125 }
126 else
127 {
128 if (Brush)
129 Pattern = Brush->iSolidColor;
130 }
131 }
132
133 if (PatternSurface)
134 {
135 DPRINT("PatternSurface is not NULL.\n");
136 }
137
138 DPRINT("bLeftToRight is '%d' and bTopToBottom is '%d'.\n", bLeftToRight, bTopToBottom);
139
140 for (DesY = DestRect->top; DesY < DestRect->bottom; DesY++)
141 {
142 if (PatternSurface)
143 {
144 PatternX = (DestRect->left - BrushOrigin->x) % PatternSurface->sizlBitmap.cx;
145 if (PatternX < 0)
146 {
147 PatternX += PatternSurface->sizlBitmap.cx;
148 }
149 }
150 if (UsesSource)
151 {
152 if (bTopToBottom)
153 {
154 sy = SourceRect->bottom-(DesY - DestRect->top) * SrcHeight / DstHeight; // flips about the x-axis
155 }
156 else
157 {
158 sy = SourceRect->top+(DesY - DestRect->top) * SrcHeight / DstHeight;
159 }
160 }
161
162 for (DesX = DestRect->left; DesX < DestRect->right; DesX++)
163 {
164 CanDraw = TRUE;
165
166 if (fnMask_GetPixel)
167 {
168 if (bLeftToRight)
169 {
170 sx = SourceRect->right - (DesX - DestRect->left) * SrcWidth / DstWidth; // flips about the y-axis
171 }
172 else
173 {
174 sx = SourceRect->left+(DesX - DestRect->left) * SrcWidth / DstWidth;
175 }
176 if (sx < 0 || sy < 0 ||
177 MaskSurf->sizlBitmap.cx < sx || MaskCy < sy ||
178 fnMask_GetPixel(MaskSurf, sx, sy) != 0)
179 {
180 CanDraw = FALSE;
181 }
182 }
183
184 if (UsesSource && CanDraw)
185 {
186 if (bLeftToRight)
187 {
188 sx = SourceRect->right-(DesX - DestRect->left) * SrcWidth / DstWidth; // flips about the y-axis
189 }
190 else
191 {
192 sx = SourceRect->left + (DesX - DestRect->left) * SrcWidth / DstWidth;
193 }
194 if (sx >= 0 && sy >= 0 &&
195 SourceSurf->sizlBitmap.cx > sx && SourceCy > sy)
196 {
197 Source = XLATEOBJ_iXlate(ColorTranslation, fnSource_GetPixel(SourceSurf, sx, sy));
198 }
199 else
200 {
201 Source = 0;
202 CanDraw = ((ROP & 0xFF) != R3_OPINDEX_SRCCOPY);
203 }
204 }
205
206 if (CanDraw)
207 {
208 if (UsesPattern && PatternSurface)
209 {
210 Pattern = fnPattern_GetPixel(PatternSurface, PatternX, PatternY);
211 PatternX++;
212 PatternX %= PatternSurface->sizlBitmap.cx;
213 }
214
215 Dest = fnDest_GetPixel(DestSurf, DesX, DesY);
216 Color = DIB_DoRop(ROP, Dest, Source, Pattern) & xxBPPMask;
217
218 fnDest_PutPixel(DestSurf, DesX, DesY, Color);
219 }
220 }
221
222 if (PatternSurface)
223 {
224 PatternY++;
225 PatternY %= PatternSurface->sizlBitmap.cy;
226 }
227 }
228
229 return TRUE;
230}
#define IS_VALID_ROP4(rop)
Definition: inteng.h:49
#define ASSERT(a)
Definition: mode.c:44
ULONG(* PFN_DIB_GetPixel)(SURFOBJ *, LONG, LONG)
Definition: dib.h:34

◆ Dummy_AlphaBlend()

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

Definition at line 244 of file dib.c.

247{
248 return FALSE;
249}

◆ Dummy_BitBlt()

BOOLEAN Dummy_BitBlt ( PBLTINFO  BltInfo)

Definition at line 214 of file dib.c.

215{
216 return FALSE;
217}

◆ Dummy_ColorFill()

BOOLEAN Dummy_ColorFill ( SURFOBJ Dest,
RECTL DestRect,
ULONG  Color 
)

Definition at line 237 of file dib.c.

238{
239 return FALSE;
240}

◆ Dummy_GetPixel()

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

Definition at line 199 of file dib.c.

200{
201 return 0;
202}

◆ Dummy_HLine()

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

Definition at line 204 of file dib.c.

205{
206 return;
207}

◆ Dummy_PutPixel()

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

Definition at line 194 of file dib.c.

195{
196 return;
197}

◆ Dummy_StretchBlt()

BOOLEAN Dummy_StretchBlt ( SURFOBJ DestSurf,
SURFOBJ SourceSurf,
SURFOBJ PatternSurface,
SURFOBJ MaskSurf,
RECTL DestRect,
RECTL SourceRect,
POINTL MaskOrigin,
BRUSHOBJ Brush,
POINTL BrushOrign,
XLATEOBJ ColorTranslation,
ROP4  Rop 
)

Definition at line 219 of file dib.c.

226{
227 return FALSE;
228}

◆ Dummy_TransparentBlt()

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

Definition at line 230 of file dib.c.

233{
234 return FALSE;
235}

◆ Dummy_VLine()

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

Definition at line 209 of file dib.c.

210{
211 return;
212}

Variable Documentation

◆ altnotmask

unsigned char altnotmask[2]
extern

◆ DibFunctionsForBitmapFormat

◆ notmask

unsigned char notmask[2]
extern

Definition at line 17 of file dib.c.

Referenced by DIB_4BPP_BitBltSrcCopy(), DIB_4BPP_HLine(), DIB_4BPP_PutPixel(), and DIB_4BPP_VLine().