ReactOS 0.4.15-dev-7842-g558ab78
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 851 of file dib16bpp.c.

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

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

674{
675 LONG DestY;
676
677 /* Make WellOrdered with top < bottom and left < right */
678 RECTL_vMakeWellOrdered(DestRect);
679
680#if defined(_M_IX86) && !defined(_MSC_VER)
681 /* This is about 10% faster than the generic C code below */
682 ULONG delta = DestSurface->lDelta;
683 ULONG width = (DestRect->right - DestRect->left) ;
684 PULONG pos = (PULONG) ((PBYTE)DestSurface->pvScan0 + DestRect->top * delta + (DestRect->left<<1));
685 color = (color&0xffff); /* If the color value is "abcd", put "abcdabcd" into color */
686 color += (color<<16);
687
688 for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
689 {
690 __asm__ __volatile__ (
691 "cld\n\t"
692 "mov %1,%%ebx\n\t"
693 "mov %2,%%edi\n\t"
694 "test $0x03, %%edi\n\t" /* Align to fullword boundary */
695 "jz 1f\n\t"
696 "stosw\n\t"
697 "dec %%ebx\n\t"
698 "jz 2f\n"
699 "1:\n\t"
700 "mov %%ebx,%%ecx\n\t" /* Setup count of fullwords to fill */
701 "shr $1,%%ecx\n\t"
702 "rep stosl\n\t" /* The actual fill */
703 "test $0x01, %%ebx\n\t" /* One left to do at the right side? */
704 "jz 2f\n\t"
705 "stosw\n"
706 "2:"
707 :
708 : "a" (color), "r" (width), "m" (pos)
709 : "%ecx", "%ebx", "%edi");
710 pos =(PULONG)((ULONG_PTR)pos + delta);
711 }
712#else /* _M_IX86 */
713
714 for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
715 {
716 DIB_16BPP_HLine (DestSurface, DestRect->left, DestRect->right, DestY, color);
717 }
718#endif
719 return TRUE;
720}
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" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tsub $32, %rsp\n" "\t.seh_stackalloc 32\n" "\t.seh_endprologue\n" "\tmov %rdx, %rbp\n" "\tjmp *%rax\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 __asm__ __volatile__ (
47 " cld\n"
48 " mov %0, %%eax\n"
49 " shl $16, %%eax\n"
50 " andl $0xffff, %0\n" /* If the pixel value is "abcd", put "abcdabcd" in %eax */
51 " or %0, %%eax\n"
52 " mov %2, %%edi\n"
53 " test $0x03, %%edi\n" /* Align to fullword boundary */
54 " jz 0f\n"
55 " stosw\n"
56 " dec %1\n"
57 " jz 1f\n"
58 "0:\n"
59 " mov %1,%%ecx\n" /* Setup count of fullwords to fill */
60 " shr $1,%%ecx\n"
61 " rep stosl\n" /* The actual fill */
62 " test $0x01, %1\n" /* One left to do at the right side? */
63 " jz 1f\n"
64 " stosw\n"
65 "1:\n"
66 : /* no output */
67 : "r"(c), "r"(Count), "m"(addr)
68 : "%eax", "%ecx", "%edi");
69#else /* _M_IX86 */
70 LONG cx = x1;
71 DWORD cc;
72
73 if (0 != (cx & 0x01))
74 {
75 *((PWORD) addr) = (WORD)c;
76 cx++;
77 addr = (PDWORD)((PWORD)(addr) + 1);
78 }
79 cc = ((c & 0xffff) << 16) | (c & 0xffff);
80 while(cx + 1 < x2)
81 {
82 *addr++ = cc;
83 cx += 2;
84 }
85 if (cx < x2)
86 {
87 *((PWORD) addr) = (WORD)c;
88 }
89#endif /* _M_IX86 */
90}
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 _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708

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 723 of file dib16bpp.c.

726{
727 LONG RoundedRight, X, Y, SourceX = 0, SourceY = 0, wd;
728 ULONG *DestBits, Source, Dest;
729
730 LONG DstHeight;
731 LONG DstWidth;
732 LONG SrcHeight;
733 LONG SrcWidth;
734
735 DstHeight = DestRect->bottom - DestRect->top;
736 DstWidth = DestRect->right - DestRect->left;
737 SrcHeight = SourceRect->bottom - SourceRect->top;
738 SrcWidth = SourceRect->right - SourceRect->left;
739
740 RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x1);
741 DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 +
742 (DestRect->left << 1) +
743 DestRect->top * DestSurf->lDelta);
744 wd = DestSurf->lDelta - ((DestRect->right - DestRect->left) << 1);
745
746 for(Y = DestRect->top; Y < DestRect->bottom; Y++)
747 {
748 SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
749 for(X = DestRect->left; X < RoundedRight; X += 2, DestBits++, SourceX += 2)
750 {
751 Dest = *DestBits;
752
753 SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
754 if (SourceX >= 0 && SourceY >= 0 &&
755 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
756 {
757 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
758 if(Source != iTransColor)
759 {
760 Dest &= 0xFFFF0000;
761 Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFFFF);
762 }
763 }
764
765 SourceX = SourceRect->left+(X+1 - DestRect->left) * SrcWidth / DstWidth;
766 if (SourceX >= 0 && SourceY >= 0 &&
767 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
768 {
769 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
770 if(Source != iTransColor)
771 {
772 Dest &= 0xFFFF;
773 Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) << 16);
774 }
775 }
776
777 *DestBits = Dest;
778 }
779
780 if(X < DestRect->right)
781 {
782 SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
783 if (SourceX >= 0 && SourceY >= 0 &&
784 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
785 {
786 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
787 if(Source != iTransColor)
788 {
789 *((USHORT*)DestBits) = (USHORT)XLATEOBJ_iXlate(ColorTranslation,
790 Source);
791 }
792 }
793
794 DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
795 }
796
797 DestBits = (ULONG*)((ULONG_PTR)DestBits + wd);
798 }
799
800 return TRUE;
801}
#define Y(I)
#define 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 94 of file dib16bpp.c.

95{
96#if defined(_M_IX86) && !defined(_MSC_VER)
97 asm volatile(
98 " testl %2, %2" "\n\t"
99 " jle 2f" "\n\t"
100 " movl %2, %%ecx" "\n\t"
101 " shrl $2, %2" "\n\t"
102 " andl $3, %%ecx" "\n\t"
103 " jz 1f" "\n\t"
104 "0:" "\n\t"
105 " movw %%ax, (%0)" "\n\t"
106 " addl %1, %0" "\n\t"
107 " decl %%ecx" "\n\t"
108 " jnz 0b" "\n\t"
109 " testl %2, %2" "\n\t"
110 " jz 2f" "\n\t"
111 "1:" "\n\t"
112 " movw %%ax, (%0)" "\n\t"
113 " addl %1, %0" "\n\t"
114 " movw %%ax, (%0)" "\n\t"
115 " addl %1, %0" "\n\t"
116 " movw %%ax, (%0)" "\n\t"
117 " addl %1, %0" "\n\t"
118 " movw %%ax, (%0)" "\n\t"
119 " addl %1, %0" "\n\t"
120 " decl %2" "\n\t"
121 " jnz 1b" "\n\t"
122 "2:" "\n\t"
123 : /* no output */
124 : "r"((PBYTE)SurfObj->pvScan0 + (y1 * SurfObj->lDelta) + (x * sizeof (WORD))),
125 "r"(SurfObj->lDelta), "r"(y2 - y1), "a"(c)
126 : "cc", "memory", "%ecx");
127#else
128 PBYTE byteaddr = (PBYTE)(ULONG_PTR)SurfObj->pvScan0 + y1 * SurfObj->lDelta;
129 PWORD addr = (PWORD)byteaddr + x;
130 LONG lDelta = SurfObj->lDelta;
131
132 byteaddr = (PBYTE)addr;
133 while(y1++ < y2)
134 {
135 *addr = (WORD)c;
136
137 byteaddr += lDelta;
138 addr = (PWORD)byteaddr;
139 }
140#endif
141}
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h: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 (Count < 8)
22 {
23 /* For small fills, don't bother doing anything fancy */
24 while (Count--)
25 {
26 *(PUSHORT)(addr) = c;
27 addr += 2;
28 *(addr) = c >> 16;
29 addr += 1;
30 }
31 }
32 else
33 {
34 ULONG Fill[3];
35 ULONG MultiCount;
36
37 /* Align to 4-byte address */
38 while (0 != ((ULONG_PTR) addr & 0x3))
39 {
40 *(PUSHORT)(addr) = c;
41 addr += 2;
42 *(addr) = c >> 16;
43 addr += 1;
44 Count--;
45 }
46 /* If the color we need to fill with is 0ABC, then the final mem pattern
47 * (note little-endianness) would be:
48 *
49 * |C.B.A|C.B.A|C.B.A|C.B.A| <- pixel borders
50 * |C.B.A.C|B.A.C.B|A.C.B.A| <- ULONG borders
51 *
52 * So, taking endianness into account again, we need to fill with these
53 * ULONGs: CABC BCAB ABCA */
54
55 c = c & 0xffffff; /* 0ABC */
56 Fill[0] = c | (c << 24); /* CABC */
57 Fill[1] = (c >> 8) | (c << 16); /* BCAB */
58 Fill[2] = (c << 8) | (c >> 16); /* ABCA */
59 MultiCount = Count / 4;
60 do
61 {
62 *(PULONG)addr = Fill[0];
63 addr += 4;
64 *(PULONG)addr = Fill[1];
65 addr += 4;
66 *(PULONG)addr = Fill[2];
67 addr += 4;
68 }
69 while (0 != --MultiCount);
70
71 Count = Count & 0x03;
72 while (0 != Count--)
73 {
74 *(PUSHORT)(addr) = c;
75 addr += 2;
76 *(addr) = c >> 16;
77 addr += 1;
78 }
79 }
80}
void Fill(HDC hdc, LONG x, LONG y, COLORREF color)
Definition: drawing.cpp: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 seperated by > DestHeight
618 (BltInfo->SourceSurface->pvScan0 == BltInfo->DestSurface->pvScan0)) // and same surface (probably screen)
619 {
620 DPRINT("Flips Need Adjustments, so do move here.\n");
621
622 if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
623 {
624 /* SourceBits points to top-left pixel for lDelta < 0 and bottom-left for lDelta > 0 */
625 SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
626 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
627 + 4 * BltInfo->SourcePoint.x;
628 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
629 {
630 RtlMoveMemory(DestBits, SourceBits, 4 * DestWidth);
631 SourceBits += BltInfo->SourceSurface->lDelta;
632 DestBits += BltInfo->DestSurface->lDelta;
633 }
634 }
635 else
636 {
637 /* SourceBits points to bottom-left pixel for lDelta < 0 and top-left for lDelta > 0 */
638 SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
639 + ((BltInfo->SourcePoint.y
640 + DestHeight - 1) * BltInfo->SourceSurface->lDelta)
641 + 4 * BltInfo->SourcePoint.x;
642 /* SourceBits points to bottom-left pixel for lDelta < 0 and top-left for lDelta > 0 */
643 DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
644 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta)
645 + 4 * BltInfo->DestRect.left;
646 for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
647 {
648 RtlMoveMemory(DestBits, SourceBits, 4 * DestWidth);
649 SourceBits -= BltInfo->SourceSurface->lDelta;
650 DestBits -= BltInfo->DestSurface->lDelta;
651 }
652 }
653
654 /* This sets SourceBitsB to the bottom line */
655 SourceBitsB = DestBitsB;
656
657 /* This sets SourceBitsT to the top line */
658 SourceBitsT = DestBitsT;
659 }
660
661 /* Vertical Flip code starts here */
662 for (j = 0; j < DestHeight / 2 ; j++)
663 {
664 /* Store bottom row of Source pixels */
665 RtlMoveMemory(store, SourceBitsB, 4 * DestWidth);
666
667 /* Copy top Source row to bottom Destination row overwriting it */
668 RtlMoveMemory(DestBitsB, SourceBitsT, 4 * DestWidth);
669
670 /* Copy stored bottom row of Source pixels to Destination top row of pixels */
671 RtlMoveMemory(DestBitsT, store, 4 * DestWidth);
672
673 /* Index top rows down and bottom rows up */
674 SourceBitsT += BltInfo->SourceSurface->lDelta;
675 SourceBitsB -= BltInfo->SourceSurface->lDelta;
676
677 DestBitsT += BltInfo->DestSurface->lDelta;
678 DestBitsB -= BltInfo->DestSurface->lDelta;
679 }
680 if (DestHeight % 2)
681 {
682 /* If we had an odd number of lines we handle the center one here */
683 DPRINT("Handling Top To Bottom with Odd Number of lines.\n");
684 RtlMoveMemory(DestBitsB, SourceBitsT, 4 * DestWidth);
685 }
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 59 of file dib8bpp.c.

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

528{
529 LONG DestY;
530
531 /* Make WellOrdered by making top < bottom and left < right */
532 RECTL_vMakeWellOrdered(DestRect);
533
534 for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
535 {
536 DIB_8BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
537 }
538 return TRUE;
539}
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 memset((PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + x1, (BYTE) c, x2 - x1);
40}
#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 543 of file dib8bpp.c.

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

◆ DIB_8BPP_VLine()

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

Definition at line 43 of file dib8bpp.c.

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

◆ 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_16BPP_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().