mirror of
https://github.com/reactos/reactos.git
synced 2025-02-20 15:35:04 +00:00
Cleanup in win32k/dib:
- Replace old headers with new ones, programmers added according to svn blame info - Apply consistent 2pt indentation because of the many indentation levels in this code; getting rid of a tab and 2/3/4pt mixture - Rename universal StretchBlt file to reflect content svn path=/trunk/; revision=42339
This commit is contained in:
parent
54817d5b14
commit
3283ffdef8
17 changed files with 2137 additions and 2274 deletions
|
@ -1,22 +1,11 @@
|
||||||
/*
|
/*
|
||||||
* ReactOS W32 Subsystem
|
* PROJECT: Win32 subsystem
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
* LICENSE: See COPYING in the top level directory
|
||||||
*
|
* FILE: subsystems/win32/win32k/dib/dib.c
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* PURPOSE: ROP handling, function pointer arrays, misc
|
||||||
* it under the terms of the GNU General Public License as published by
|
* PROGRAMMERS: Ge van Geldorp
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
*/
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
|
|
||||||
|
@ -30,72 +19,72 @@ unsigned char altnotmask[2] = { 0xf0, 0x0f };
|
||||||
|
|
||||||
DIB_FUNCTIONS DibFunctionsForBitmapFormat[] =
|
DIB_FUNCTIONS DibFunctionsForBitmapFormat[] =
|
||||||
{
|
{
|
||||||
/* 0 */
|
/* 0 */
|
||||||
{
|
{
|
||||||
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
|
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
|
||||||
Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt,
|
Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt,
|
||||||
Dummy_ColorFill, Dummy_AlphaBlend
|
Dummy_ColorFill, Dummy_AlphaBlend
|
||||||
},
|
},
|
||||||
/* BMF_1BPP */
|
/* BMF_1BPP */
|
||||||
{
|
{
|
||||||
DIB_1BPP_PutPixel, DIB_1BPP_GetPixel, DIB_1BPP_HLine, DIB_1BPP_VLine,
|
DIB_1BPP_PutPixel, DIB_1BPP_GetPixel, DIB_1BPP_HLine, DIB_1BPP_VLine,
|
||||||
DIB_1BPP_BitBlt, DIB_1BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
DIB_1BPP_BitBlt, DIB_1BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
||||||
DIB_1BPP_TransparentBlt, DIB_1BPP_ColorFill, DIB_1BPP_AlphaBlend
|
DIB_1BPP_TransparentBlt, DIB_1BPP_ColorFill, DIB_1BPP_AlphaBlend
|
||||||
},
|
},
|
||||||
/* BMF_4BPP */
|
/* BMF_4BPP */
|
||||||
{
|
{
|
||||||
DIB_4BPP_PutPixel, DIB_4BPP_GetPixel, DIB_4BPP_HLine, DIB_4BPP_VLine,
|
DIB_4BPP_PutPixel, DIB_4BPP_GetPixel, DIB_4BPP_HLine, DIB_4BPP_VLine,
|
||||||
DIB_4BPP_BitBlt, DIB_4BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
DIB_4BPP_BitBlt, DIB_4BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
||||||
DIB_4BPP_TransparentBlt, DIB_4BPP_ColorFill, DIB_4BPP_AlphaBlend
|
DIB_4BPP_TransparentBlt, DIB_4BPP_ColorFill, DIB_4BPP_AlphaBlend
|
||||||
},
|
},
|
||||||
/* BMF_8BPP */
|
/* BMF_8BPP */
|
||||||
{
|
{
|
||||||
DIB_8BPP_PutPixel, DIB_8BPP_GetPixel, DIB_8BPP_HLine, DIB_8BPP_VLine,
|
DIB_8BPP_PutPixel, DIB_8BPP_GetPixel, DIB_8BPP_HLine, DIB_8BPP_VLine,
|
||||||
DIB_8BPP_BitBlt, DIB_8BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
DIB_8BPP_BitBlt, DIB_8BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
||||||
DIB_8BPP_TransparentBlt, DIB_8BPP_ColorFill, DIB_8BPP_AlphaBlend
|
DIB_8BPP_TransparentBlt, DIB_8BPP_ColorFill, DIB_8BPP_AlphaBlend
|
||||||
},
|
},
|
||||||
/* BMF_16BPP */
|
/* BMF_16BPP */
|
||||||
{
|
{
|
||||||
DIB_16BPP_PutPixel, DIB_16BPP_GetPixel, DIB_16BPP_HLine, DIB_16BPP_VLine,
|
DIB_16BPP_PutPixel, DIB_16BPP_GetPixel, DIB_16BPP_HLine, DIB_16BPP_VLine,
|
||||||
DIB_16BPP_BitBlt, DIB_16BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
DIB_16BPP_BitBlt, DIB_16BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
||||||
DIB_16BPP_TransparentBlt, DIB_16BPP_ColorFill, DIB_16BPP_AlphaBlend
|
DIB_16BPP_TransparentBlt, DIB_16BPP_ColorFill, DIB_16BPP_AlphaBlend
|
||||||
},
|
},
|
||||||
/* BMF_24BPP */
|
/* BMF_24BPP */
|
||||||
{
|
{
|
||||||
DIB_24BPP_PutPixel, DIB_24BPP_GetPixel, DIB_24BPP_HLine, DIB_24BPP_VLine,
|
DIB_24BPP_PutPixel, DIB_24BPP_GetPixel, DIB_24BPP_HLine, DIB_24BPP_VLine,
|
||||||
DIB_24BPP_BitBlt, DIB_24BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
DIB_24BPP_BitBlt, DIB_24BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
||||||
DIB_24BPP_TransparentBlt, DIB_24BPP_ColorFill, DIB_24BPP_AlphaBlend
|
DIB_24BPP_TransparentBlt, DIB_24BPP_ColorFill, DIB_24BPP_AlphaBlend
|
||||||
},
|
},
|
||||||
/* BMF_32BPP */
|
/* BMF_32BPP */
|
||||||
{
|
{
|
||||||
DIB_32BPP_PutPixel, DIB_32BPP_GetPixel, DIB_32BPP_HLine, DIB_32BPP_VLine,
|
DIB_32BPP_PutPixel, DIB_32BPP_GetPixel, DIB_32BPP_HLine, DIB_32BPP_VLine,
|
||||||
DIB_32BPP_BitBlt, DIB_32BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
DIB_32BPP_BitBlt, DIB_32BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt,
|
||||||
DIB_32BPP_TransparentBlt, DIB_32BPP_ColorFill, DIB_32BPP_AlphaBlend
|
DIB_32BPP_TransparentBlt, DIB_32BPP_ColorFill, DIB_32BPP_AlphaBlend
|
||||||
},
|
},
|
||||||
/* BMF_4RLE */
|
/* BMF_4RLE */
|
||||||
{
|
{
|
||||||
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
|
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
|
||||||
Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt,
|
Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt,
|
||||||
Dummy_ColorFill, Dummy_AlphaBlend
|
Dummy_ColorFill, Dummy_AlphaBlend
|
||||||
},
|
},
|
||||||
/* BMF_8RLE */
|
/* BMF_8RLE */
|
||||||
{
|
{
|
||||||
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
|
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
|
||||||
Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt,
|
Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt,
|
||||||
Dummy_ColorFill, Dummy_AlphaBlend
|
Dummy_ColorFill, Dummy_AlphaBlend
|
||||||
},
|
},
|
||||||
/* BMF_JPEG */
|
/* BMF_JPEG */
|
||||||
{
|
{
|
||||||
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
|
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
|
||||||
Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt,
|
Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt,
|
||||||
Dummy_ColorFill, Dummy_AlphaBlend
|
Dummy_ColorFill, Dummy_AlphaBlend
|
||||||
},
|
},
|
||||||
/* BMF_PNG */
|
/* BMF_PNG */
|
||||||
{
|
{
|
||||||
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
|
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
|
||||||
Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt,
|
Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt, Dummy_TransparentBlt,
|
||||||
Dummy_ColorFill, Dummy_AlphaBlend
|
Dummy_ColorFill, Dummy_AlphaBlend
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
|
@ -104,7 +93,7 @@ DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern)
|
||||||
ULONG ResultNibble;
|
ULONG ResultNibble;
|
||||||
ULONG Result;
|
ULONG Result;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
static const ULONG ExpandDest[16] =
|
static const ULONG ExpandDest[16] =
|
||||||
{
|
{
|
||||||
0x55555555 /* 0000 */,
|
0x55555555 /* 0000 */,
|
||||||
0x555555AA /* 0001 */,
|
0x555555AA /* 0001 */,
|
||||||
|
@ -187,14 +176,14 @@ DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern)
|
||||||
/* Do the operation on four bits simultaneously. */
|
/* Do the operation on four bits simultaneously. */
|
||||||
Result = 0;
|
Result = 0;
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
ResultNibble = Rop & ExpandDest[Dest & 0xF] & ExpandSource[Source & 0xF] & ExpandPattern[Pattern & 0xF];
|
ResultNibble = Rop & ExpandDest[Dest & 0xF] & ExpandSource[Source & 0xF] & ExpandPattern[Pattern & 0xF];
|
||||||
Result |= (((ResultNibble & 0xFF000000) ? 0x8 : 0x0) | ((ResultNibble & 0x00FF0000) ? 0x4 : 0x0) |
|
Result |= (((ResultNibble & 0xFF000000) ? 0x8 : 0x0) | ((ResultNibble & 0x00FF0000) ? 0x4 : 0x0) |
|
||||||
((ResultNibble & 0x0000FF00) ? 0x2 : 0x0) | ((ResultNibble & 0x000000FF) ? 0x1 : 0x0)) << (i * 4);
|
((ResultNibble & 0x0000FF00) ? 0x2 : 0x0) | ((ResultNibble & 0x000000FF) ? 0x1 : 0x0)) << (i * 4);
|
||||||
Dest >>= 4;
|
Dest >>= 4;
|
||||||
Source >>= 4;
|
Source >>= 4;
|
||||||
Pattern >>= 4;
|
Pattern >>= 4;
|
||||||
}
|
}
|
||||||
return(Result);
|
return(Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,35 +5,35 @@
|
||||||
#define memset4(dest, value, count) asm volatile("rep stosl" : : "D"(dest), "a"(value), "c"(count) : "memory");
|
#define memset4(dest, value, count) asm volatile("rep stosl" : : "D"(dest), "a"(value), "c"(count) : "memory");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ROP4_BLACKNESS ((((0x00000042) >> 8) & 0xff00) | (((0x00000042) >> 16) & 0x00ff))
|
#define ROP4_BLACKNESS ((((0x00000042) >> 8) & 0xff00) | (((0x00000042) >> 16) & 0x00ff))
|
||||||
#define ROP4_NOTSRCERASE ((((0x001100A6) >> 8) & 0xff00) | (((0x001100A6) >> 16) & 0x00ff))
|
#define ROP4_NOTSRCERASE ((((0x001100A6) >> 8) & 0xff00) | (((0x001100A6) >> 16) & 0x00ff))
|
||||||
#define ROP4_NOTSRCCOPY ((((0x00330008) >> 8) & 0xff00) | (((0x00330008) >> 16) & 0x00ff))
|
#define ROP4_NOTSRCCOPY ((((0x00330008) >> 8) & 0xff00) | (((0x00330008) >> 16) & 0x00ff))
|
||||||
#define ROP4_SRCERASE ((((0x00440328) >> 8) & 0xff00) | (((0x00440328) >> 16) & 0x00ff))
|
#define ROP4_SRCERASE ((((0x00440328) >> 8) & 0xff00) | (((0x00440328) >> 16) & 0x00ff))
|
||||||
#define ROP4_DSTINVERT ((((0x00550009) >> 8) & 0xff00) | (((0x00550009) >> 16) & 0x00ff))
|
#define ROP4_DSTINVERT ((((0x00550009) >> 8) & 0xff00) | (((0x00550009) >> 16) & 0x00ff))
|
||||||
#define ROP4_PATINVERT ((((0x005A0049) >> 8) & 0xff00) | (((0x005A0049) >> 16) & 0x00ff))
|
#define ROP4_PATINVERT ((((0x005A0049) >> 8) & 0xff00) | (((0x005A0049) >> 16) & 0x00ff))
|
||||||
#define ROP4_SRCINVERT ((((0x00660046) >> 8) & 0xff00) | (((0x00660046) >> 16) & 0x00ff))
|
#define ROP4_SRCINVERT ((((0x00660046) >> 8) & 0xff00) | (((0x00660046) >> 16) & 0x00ff))
|
||||||
#define ROP4_SRCAND ((((0x008800C6) >> 8) & 0xff00) | (((0x008800C6) >> 16) & 0x00ff))
|
#define ROP4_SRCAND ((((0x008800C6) >> 8) & 0xff00) | (((0x008800C6) >> 16) & 0x00ff))
|
||||||
#define ROP4_MERGEPAINT ((((0x00BB0226) >> 8) & 0xff00) | (((0x00BB0226) >> 16) & 0x00ff))
|
#define ROP4_MERGEPAINT ((((0x00BB0226) >> 8) & 0xff00) | (((0x00BB0226) >> 16) & 0x00ff))
|
||||||
#define ROP4_MERGECOPY ((((0x00C000CA) >> 8) & 0xff00) | (((0x00C000CA) >> 16) & 0x00ff))
|
#define ROP4_MERGECOPY ((((0x00C000CA) >> 8) & 0xff00) | (((0x00C000CA) >> 16) & 0x00ff))
|
||||||
#define ROP4_SRCCOPY ((((0x00CC0020) >> 8) & 0xff00) | (((0x00CC0020) >> 16) & 0x00ff))
|
#define ROP4_SRCCOPY ((((0x00CC0020) >> 8) & 0xff00) | (((0x00CC0020) >> 16) & 0x00ff))
|
||||||
#define ROP4_SRCPAINT ((((0x00EE0086) >> 8) & 0xff00) | (((0x00EE0086) >> 16) & 0x00ff))
|
#define ROP4_SRCPAINT ((((0x00EE0086) >> 8) & 0xff00) | (((0x00EE0086) >> 16) & 0x00ff))
|
||||||
#define ROP4_PATCOPY ((((0x00F00021) >> 8) & 0xff00) | (((0x00F00021) >> 16) & 0x00ff))
|
#define ROP4_PATCOPY ((((0x00F00021) >> 8) & 0xff00) | (((0x00F00021) >> 16) & 0x00ff))
|
||||||
#define ROP4_PATPAINT ((((0x00FB0A09) >> 8) & 0xff00) | (((0x00FB0A09) >> 16) & 0x00ff))
|
#define ROP4_PATPAINT ((((0x00FB0A09) >> 8) & 0xff00) | (((0x00FB0A09) >> 16) & 0x00ff))
|
||||||
#define ROP4_WHITENESS ((((0x00FF0062) >> 8) & 0xff00) | (((0x00FF0062) >> 16) & 0x00ff))
|
#define ROP4_WHITENESS ((((0x00FF0062) >> 8) & 0xff00) | (((0x00FF0062) >> 16) & 0x00ff))
|
||||||
|
|
||||||
|
|
||||||
typedef struct _BLTINFO
|
typedef struct _BLTINFO
|
||||||
{
|
{
|
||||||
SURFOBJ *DestSurface;
|
SURFOBJ *DestSurface;
|
||||||
SURFOBJ *SourceSurface;
|
SURFOBJ *SourceSurface;
|
||||||
SURFOBJ *PatternSurface;
|
SURFOBJ *PatternSurface;
|
||||||
XLATEOBJ *XlateSourceToDest;
|
XLATEOBJ *XlateSourceToDest;
|
||||||
XLATEOBJ *XlatePatternToDest;
|
XLATEOBJ *XlatePatternToDest;
|
||||||
RECTL DestRect;
|
RECTL DestRect;
|
||||||
POINTL SourcePoint;
|
POINTL SourcePoint;
|
||||||
BRUSHOBJ *Brush;
|
BRUSHOBJ *Brush;
|
||||||
POINTL BrushOrigin;
|
POINTL BrushOrigin;
|
||||||
ULONG Rop4;
|
ULONG Rop4;
|
||||||
} BLTINFO, *PBLTINFO;
|
} BLTINFO, *PBLTINFO;
|
||||||
|
|
||||||
typedef VOID (*PFN_DIB_PutPixel)(SURFOBJ*,LONG,LONG,ULONG);
|
typedef VOID (*PFN_DIB_PutPixel)(SURFOBJ*,LONG,LONG,ULONG);
|
||||||
|
@ -141,14 +141,14 @@ extern unsigned char altnotmask[2];
|
||||||
|
|
||||||
ULONG DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern);
|
ULONG DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern);
|
||||||
|
|
||||||
#define DIB_GetSource(SourceSurf,sx,sy,ColorTranslation) \
|
#define DIB_GetSource(SourceSurf,sx,sy,ColorTranslation) \
|
||||||
XLATEOBJ_iXlate(ColorTranslation, \
|
XLATEOBJ_iXlate(ColorTranslation, \
|
||||||
DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat]. \
|
DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat]. \
|
||||||
DIB_GetPixel(SourceSurf, sx, sy))
|
DIB_GetPixel(SourceSurf, sx, sy))
|
||||||
|
|
||||||
#define DIB_GetSourceIndex(SourceSurf,sx,sy) \
|
#define DIB_GetSourceIndex(SourceSurf,sx,sy) \
|
||||||
DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat]. \
|
DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat]. \
|
||||||
DIB_GetPixel(SourceSurf, sx, sy)
|
DIB_GetPixel(SourceSurf, sx, sy)
|
||||||
|
|
||||||
#endif /* _W32K_DIB_DIB_H */
|
#endif /* _W32K_DIB_DIB_H */
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,22 +1,11 @@
|
||||||
/*
|
/*
|
||||||
* ReactOS W32 Subsystem
|
* PROJECT: Win32 subsystem
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
* LICENSE: See COPYING in the top level directory
|
||||||
*
|
* FILE: subsystems/win32/win32k/dib/dib1bpp.c
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* PURPOSE: Device Independant Bitmap functions, 1bpp
|
||||||
* it under the terms of the GNU General Public License as published by
|
* PROGRAMMERS: Jason Filby
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
*/
|
||||||
/* $Id$ */
|
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
|
@ -44,7 +33,8 @@ DIB_1BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
|
||||||
VOID
|
VOID
|
||||||
DIB_1BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
DIB_1BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
{
|
{
|
||||||
while(x1 < x2) {
|
while(x1 < x2)
|
||||||
|
{
|
||||||
DIB_1BPP_PutPixel(SurfObj, x1, y, c);
|
DIB_1BPP_PutPixel(SurfObj, x1, y, c);
|
||||||
x1++;
|
x1++;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +43,8 @@ DIB_1BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
VOID
|
VOID
|
||||||
DIB_1BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
DIB_1BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
{
|
{
|
||||||
while(y1 < y2) {
|
while(y1 < y2)
|
||||||
|
{
|
||||||
DIB_1BPP_PutPixel(SurfObj, x, y1, c);
|
DIB_1BPP_PutPixel(SurfObj, x, y1, c);
|
||||||
y1++;
|
y1++;
|
||||||
}
|
}
|
||||||
|
@ -62,407 +53,407 @@ DIB_1BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
DIB_1BPP_BitBltSrcCopy_From1BPP (
|
DIB_1BPP_BitBltSrcCopy_From1BPP (
|
||||||
SURFOBJ* DestSurf,
|
SURFOBJ* DestSurf,
|
||||||
SURFOBJ* SourceSurf,
|
SURFOBJ* SourceSurf,
|
||||||
XLATEOBJ* pxlo,
|
XLATEOBJ* pxlo,
|
||||||
PRECTL DestRect,
|
PRECTL DestRect,
|
||||||
POINTL *SourcePoint )
|
POINTL *SourcePoint )
|
||||||
{
|
{
|
||||||
// the 'window' in this sense is the x-position that corresponds
|
// the 'window' in this sense is the x-position that corresponds
|
||||||
// to the left-edge of the 8-pixel byte we are currently working with.
|
// to the left-edge of the 8-pixel byte we are currently working with.
|
||||||
// dwx is current x-window, dwx2 is the 'last' window we need to process
|
// dwx is current x-window, dwx2 is the 'last' window we need to process
|
||||||
int dwx, dwx2; // destination window x-position
|
int dwx, dwx2; // destination window x-position
|
||||||
int swx; // source window y-position
|
int swx; // source window y-position
|
||||||
|
|
||||||
// left and right edges of source and dest rectangles
|
// left and right edges of source and dest rectangles
|
||||||
int dl = DestRect->left; // dest left
|
int dl = DestRect->left; // dest left
|
||||||
int dr = DestRect->right-1; // dest right (inclusive)
|
int dr = DestRect->right-1; // dest right (inclusive)
|
||||||
int sl = SourcePoint->x; // source left
|
int sl = SourcePoint->x; // source left
|
||||||
int sr = sl + dr - dl; // source right (inclusive)
|
int sr = sl + dr - dl; // source right (inclusive)
|
||||||
|
|
||||||
// which direction are we going?
|
// which direction are we going?
|
||||||
int xinc;
|
int xinc;
|
||||||
int yinc;
|
int yinc;
|
||||||
int ySrcDelta, yDstDelta;
|
int ySrcDelta, yDstDelta;
|
||||||
|
|
||||||
// following 4 variables are used for the y-sweep
|
// following 4 variables are used for the y-sweep
|
||||||
int dy; // dest y
|
int dy; // dest y
|
||||||
int dy1; // dest y start
|
int dy1; // dest y start
|
||||||
int dy2; // dest y end
|
int dy2; // dest y end
|
||||||
int sy1; // src y start
|
int sy1; // src y start
|
||||||
|
|
||||||
int dx;
|
int dx;
|
||||||
int shift;
|
int shift;
|
||||||
BYTE srcmask, dstmask, xormask;
|
BYTE srcmask, dstmask, xormask;
|
||||||
|
|
||||||
// 'd' and 's' are the dest & src buffer pointers that I use on my x-sweep
|
// 'd' and 's' are the dest & src buffer pointers that I use on my x-sweep
|
||||||
// 'pd' and 'ps' are the dest & src buffer pointers used on the inner y-sweep
|
// 'pd' and 'ps' are the dest & src buffer pointers used on the inner y-sweep
|
||||||
PBYTE d, pd; // dest ptrs
|
PBYTE d, pd; // dest ptrs
|
||||||
PBYTE s, ps; // src ptrs
|
PBYTE s, ps; // src ptrs
|
||||||
|
|
||||||
shift = (dl-sl)&7;
|
shift = (dl-sl)&7;
|
||||||
|
|
||||||
xormask = 0xFF * XLATEOBJ_iXlate(pxlo, 0);
|
xormask = 0xFF * XLATEOBJ_iXlate(pxlo, 0);
|
||||||
|
|
||||||
if ( DestRect->top <= SourcePoint->y )
|
if ( DestRect->top <= SourcePoint->y )
|
||||||
{
|
{
|
||||||
// moving up ( scan top -> bottom )
|
// moving up ( scan top -> bottom )
|
||||||
dy1 = DestRect->top;
|
dy1 = DestRect->top;
|
||||||
dy2 = DestRect->bottom - 1;
|
dy2 = DestRect->bottom - 1;
|
||||||
sy1 = SourcePoint->y;
|
sy1 = SourcePoint->y;
|
||||||
yinc = 1;
|
yinc = 1;
|
||||||
ySrcDelta = SourceSurf->lDelta;
|
ySrcDelta = SourceSurf->lDelta;
|
||||||
yDstDelta = DestSurf->lDelta;
|
yDstDelta = DestSurf->lDelta;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// moving down ( scan bottom -> top )
|
// moving down ( scan bottom -> top )
|
||||||
dy1 = DestRect->bottom - 1;
|
dy1 = DestRect->bottom - 1;
|
||||||
dy2 = DestRect->top;
|
dy2 = DestRect->top;
|
||||||
sy1 = SourcePoint->y + dy1 - dy2;
|
sy1 = SourcePoint->y + dy1 - dy2;
|
||||||
yinc = -1;
|
yinc = -1;
|
||||||
ySrcDelta = -SourceSurf->lDelta;
|
ySrcDelta = -SourceSurf->lDelta;
|
||||||
yDstDelta = -DestSurf->lDelta;
|
yDstDelta = -DestSurf->lDelta;
|
||||||
}
|
}
|
||||||
if ( DestRect->left <= SourcePoint->x )
|
if ( DestRect->left <= SourcePoint->x )
|
||||||
{
|
{
|
||||||
// moving left ( scan left->right )
|
// moving left ( scan left->right )
|
||||||
dwx = dl&~7;
|
dwx = dl&~7;
|
||||||
swx = (sl-(dl&7))&~7;
|
swx = (sl-(dl&7))&~7;
|
||||||
dwx2 = dr&~7;
|
dwx2 = dr&~7;
|
||||||
xinc = 1;
|
xinc = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// moving right ( scan right->left )
|
// moving right ( scan right->left )
|
||||||
dwx = dr&~7;
|
dwx = dr&~7;
|
||||||
swx = (sr-(dr&7))&~7; //(sr-7)&~7; // we need the left edge of this block... thus the -7
|
swx = (sr-(dr&7))&~7; //(sr-7)&~7; // we need the left edge of this block... thus the -7
|
||||||
dwx2 = dl&~7;
|
dwx2 = dl&~7;
|
||||||
xinc = -1;
|
xinc = -1;
|
||||||
}
|
}
|
||||||
d = &(((PBYTE)DestSurf->pvScan0)[dy1*DestSurf->lDelta + (dwx>>3)]);
|
d = &(((PBYTE)DestSurf->pvScan0)[dy1*DestSurf->lDelta + (dwx>>3)]);
|
||||||
s = &(((PBYTE)SourceSurf->pvScan0)[sy1*SourceSurf->lDelta + (swx>>3)]);
|
s = &(((PBYTE)SourceSurf->pvScan0)[sy1*SourceSurf->lDelta + (swx>>3)]);
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
dy = dy1;
|
dy = dy1;
|
||||||
pd = d;
|
pd = d;
|
||||||
ps = s;
|
ps = s;
|
||||||
srcmask = 0xff;
|
srcmask = 0xff;
|
||||||
dx = dwx; /* dest x for this pass */
|
dx = dwx; /* dest x for this pass */
|
||||||
if ( dwx < dl )
|
if ( dwx < dl )
|
||||||
{
|
{
|
||||||
int diff = dl-dwx;
|
int diff = dl-dwx;
|
||||||
srcmask &= (1<<(8-diff))-1;
|
srcmask &= (1<<(8-diff))-1;
|
||||||
dx = dl;
|
dx = dl;
|
||||||
}
|
}
|
||||||
if ( dwx+7 > dr )
|
if ( dwx+7 > dr )
|
||||||
{
|
{
|
||||||
int diff = dr-dwx+1;
|
int diff = dr-dwx+1;
|
||||||
srcmask &= ~((1<<(8-diff))-1);
|
srcmask &= ~((1<<(8-diff))-1);
|
||||||
}
|
}
|
||||||
dstmask = ~srcmask;
|
dstmask = ~srcmask;
|
||||||
|
|
||||||
// we unfortunately *must* have 5 different versions of the inner
|
// we unfortunately *must* have 5 different versions of the inner
|
||||||
// loop to be certain we don't try to read from memory that is not
|
// loop to be certain we don't try to read from memory that is not
|
||||||
// needed and may in fact be invalid
|
// needed and may in fact be invalid
|
||||||
if ( !shift )
|
if ( !shift )
|
||||||
{
|
{
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
*pd = (BYTE)((*pd & dstmask) | ((ps[0]^xormask) & srcmask));
|
*pd = (BYTE)((*pd & dstmask) | ((ps[0]^xormask) & srcmask));
|
||||||
|
|
||||||
// this *must* be here, because we could be going up *or* down...
|
// this *must* be here, because we could be going up *or* down...
|
||||||
if ( dy == dy2 )
|
if ( dy == dy2 )
|
||||||
break;
|
break;
|
||||||
dy += yinc;
|
dy += yinc;
|
||||||
pd += yDstDelta;
|
pd += yDstDelta;
|
||||||
ps += ySrcDelta;
|
ps += ySrcDelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( !(0xFF00 & (srcmask<<shift) ) ) // check if ps[0] not needed...
|
else if ( !(0xFF00 & (srcmask<<shift) ) ) // check if ps[0] not needed...
|
||||||
{
|
{
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
*pd = (BYTE)((*pd & dstmask)
|
*pd = (BYTE)((*pd & dstmask)
|
||||||
| ( ( (ps[1]^xormask) >> shift ) & srcmask ));
|
| ( ( (ps[1]^xormask) >> shift ) & srcmask ));
|
||||||
|
|
||||||
// this *must* be here, because we could be going up *or* down...
|
// this *must* be here, because we could be going up *or* down...
|
||||||
if ( dy == dy2 )
|
if ( dy == dy2 )
|
||||||
break;
|
break;
|
||||||
dy += yinc;
|
dy += yinc;
|
||||||
pd += yDstDelta;
|
pd += yDstDelta;
|
||||||
ps += ySrcDelta;
|
ps += ySrcDelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( !(0xFF & (srcmask<<shift) ) ) // check if ps[1] not needed...
|
else if ( !(0xFF & (srcmask<<shift) ) ) // check if ps[1] not needed...
|
||||||
{
|
{
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
*pd = (*pd & dstmask)
|
*pd = (*pd & dstmask)
|
||||||
| ( ( (ps[0]^xormask) << ( 8 - shift ) ) & srcmask );
|
| ( ( (ps[0]^xormask) << ( 8 - shift ) ) & srcmask );
|
||||||
|
|
||||||
// this *must* be here, because we could be going up *or* down...
|
// this *must* be here, because we could be going up *or* down...
|
||||||
if ( dy == dy2 )
|
if ( dy == dy2 )
|
||||||
break;
|
break;
|
||||||
dy += yinc;
|
dy += yinc;
|
||||||
pd += yDstDelta;
|
pd += yDstDelta;
|
||||||
ps += ySrcDelta;
|
ps += ySrcDelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // both ps[0] and ps[1] are needed
|
else // both ps[0] and ps[1] are needed
|
||||||
{
|
{
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
*pd = (*pd & dstmask)
|
*pd = (*pd & dstmask)
|
||||||
| ( ( ( ((ps[1]^xormask))|((ps[0]^xormask)<<8) ) >> shift ) & srcmask );
|
| ( ( ( ((ps[1]^xormask))|((ps[0]^xormask)<<8) ) >> shift ) & srcmask );
|
||||||
|
|
||||||
// this *must* be here, because we could be going up *or* down...
|
// this *must* be here, because we could be going up *or* down...
|
||||||
if ( dy == dy2 )
|
if ( dy == dy2 )
|
||||||
break;
|
break;
|
||||||
dy += yinc;
|
dy += yinc;
|
||||||
pd += yDstDelta;
|
pd += yDstDelta;
|
||||||
ps += ySrcDelta;
|
ps += ySrcDelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this *must* be here, because we could be going right *or* left...
|
// this *must* be here, because we could be going right *or* left...
|
||||||
if ( dwx == dwx2 )
|
if ( dwx == dwx2 )
|
||||||
break;
|
break;
|
||||||
d += xinc;
|
d += xinc;
|
||||||
s += xinc;
|
s += xinc;
|
||||||
dwx += xinc<<3;
|
dwx += xinc<<3;
|
||||||
swx += xinc<<3;
|
swx += xinc<<3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
DIB_1BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
DIB_1BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
{
|
{
|
||||||
ULONG Color;
|
ULONG Color;
|
||||||
LONG i, j, sx, sy = BltInfo->SourcePoint.y;
|
LONG i, j, sx, sy = BltInfo->SourcePoint.y;
|
||||||
|
|
||||||
switch ( BltInfo->SourceSurface->iBitmapFormat )
|
switch ( BltInfo->SourceSurface->iBitmapFormat )
|
||||||
{
|
{
|
||||||
case BMF_1BPP:
|
case BMF_1BPP:
|
||||||
DIB_1BPP_BitBltSrcCopy_From1BPP ( BltInfo->DestSurface, BltInfo->SourceSurface, BltInfo->XlateSourceToDest, &BltInfo->DestRect, &BltInfo->SourcePoint );
|
DIB_1BPP_BitBltSrcCopy_From1BPP ( BltInfo->DestSurface, BltInfo->SourceSurface, BltInfo->XlateSourceToDest, &BltInfo->DestRect, &BltInfo->SourcePoint );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BMF_4BPP:
|
case BMF_4BPP:
|
||||||
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
||||||
{
|
{
|
||||||
sx = BltInfo->SourcePoint.x;
|
sx = BltInfo->SourcePoint.x;
|
||||||
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
||||||
{
|
{
|
||||||
Color = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_4BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
|
Color = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_4BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
|
||||||
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, Color);
|
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, Color);
|
||||||
sx++;
|
sx++;
|
||||||
}
|
}
|
||||||
sy++;
|
sy++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BMF_8BPP:
|
case BMF_8BPP:
|
||||||
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
||||||
{
|
{
|
||||||
sx = BltInfo->SourcePoint.x;
|
sx = BltInfo->SourcePoint.x;
|
||||||
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
||||||
{
|
{
|
||||||
Color = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_8BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
|
Color = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_8BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
|
||||||
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, Color);
|
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, Color);
|
||||||
sx++;
|
sx++;
|
||||||
}
|
}
|
||||||
sy++;
|
sy++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BMF_16BPP:
|
case BMF_16BPP:
|
||||||
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
||||||
{
|
{
|
||||||
sx = BltInfo->SourcePoint.x;
|
sx = BltInfo->SourcePoint.x;
|
||||||
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
||||||
{
|
{
|
||||||
Color = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_16BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
|
Color = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_16BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
|
||||||
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, Color);
|
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, Color);
|
||||||
sx++;
|
sx++;
|
||||||
}
|
}
|
||||||
sy++;
|
sy++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BMF_24BPP:
|
case BMF_24BPP:
|
||||||
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
||||||
{
|
{
|
||||||
sx = BltInfo->SourcePoint.x;
|
sx = BltInfo->SourcePoint.x;
|
||||||
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
||||||
{
|
{
|
||||||
Color = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_24BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
|
Color = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_24BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
|
||||||
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, Color);
|
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, Color);
|
||||||
sx++;
|
sx++;
|
||||||
}
|
}
|
||||||
sy++;
|
sy++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BMF_32BPP:
|
case BMF_32BPP:
|
||||||
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
||||||
{
|
{
|
||||||
sx = BltInfo->SourcePoint.x;
|
sx = BltInfo->SourcePoint.x;
|
||||||
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
||||||
{
|
{
|
||||||
Color = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_32BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
|
Color = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_32BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
|
||||||
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, Color);
|
DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, Color);
|
||||||
sx++;
|
sx++;
|
||||||
}
|
}
|
||||||
sy++;
|
sy++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DbgPrint("DIB_1BPP_BitBlt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
|
DbgPrint("DIB_1BPP_BitBlt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
DIB_1BPP_BitBlt(PBLTINFO BltInfo)
|
DIB_1BPP_BitBlt(PBLTINFO BltInfo)
|
||||||
{
|
{
|
||||||
ULONG DestX, DestY;
|
ULONG DestX, DestY;
|
||||||
ULONG SourceX, SourceY;
|
ULONG SourceX, SourceY;
|
||||||
ULONG PatternY = 0;
|
ULONG PatternY = 0;
|
||||||
ULONG Dest, Source = 0, Pattern = 0;
|
ULONG Dest, Source = 0, Pattern = 0;
|
||||||
ULONG Index;
|
ULONG Index;
|
||||||
BOOLEAN UsesSource;
|
BOOLEAN UsesSource;
|
||||||
BOOLEAN UsesPattern;
|
BOOLEAN UsesPattern;
|
||||||
PULONG DestBits;
|
PULONG DestBits;
|
||||||
ULONG RoundedRight;
|
ULONG RoundedRight;
|
||||||
|
|
||||||
UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4);
|
UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4);
|
||||||
UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4);
|
UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4);
|
||||||
|
|
||||||
RoundedRight = BltInfo->DestRect.right -
|
RoundedRight = BltInfo->DestRect.right -
|
||||||
((BltInfo->DestRect.right - BltInfo->DestRect.left) & 31);
|
((BltInfo->DestRect.right - BltInfo->DestRect.left) & 31);
|
||||||
SourceY = BltInfo->SourcePoint.y;
|
SourceY = BltInfo->SourcePoint.y;
|
||||||
|
|
||||||
if (UsesPattern)
|
if (UsesPattern)
|
||||||
{
|
{
|
||||||
if (BltInfo->PatternSurface)
|
if (BltInfo->PatternSurface)
|
||||||
{
|
{
|
||||||
PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
|
PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
|
||||||
BltInfo->PatternSurface->sizlBitmap.cy;
|
BltInfo->PatternSurface->sizlBitmap.cy;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* FIXME: Shouldn't it be expanded? */
|
/* FIXME: Shouldn't it be expanded? */
|
||||||
if (BltInfo->Brush)
|
if (BltInfo->Brush)
|
||||||
Pattern = BltInfo->Brush->iSolidColor;
|
Pattern = BltInfo->Brush->iSolidColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
|
for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
|
||||||
{
|
{
|
||||||
DestX = BltInfo->DestRect.left;
|
DestX = BltInfo->DestRect.left;
|
||||||
SourceX = BltInfo->SourcePoint.x;
|
SourceX = BltInfo->SourcePoint.x;
|
||||||
DestBits = (PULONG)(
|
DestBits = (PULONG)(
|
||||||
(PBYTE)BltInfo->DestSurface->pvScan0 +
|
(PBYTE)BltInfo->DestSurface->pvScan0 +
|
||||||
(BltInfo->DestRect.left >> 3) +
|
(BltInfo->DestRect.left >> 3) +
|
||||||
DestY * BltInfo->DestSurface->lDelta);
|
DestY * BltInfo->DestSurface->lDelta);
|
||||||
|
|
||||||
if (DestX & 31)
|
if (DestX & 31)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
/* FIXME: This case is completely untested!!! */
|
/* FIXME: This case is completely untested!!! */
|
||||||
|
|
||||||
Dest = *((PBYTE)DestBits);
|
Dest = *((PBYTE)DestBits);
|
||||||
NoBits = 31 - (DestX & 31);
|
NoBits = 31 - (DestX & 31);
|
||||||
|
|
||||||
if (UsesSource)
|
if (UsesSource)
|
||||||
{
|
|
||||||
Source = 0;
|
|
||||||
/* FIXME: This is incorrect! */
|
|
||||||
for (Index = 31 - NoBits; Index >= 0; Index++)
|
|
||||||
Source |= (DIB_GetSource(SourceSurf, SourceX + Index, SourceY, ColorTranslation) << (31 - Index));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (BltInfo->PatternSurface)
|
|
||||||
{
|
|
||||||
Pattern = 0;
|
|
||||||
for (k = 31 - NoBits; k >= 0; k++)
|
|
||||||
Pattern |= (DIB_GetSource(PatternObj, (X + BrushOrigin.x + k) % PatternWidth, PatternY, BltInfo->XlatePatternToDest) << (31 - k));
|
|
||||||
}
|
|
||||||
|
|
||||||
Dest = DIB_DoRop(Rop4, Dest, Source, Pattern);
|
|
||||||
Dest &= ~((1 << (31 - NoBits)) - 1);
|
|
||||||
Dest |= *((PBYTE)DestBits) & ((1 << (31 - NoBits)) - 1);
|
|
||||||
|
|
||||||
*DestBits = Dest;
|
|
||||||
|
|
||||||
DestX += NoBits;
|
|
||||||
SourceX += NoBits;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; DestX < RoundedRight; DestX += 32, DestBits++, SourceX += 32)
|
|
||||||
{
|
{
|
||||||
Dest = *DestBits;
|
Source = 0;
|
||||||
|
/* FIXME: This is incorrect! */
|
||||||
if (UsesSource)
|
for (Index = 31 - NoBits; Index >= 0; Index++)
|
||||||
{
|
Source |= (DIB_GetSource(SourceSurf, SourceX + Index, SourceY, ColorTranslation) << (31 - Index));
|
||||||
Source = 0;
|
|
||||||
for (Index = 0; Index < 8; Index++)
|
|
||||||
{
|
|
||||||
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index, SourceY, BltInfo->XlateSourceToDest) << (7 - Index);
|
|
||||||
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 8, SourceY, BltInfo->XlateSourceToDest) << (8 + (7 - Index));
|
|
||||||
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 16, SourceY, BltInfo->XlateSourceToDest) << (16 + (7 - Index));
|
|
||||||
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 24, SourceY, BltInfo->XlateSourceToDest) << (24 + (7 - Index));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (BltInfo->PatternSurface)
|
|
||||||
{
|
|
||||||
Pattern = 0;
|
|
||||||
for (Index = 0; Index < 8; Index++)
|
|
||||||
{
|
|
||||||
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (7 - Index);
|
|
||||||
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 8) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (8 + (7 - Index));
|
|
||||||
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 16) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (16 + (7 - Index));
|
|
||||||
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 24) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (24 + (7 - Index));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*DestBits = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DestX < BltInfo->DestRect.right)
|
|
||||||
{
|
|
||||||
for (; DestX < BltInfo->DestRect.right; DestX++, SourceX++)
|
|
||||||
{
|
|
||||||
Dest = DIB_1BPP_GetPixel(BltInfo->DestSurface, DestX, DestY);
|
|
||||||
|
|
||||||
if (UsesSource)
|
|
||||||
{
|
|
||||||
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (BltInfo->PatternSurface)
|
|
||||||
{
|
|
||||||
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
|
|
||||||
}
|
|
||||||
|
|
||||||
DIB_1BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceY++;
|
|
||||||
if (BltInfo->PatternSurface)
|
if (BltInfo->PatternSurface)
|
||||||
{
|
{
|
||||||
PatternY++;
|
Pattern = 0;
|
||||||
PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
|
for (k = 31 - NoBits; k >= 0; k++)
|
||||||
|
Pattern |= (DIB_GetSource(PatternObj, (X + BrushOrigin.x + k) % PatternWidth, PatternY, BltInfo->XlatePatternToDest) << (31 - k));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
Dest = DIB_DoRop(Rop4, Dest, Source, Pattern);
|
||||||
|
Dest &= ~((1 << (31 - NoBits)) - 1);
|
||||||
|
Dest |= *((PBYTE)DestBits) & ((1 << (31 - NoBits)) - 1);
|
||||||
|
|
||||||
|
*DestBits = Dest;
|
||||||
|
|
||||||
|
DestX += NoBits;
|
||||||
|
SourceX += NoBits;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; DestX < RoundedRight; DestX += 32, DestBits++, SourceX += 32)
|
||||||
|
{
|
||||||
|
Dest = *DestBits;
|
||||||
|
|
||||||
|
if (UsesSource)
|
||||||
|
{
|
||||||
|
Source = 0;
|
||||||
|
for (Index = 0; Index < 8; Index++)
|
||||||
|
{
|
||||||
|
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index, SourceY, BltInfo->XlateSourceToDest) << (7 - Index);
|
||||||
|
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 8, SourceY, BltInfo->XlateSourceToDest) << (8 + (7 - Index));
|
||||||
|
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 16, SourceY, BltInfo->XlateSourceToDest) << (16 + (7 - Index));
|
||||||
|
Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 24, SourceY, BltInfo->XlateSourceToDest) << (24 + (7 - Index));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BltInfo->PatternSurface)
|
||||||
|
{
|
||||||
|
Pattern = 0;
|
||||||
|
for (Index = 0; Index < 8; Index++)
|
||||||
|
{
|
||||||
|
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (7 - Index);
|
||||||
|
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 8) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (8 + (7 - Index));
|
||||||
|
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 16) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (16 + (7 - Index));
|
||||||
|
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 24) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (24 + (7 - Index));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*DestBits = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DestX < BltInfo->DestRect.right)
|
||||||
|
{
|
||||||
|
for (; DestX < BltInfo->DestRect.right; DestX++, SourceX++)
|
||||||
|
{
|
||||||
|
Dest = DIB_1BPP_GetPixel(BltInfo->DestSurface, DestX, DestY);
|
||||||
|
|
||||||
|
if (UsesSource)
|
||||||
|
{
|
||||||
|
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BltInfo->PatternSurface)
|
||||||
|
{
|
||||||
|
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
|
||||||
|
}
|
||||||
|
|
||||||
|
DIB_1BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceY++;
|
||||||
|
if (BltInfo->PatternSurface)
|
||||||
|
{
|
||||||
|
PatternY++;
|
||||||
|
PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BitBlt Optimize */
|
/* BitBlt Optimize */
|
||||||
|
@ -471,12 +462,11 @@ DIB_1BPP_ColorFill(SURFOBJ* DestSurface, RECTL* DestRect, ULONG color)
|
||||||
{
|
{
|
||||||
ULONG DestY;
|
ULONG DestY;
|
||||||
|
|
||||||
for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
|
for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
|
||||||
{
|
{
|
||||||
DIB_1BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
|
DIB_1BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
|
||||||
}
|
}
|
||||||
|
return TRUE;
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
|
|
@ -1,22 +1,12 @@
|
||||||
/*
|
/*
|
||||||
* ReactOS W32 Subsystem
|
* PROJECT: Win32 subsystem
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
* LICENSE: See COPYING in the top level directory
|
||||||
*
|
* FILE: subsystems/win32/win32k/dib/dib24bpp.c
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* PURPOSE: Device Independant Bitmap functions, 24bpp
|
||||||
* it under the terms of the GNU General Public License as published by
|
* PROGRAMMERS: Jason Filby
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* Thomas Bluemel
|
||||||
* (at your option) any later version.
|
* Gregor Anich
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
*/
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
|
|
||||||
|
@ -47,7 +37,8 @@ DIB_24BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
LONG lDelta = SurfObj->lDelta;
|
LONG lDelta = SurfObj->lDelta;
|
||||||
|
|
||||||
c &= 0xFFFFFF;
|
c &= 0xFFFFFF;
|
||||||
while(y1++ < y2) {
|
while(y1++ < y2)
|
||||||
|
{
|
||||||
*(PUSHORT)(addr) = c & 0xFFFF;
|
*(PUSHORT)(addr) = c & 0xFFFF;
|
||||||
*(addr + 2) = c >> 16;
|
*(addr + 2) = c >> 16;
|
||||||
|
|
||||||
|
@ -129,7 +120,7 @@ DIB_24BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
*DestBits = xColor & 0xff;
|
*DestBits = xColor & 0xff;
|
||||||
*(PWORD)(DestBits + 1) = xColor >> 8;
|
*(PWORD)(DestBits + 1) = xColor >> 8;
|
||||||
SourceBits += 1;
|
SourceBits += 1;
|
||||||
DestBits += 3;
|
DestBits += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceLine += BltInfo->SourceSurface->lDelta;
|
SourceLine += BltInfo->SourceSurface->lDelta;
|
||||||
|
@ -162,44 +153,44 @@ DIB_24BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
case BMF_24BPP:
|
case BMF_24BPP:
|
||||||
if (NULL == BltInfo->XlateSourceToDest || 0 != (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL))
|
if (NULL == BltInfo->XlateSourceToDest || 0 != (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL))
|
||||||
{
|
{
|
||||||
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
|
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
|
||||||
{
|
{
|
||||||
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x;
|
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x;
|
||||||
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
||||||
{
|
{
|
||||||
RtlMoveMemory(DestBits, SourceBits, 3 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
|
RtlMoveMemory(DestBits, SourceBits, 3 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
|
||||||
SourceBits += BltInfo->SourceSurface->lDelta;
|
SourceBits += BltInfo->SourceSurface->lDelta;
|
||||||
DestBits += BltInfo->DestSurface->lDelta;
|
DestBits += BltInfo->DestSurface->lDelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x;
|
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x;
|
||||||
DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 3 * BltInfo->DestRect.left;
|
DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 3 * BltInfo->DestRect.left;
|
||||||
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
|
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
|
||||||
{
|
{
|
||||||
RtlMoveMemory(DestBits, SourceBits, 3 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
|
RtlMoveMemory(DestBits, SourceBits, 3 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
|
||||||
SourceBits -= BltInfo->SourceSurface->lDelta;
|
SourceBits -= BltInfo->SourceSurface->lDelta;
|
||||||
DestBits -= BltInfo->DestSurface->lDelta;
|
DestBits -= BltInfo->DestSurface->lDelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sx = BltInfo->SourcePoint.x;
|
sx = BltInfo->SourcePoint.x;
|
||||||
sy = BltInfo->SourcePoint.y;
|
sy = BltInfo->SourcePoint.y;
|
||||||
|
|
||||||
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
||||||
{
|
|
||||||
sx = BltInfo->SourcePoint.x;
|
|
||||||
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
|
||||||
{
|
{
|
||||||
DWORD pixel = DIB_24BPP_GetPixel(BltInfo->SourceSurface, sx, sy);
|
sx = BltInfo->SourcePoint.x;
|
||||||
DIB_24BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, pixel));
|
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
||||||
sx++;
|
{
|
||||||
|
DWORD pixel = DIB_24BPP_GetPixel(BltInfo->SourceSurface, sx, sy);
|
||||||
|
DIB_24BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, pixel));
|
||||||
|
sx++;
|
||||||
|
}
|
||||||
|
sy++;
|
||||||
}
|
}
|
||||||
sy++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -218,7 +209,7 @@ DIB_24BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
*DestBits = xColor & 0xff;
|
*DestBits = xColor & 0xff;
|
||||||
*(PWORD)(DestBits + 1) = xColor >> 8;
|
*(PWORD)(DestBits + 1) = xColor >> 8;
|
||||||
SourceBits += 4;
|
SourceBits += 4;
|
||||||
DestBits += 3;
|
DestBits += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceLine += BltInfo->SourceSurface->lDelta;
|
SourceLine += BltInfo->SourceSurface->lDelta;
|
||||||
|
@ -333,17 +324,17 @@ DIB_24BPP_ColorFill(SURFOBJ* DestSurface, RECTL* DestRect, ULONG color)
|
||||||
addr += 1;
|
addr += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Align to 4-byte address */
|
/* Align to 4-byte address */
|
||||||
while (0 != ((ULONG_PTR) addr & 0x3))
|
while (0 != ((ULONG_PTR) addr & 0x3))
|
||||||
{
|
{
|
||||||
*(PUSHORT)(addr) = color;
|
*(PUSHORT)(addr) = color;
|
||||||
addr += 2;
|
addr += 2;
|
||||||
*(addr) = color >> 16;
|
*(addr) = color >> 16;
|
||||||
addr += 1;
|
addr += 1;
|
||||||
Count--;
|
Count--;
|
||||||
}
|
}
|
||||||
/* If the color we need to fill with is 0ABC, then the final mem pattern
|
/* If the color we need to fill with is 0ABC, then the final mem pattern
|
||||||
* (note little-endianness) would be:
|
* (note little-endianness) would be:
|
||||||
*
|
*
|
||||||
|
@ -384,22 +375,22 @@ DIB_24BPP_ColorFill(SURFOBJ* DestSurface, RECTL* DestRect, ULONG color)
|
||||||
: "=m"(addr)
|
: "=m"(addr)
|
||||||
: "m"(color), "m"(Count), "m"(addr)
|
: "m"(color), "m"(Count), "m"(addr)
|
||||||
: "%eax", "%ebx", "%ecx", "%edx", "%edi");
|
: "%eax", "%ebx", "%ecx", "%edx", "%edi");
|
||||||
Count = Count & 0x03;
|
Count = Count & 0x03;
|
||||||
while (0 != Count--)
|
while (0 != Count--)
|
||||||
{
|
{
|
||||||
*(PUSHORT)(addr) = color;
|
*(PUSHORT)(addr) = color;
|
||||||
addr += 2;
|
addr += 2;
|
||||||
*(addr) = color >> 16;
|
*(addr) = color >> 16;
|
||||||
addr += 1;
|
addr += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
|
for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
|
||||||
{
|
{
|
||||||
DIB_24BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
|
DIB_24BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,11 @@
|
||||||
/*
|
/*
|
||||||
* ReactOS W32 Subsystem
|
* PROJECT: Win32 subsystem
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
* LICENSE: See COPYING in the top level directory
|
||||||
*
|
* FILE: subsystems/win32/win32k/dib/dib24bppc.c
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* PURPOSE: C language equivalents of asm optimised 24bpp functions
|
||||||
* it under the terms of the GNU General Public License as published by
|
* PROGRAMMERS: Jason Filby
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* Magnus Olsen
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
*/
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
|
|
||||||
|
@ -29,64 +18,63 @@ DIB_24BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
PBYTE addr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + (x1 << 1) + x1;
|
PBYTE addr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + (x1 << 1) + x1;
|
||||||
ULONG Count = x2 - x1;
|
ULONG Count = x2 - x1;
|
||||||
|
|
||||||
|
|
||||||
if (Count < 8)
|
if (Count < 8)
|
||||||
|
{
|
||||||
|
/* For small fills, don't bother doing anything fancy */
|
||||||
|
while (Count--)
|
||||||
{
|
{
|
||||||
/* For small fills, don't bother doing anything fancy */
|
*(PUSHORT)(addr) = c;
|
||||||
while (Count--)
|
addr += 2;
|
||||||
{
|
*(addr) = c >> 16;
|
||||||
*(PUSHORT)(addr) = c;
|
addr += 1;
|
||||||
addr += 2;
|
|
||||||
*(addr) = c >> 16;
|
|
||||||
addr += 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
ULONG Fill[3];
|
||||||
|
ULONG MultiCount;
|
||||||
|
|
||||||
|
/* Align to 4-byte address */
|
||||||
|
while (0 != ((ULONG_PTR) addr & 0x3))
|
||||||
{
|
{
|
||||||
ULONG Fill[3];
|
*(PUSHORT)(addr) = c;
|
||||||
ULONG MultiCount;
|
addr += 2;
|
||||||
|
*(addr) = c >> 16;
|
||||||
/* Align to 4-byte address */
|
addr += 1;
|
||||||
while (0 != ((ULONG_PTR) addr & 0x3))
|
Count--;
|
||||||
{
|
|
||||||
*(PUSHORT)(addr) = c;
|
|
||||||
addr += 2;
|
|
||||||
*(addr) = c >> 16;
|
|
||||||
addr += 1;
|
|
||||||
Count--;
|
|
||||||
}
|
|
||||||
/* If the color we need to fill with is 0ABC, then the final mem pattern
|
|
||||||
* (note little-endianness) would be:
|
|
||||||
*
|
|
||||||
* |C.B.A|C.B.A|C.B.A|C.B.A| <- pixel borders
|
|
||||||
* |C.B.A.C|B.A.C.B|A.C.B.A| <- ULONG borders
|
|
||||||
*
|
|
||||||
* So, taking endianness into account again, we need to fill with these
|
|
||||||
* ULONGs: CABC BCAB ABCA */
|
|
||||||
|
|
||||||
c = c & 0xffffff; /* 0ABC */
|
|
||||||
Fill[0] = c | (c << 24); /* CABC */
|
|
||||||
Fill[1] = (c >> 8) | (c << 16); /* BCAB */
|
|
||||||
Fill[2] = (c << 8) | (c >> 16); /* ABCA */
|
|
||||||
MultiCount = Count / 4;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
*(PULONG)addr = Fill[0];
|
|
||||||
addr += 4;
|
|
||||||
*(PULONG)addr = Fill[1];
|
|
||||||
addr += 4;
|
|
||||||
*(PULONG)addr = Fill[2];
|
|
||||||
addr += 4;
|
|
||||||
}
|
|
||||||
while (0 != --MultiCount);
|
|
||||||
|
|
||||||
Count = Count & 0x03;
|
|
||||||
while (0 != Count--)
|
|
||||||
{
|
|
||||||
*(PUSHORT)(addr) = c;
|
|
||||||
addr += 2;
|
|
||||||
*(addr) = c >> 16;
|
|
||||||
addr += 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
/* If the color we need to fill with is 0ABC, then the final mem pattern
|
||||||
|
* (note little-endianness) would be:
|
||||||
|
*
|
||||||
|
* |C.B.A|C.B.A|C.B.A|C.B.A| <- pixel borders
|
||||||
|
* |C.B.A.C|B.A.C.B|A.C.B.A| <- ULONG borders
|
||||||
|
*
|
||||||
|
* So, taking endianness into account again, we need to fill with these
|
||||||
|
* ULONGs: CABC BCAB ABCA */
|
||||||
|
|
||||||
|
c = c & 0xffffff; /* 0ABC */
|
||||||
|
Fill[0] = c | (c << 24); /* CABC */
|
||||||
|
Fill[1] = (c >> 8) | (c << 16); /* BCAB */
|
||||||
|
Fill[2] = (c << 8) | (c >> 16); /* ABCA */
|
||||||
|
MultiCount = Count / 4;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
*(PULONG)addr = Fill[0];
|
||||||
|
addr += 4;
|
||||||
|
*(PULONG)addr = Fill[1];
|
||||||
|
addr += 4;
|
||||||
|
*(PULONG)addr = Fill[2];
|
||||||
|
addr += 4;
|
||||||
|
}
|
||||||
|
while (0 != --MultiCount);
|
||||||
|
|
||||||
|
Count = Count & 0x03;
|
||||||
|
while (0 != Count--)
|
||||||
|
{
|
||||||
|
*(PUSHORT)(addr) = c;
|
||||||
|
addr += 2;
|
||||||
|
*(addr) = c >> 16;
|
||||||
|
addr += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,12 @@
|
||||||
/*
|
/*
|
||||||
* ReactOS W32 Subsystem
|
* PROJECT: Win32 subsystem
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
* LICENSE: See COPYING in the top level directory
|
||||||
*
|
* FILE: subsystems/win32/win32k/dib/dib32bpp.c
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* PURPOSE: Device Independant Bitmap functions, 32bpp
|
||||||
* it under the terms of the GNU General Public License as published by
|
* PROGRAMMERS: Jason Filby
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* Thomas Bluemel
|
||||||
* (at your option) any later version.
|
* Gregor Anich
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
*/
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
|
|
||||||
|
@ -26,271 +16,267 @@
|
||||||
VOID
|
VOID
|
||||||
DIB_32BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
|
DIB_32BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
|
||||||
{
|
{
|
||||||
PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta;
|
PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta;
|
||||||
PDWORD addr = (PDWORD)byteaddr + x;
|
PDWORD addr = (PDWORD)byteaddr + x;
|
||||||
|
|
||||||
*addr = c;
|
*addr = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
DIB_32BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
|
DIB_32BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
|
||||||
{
|
{
|
||||||
PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta;
|
PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta;
|
||||||
PDWORD addr = (PDWORD)byteaddr + x;
|
PDWORD addr = (PDWORD)byteaddr + x;
|
||||||
|
|
||||||
return (ULONG)(*addr);
|
return (ULONG)(*addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
DIB_32BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
DIB_32BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
{
|
{
|
||||||
|
PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y1 * SurfObj->lDelta;
|
||||||
|
PDWORD addr = (PDWORD)byteaddr + x;
|
||||||
|
LONG lDelta = SurfObj->lDelta >> 2; // >> 2 == / sizeof(DWORD)
|
||||||
|
|
||||||
|
byteaddr = (PBYTE)addr;
|
||||||
PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y1 * SurfObj->lDelta;
|
while (y1++ < y2)
|
||||||
PDWORD addr = (PDWORD)byteaddr + x;
|
{
|
||||||
LONG lDelta = SurfObj->lDelta >> 2; // >> 2 == / sizeof(DWORD)
|
*addr = (DWORD)c;
|
||||||
|
addr += lDelta;
|
||||||
byteaddr = (PBYTE)addr;
|
}
|
||||||
while (y1++ < y2)
|
|
||||||
{
|
|
||||||
*addr = (DWORD)c;
|
|
||||||
addr += lDelta;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
DIB_32BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
DIB_32BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
{
|
{
|
||||||
LONG i, j, sx, sy, xColor, f1;
|
LONG i, j, sx, sy, xColor, f1;
|
||||||
PBYTE SourceBits, DestBits, SourceLine, DestLine;
|
PBYTE SourceBits, DestBits, SourceLine, DestLine;
|
||||||
PBYTE SourceBits_4BPP, SourceLine_4BPP;
|
PBYTE SourceBits_4BPP, SourceLine_4BPP;
|
||||||
PDWORD Source32, Dest32;
|
PDWORD Source32, Dest32;
|
||||||
|
|
||||||
DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
|
DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
|
||||||
+ (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta)
|
+ (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta)
|
||||||
+ 4 * BltInfo->DestRect.left;
|
+ 4 * BltInfo->DestRect.left;
|
||||||
|
|
||||||
switch (BltInfo->SourceSurface->iBitmapFormat)
|
switch (BltInfo->SourceSurface->iBitmapFormat)
|
||||||
|
{
|
||||||
|
case BMF_1BPP:
|
||||||
|
|
||||||
|
sx = BltInfo->SourcePoint.x;
|
||||||
|
sy = BltInfo->SourcePoint.y;
|
||||||
|
|
||||||
|
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
||||||
{
|
{
|
||||||
case BMF_1BPP:
|
sx = BltInfo->SourcePoint.x;
|
||||||
|
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
||||||
sx = BltInfo->SourcePoint.x;
|
{
|
||||||
sy = BltInfo->SourcePoint.y;
|
if (DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
|
||||||
|
{
|
||||||
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
DIB_32BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
|
||||||
{
|
} else {
|
||||||
sx = BltInfo->SourcePoint.x;
|
DIB_32BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
|
||||||
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
}
|
||||||
{
|
sx++;
|
||||||
if (DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
|
}
|
||||||
{
|
sy++;
|
||||||
DIB_32BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
|
|
||||||
} else {
|
|
||||||
DIB_32BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
|
|
||||||
}
|
|
||||||
sx++;
|
|
||||||
}
|
|
||||||
sy++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BMF_4BPP:
|
|
||||||
SourceBits_4BPP = (PBYTE)BltInfo->SourceSurface->pvScan0
|
|
||||||
+ (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
|
|
||||||
+ (BltInfo->SourcePoint.x >> 1);
|
|
||||||
|
|
||||||
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
|
||||||
{
|
|
||||||
SourceLine_4BPP = SourceBits_4BPP;
|
|
||||||
sx = BltInfo->SourcePoint.x;
|
|
||||||
f1 = sx & 1;
|
|
||||||
|
|
||||||
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
|
||||||
{
|
|
||||||
xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
|
|
||||||
(*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
|
|
||||||
DIB_32BPP_PutPixel(BltInfo->DestSurface, i, j, xColor);
|
|
||||||
if (f1 == 1) {
|
|
||||||
SourceLine_4BPP++;
|
|
||||||
f1 = 0;
|
|
||||||
} else {
|
|
||||||
f1 = 1;
|
|
||||||
}
|
|
||||||
sx++;
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceBits_4BPP += BltInfo->SourceSurface->lDelta;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BMF_8BPP:
|
|
||||||
SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
|
|
||||||
DestLine = DestBits;
|
|
||||||
|
|
||||||
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
|
||||||
{
|
|
||||||
SourceBits = SourceLine;
|
|
||||||
DestBits = DestLine;
|
|
||||||
|
|
||||||
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
|
|
||||||
{
|
|
||||||
xColor = *SourceBits;
|
|
||||||
*((PDWORD) DestBits) = (DWORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
|
|
||||||
SourceBits += 1;
|
|
||||||
DestBits += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceLine += BltInfo->SourceSurface->lDelta;
|
|
||||||
DestLine += BltInfo->DestSurface->lDelta;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BMF_16BPP:
|
|
||||||
SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x;
|
|
||||||
DestLine = DestBits;
|
|
||||||
|
|
||||||
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
|
||||||
{
|
|
||||||
SourceBits = SourceLine;
|
|
||||||
DestBits = DestLine;
|
|
||||||
|
|
||||||
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
|
|
||||||
{
|
|
||||||
xColor = *((PWORD) SourceBits);
|
|
||||||
*((PDWORD) DestBits) = (DWORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
|
|
||||||
SourceBits += 2;
|
|
||||||
DestBits += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceLine += BltInfo->SourceSurface->lDelta;
|
|
||||||
DestLine += BltInfo->DestSurface->lDelta;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BMF_24BPP:
|
|
||||||
SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0
|
|
||||||
+ (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
|
|
||||||
+ 3 * BltInfo->SourcePoint.x;
|
|
||||||
DestLine = DestBits;
|
|
||||||
|
|
||||||
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
|
||||||
{
|
|
||||||
SourceBits = SourceLine;
|
|
||||||
DestBits = DestLine;
|
|
||||||
|
|
||||||
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
|
|
||||||
{
|
|
||||||
xColor = (*(SourceBits + 2) << 0x10) +
|
|
||||||
(*(SourceBits + 1) << 0x08) +
|
|
||||||
(*(SourceBits));
|
|
||||||
*((PDWORD)DestBits) = (DWORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
|
|
||||||
SourceBits += 3;
|
|
||||||
DestBits += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceLine += BltInfo->SourceSurface->lDelta;
|
|
||||||
DestLine += BltInfo->DestSurface->lDelta;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BMF_32BPP:
|
|
||||||
if (NULL == BltInfo->XlateSourceToDest ||
|
|
||||||
0 != (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL))
|
|
||||||
{
|
|
||||||
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
|
|
||||||
{
|
|
||||||
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
|
|
||||||
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
|
||||||
{
|
|
||||||
RtlMoveMemory(DestBits, SourceBits, 4 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
|
|
||||||
SourceBits += BltInfo->SourceSurface->lDelta;
|
|
||||||
DestBits += BltInfo->DestSurface->lDelta;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
|
|
||||||
+ ((BltInfo->SourcePoint.y
|
|
||||||
+ BltInfo->DestRect.bottom
|
|
||||||
- BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta)
|
|
||||||
+ 4 * BltInfo->SourcePoint.x;
|
|
||||||
DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 4 * BltInfo->DestRect.left;
|
|
||||||
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
|
|
||||||
{
|
|
||||||
RtlMoveMemory(DestBits, SourceBits, 4 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
|
|
||||||
SourceBits -= BltInfo->SourceSurface->lDelta;
|
|
||||||
DestBits -= BltInfo->DestSurface->lDelta;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
|
|
||||||
{
|
|
||||||
SourceBits = ((PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x);
|
|
||||||
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
|
||||||
{
|
|
||||||
if (BltInfo->DestRect.left < BltInfo->SourcePoint.x)
|
|
||||||
{
|
|
||||||
Dest32 = (DWORD *) DestBits;
|
|
||||||
Source32 = (DWORD *) SourceBits;
|
|
||||||
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
|
|
||||||
{
|
|
||||||
*Dest32++ = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32++);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Dest32 = (DWORD *) DestBits + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
|
|
||||||
Source32 = (DWORD *) SourceBits + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
|
|
||||||
for (i = BltInfo->DestRect.right - 1; BltInfo->DestRect.left <= i; i--)
|
|
||||||
{
|
|
||||||
*Dest32-- = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32--);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SourceBits += BltInfo->SourceSurface->lDelta;
|
|
||||||
DestBits += BltInfo->DestSurface->lDelta;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
|
|
||||||
DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 4 * BltInfo->DestRect.left;
|
|
||||||
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
|
|
||||||
{
|
|
||||||
if (BltInfo->DestRect.left < BltInfo->SourcePoint.x)
|
|
||||||
{
|
|
||||||
Dest32 = (DWORD *) DestBits;
|
|
||||||
Source32 = (DWORD *) SourceBits;
|
|
||||||
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
|
|
||||||
{
|
|
||||||
*Dest32++ = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32++);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Dest32 = (DWORD *) DestBits + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
|
|
||||||
Source32 = (DWORD *) SourceBits + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
|
|
||||||
for (i = BltInfo->DestRect.right - 1; BltInfo->DestRect.left <= i; i--)
|
|
||||||
{
|
|
||||||
*Dest32-- = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32--);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SourceBits -= BltInfo->SourceSurface->lDelta;
|
|
||||||
DestBits -= BltInfo->DestSurface->lDelta;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
DPRINT1("DIB_32BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
return TRUE;
|
case BMF_4BPP:
|
||||||
|
SourceBits_4BPP = (PBYTE)BltInfo->SourceSurface->pvScan0
|
||||||
|
+ (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
|
||||||
|
+ (BltInfo->SourcePoint.x >> 1);
|
||||||
|
|
||||||
|
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
|
||||||
|
{
|
||||||
|
SourceLine_4BPP = SourceBits_4BPP;
|
||||||
|
sx = BltInfo->SourcePoint.x;
|
||||||
|
f1 = sx & 1;
|
||||||
|
|
||||||
|
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
||||||
|
{
|
||||||
|
xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
|
||||||
|
(*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
|
||||||
|
DIB_32BPP_PutPixel(BltInfo->DestSurface, i, j, xColor);
|
||||||
|
if (f1 == 1) {
|
||||||
|
SourceLine_4BPP++;
|
||||||
|
f1 = 0;
|
||||||
|
} else {
|
||||||
|
f1 = 1;
|
||||||
|
}
|
||||||
|
sx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceBits_4BPP += BltInfo->SourceSurface->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BMF_8BPP:
|
||||||
|
SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
|
||||||
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
||||||
|
{
|
||||||
|
SourceBits = SourceLine;
|
||||||
|
DestBits = DestLine;
|
||||||
|
|
||||||
|
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
|
||||||
|
{
|
||||||
|
xColor = *SourceBits;
|
||||||
|
*((PDWORD) DestBits) = (DWORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
|
||||||
|
SourceBits += 1;
|
||||||
|
DestBits += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLine += BltInfo->SourceSurface->lDelta;
|
||||||
|
DestLine += BltInfo->DestSurface->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BMF_16BPP:
|
||||||
|
SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x;
|
||||||
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
||||||
|
{
|
||||||
|
SourceBits = SourceLine;
|
||||||
|
DestBits = DestLine;
|
||||||
|
|
||||||
|
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
|
||||||
|
{
|
||||||
|
xColor = *((PWORD) SourceBits);
|
||||||
|
*((PDWORD) DestBits) = (DWORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
|
||||||
|
SourceBits += 2;
|
||||||
|
DestBits += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLine += BltInfo->SourceSurface->lDelta;
|
||||||
|
DestLine += BltInfo->DestSurface->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BMF_24BPP:
|
||||||
|
SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0
|
||||||
|
+ (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
|
||||||
|
+ 3 * BltInfo->SourcePoint.x;
|
||||||
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
||||||
|
{
|
||||||
|
SourceBits = SourceLine;
|
||||||
|
DestBits = DestLine;
|
||||||
|
|
||||||
|
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
|
||||||
|
{
|
||||||
|
xColor = (*(SourceBits + 2) << 0x10) +
|
||||||
|
(*(SourceBits + 1) << 0x08) +
|
||||||
|
(*(SourceBits));
|
||||||
|
*((PDWORD)DestBits) = (DWORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
|
||||||
|
SourceBits += 3;
|
||||||
|
DestBits += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLine += BltInfo->SourceSurface->lDelta;
|
||||||
|
DestLine += BltInfo->DestSurface->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BMF_32BPP:
|
||||||
|
if (NULL == BltInfo->XlateSourceToDest ||
|
||||||
|
0 != (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL))
|
||||||
|
{
|
||||||
|
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
|
||||||
|
{
|
||||||
|
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
|
||||||
|
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
||||||
|
{
|
||||||
|
RtlMoveMemory(DestBits, SourceBits, 4 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
|
||||||
|
SourceBits += BltInfo->SourceSurface->lDelta;
|
||||||
|
DestBits += BltInfo->DestSurface->lDelta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
|
||||||
|
+ ((BltInfo->SourcePoint.y
|
||||||
|
+ BltInfo->DestRect.bottom
|
||||||
|
- BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta)
|
||||||
|
+ 4 * BltInfo->SourcePoint.x;
|
||||||
|
DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 4 * BltInfo->DestRect.left;
|
||||||
|
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
|
||||||
|
{
|
||||||
|
RtlMoveMemory(DestBits, SourceBits, 4 * (BltInfo->DestRect.right - BltInfo->DestRect.left));
|
||||||
|
SourceBits -= BltInfo->SourceSurface->lDelta;
|
||||||
|
DestBits -= BltInfo->DestSurface->lDelta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
|
||||||
|
{
|
||||||
|
SourceBits = ((PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x);
|
||||||
|
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
||||||
|
{
|
||||||
|
if (BltInfo->DestRect.left < BltInfo->SourcePoint.x)
|
||||||
|
{
|
||||||
|
Dest32 = (DWORD *) DestBits;
|
||||||
|
Source32 = (DWORD *) SourceBits;
|
||||||
|
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
|
||||||
|
{
|
||||||
|
*Dest32++ = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Dest32 = (DWORD *) DestBits + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
|
||||||
|
Source32 = (DWORD *) SourceBits + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
|
||||||
|
for (i = BltInfo->DestRect.right - 1; BltInfo->DestRect.left <= i; i--)
|
||||||
|
{
|
||||||
|
*Dest32-- = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32--);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SourceBits += BltInfo->SourceSurface->lDelta;
|
||||||
|
DestBits += BltInfo->DestSurface->lDelta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
|
||||||
|
DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 4 * BltInfo->DestRect.left;
|
||||||
|
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
|
||||||
|
{
|
||||||
|
if (BltInfo->DestRect.left < BltInfo->SourcePoint.x)
|
||||||
|
{
|
||||||
|
Dest32 = (DWORD *) DestBits;
|
||||||
|
Source32 = (DWORD *) SourceBits;
|
||||||
|
for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
|
||||||
|
{
|
||||||
|
*Dest32++ = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Dest32 = (DWORD *) DestBits + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
|
||||||
|
Source32 = (DWORD *) SourceBits + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
|
||||||
|
for (i = BltInfo->DestRect.right - 1; BltInfo->DestRect.left <= i; i--)
|
||||||
|
{
|
||||||
|
*Dest32-- = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32--);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SourceBits -= BltInfo->SourceSurface->lDelta;
|
||||||
|
DestBits -= BltInfo->DestSurface->lDelta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
DPRINT1("DIB_32BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
@ -298,61 +284,61 @@ DIB_32BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
RECTL* DestRect, RECTL *SourceRect,
|
RECTL* DestRect, RECTL *SourceRect,
|
||||||
XLATEOBJ *ColorTranslation, ULONG iTransColor)
|
XLATEOBJ *ColorTranslation, ULONG iTransColor)
|
||||||
{
|
{
|
||||||
ULONG X, Y, SourceX, SourceY = 0, Source = 0, wd;
|
ULONG X, Y, SourceX, SourceY = 0, Source = 0, wd;
|
||||||
ULONG *DestBits;
|
ULONG *DestBits;
|
||||||
|
|
||||||
LONG DstHeight;
|
LONG DstHeight;
|
||||||
LONG DstWidth;
|
LONG DstWidth;
|
||||||
LONG SrcHeight;
|
LONG SrcHeight;
|
||||||
LONG SrcWidth;
|
LONG SrcWidth;
|
||||||
|
|
||||||
DstHeight = DestRect->bottom - DestRect->top;
|
DstHeight = DestRect->bottom - DestRect->top;
|
||||||
DstWidth = DestRect->right - DestRect->left;
|
DstWidth = DestRect->right - DestRect->left;
|
||||||
SrcHeight = SourceRect->bottom - SourceRect->top;
|
SrcHeight = SourceRect->bottom - SourceRect->top;
|
||||||
SrcWidth = SourceRect->right - SourceRect->left;
|
SrcWidth = SourceRect->right - SourceRect->left;
|
||||||
|
|
||||||
DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 +
|
DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 +
|
||||||
(DestRect->left << 2) +
|
(DestRect->left << 2) +
|
||||||
DestRect->top * DestSurf->lDelta);
|
DestRect->top * DestSurf->lDelta);
|
||||||
wd = DestSurf->lDelta - ((DestRect->right - DestRect->left) << 2);
|
wd = DestSurf->lDelta - ((DestRect->right - DestRect->left) << 2);
|
||||||
|
|
||||||
for (Y = DestRect->top; Y < DestRect->bottom; Y++)
|
for (Y = DestRect->top; Y < DestRect->bottom; Y++)
|
||||||
|
{
|
||||||
|
SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
|
||||||
|
for (X = DestRect->left; X < DestRect->right; X++, DestBits++)
|
||||||
{
|
{
|
||||||
SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
|
SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
|
||||||
for (X = DestRect->left; X < DestRect->right; X++, DestBits++)
|
if (SourceX >= 0 && SourceY >= 0 &&
|
||||||
|
SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
|
||||||
|
{
|
||||||
|
Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
|
||||||
|
if (Source != iTransColor)
|
||||||
{
|
{
|
||||||
SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
|
*DestBits = XLATEOBJ_iXlate(ColorTranslation, Source);
|
||||||
if (SourceX >= 0 && SourceY >= 0 &&
|
|
||||||
SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
|
|
||||||
{
|
|
||||||
Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
|
|
||||||
if (Source != iTransColor)
|
|
||||||
{
|
|
||||||
*DestBits = XLATEOBJ_iXlate(ColorTranslation, Source);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
DestBits = (ULONG*)((ULONG_PTR)DestBits + wd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
DestBits = (ULONG*)((ULONG_PTR)DestBits + wd);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
ULONG ul;
|
ULONG ul;
|
||||||
struct {
|
struct {
|
||||||
UCHAR red;
|
UCHAR red;
|
||||||
UCHAR green;
|
UCHAR green;
|
||||||
UCHAR blue;
|
UCHAR blue;
|
||||||
UCHAR alpha;
|
UCHAR alpha;
|
||||||
} col;
|
} col;
|
||||||
} NICEPIXEL32;
|
} NICEPIXEL32;
|
||||||
|
|
||||||
static __inline UCHAR
|
static __inline UCHAR
|
||||||
Clamp8(ULONG val)
|
Clamp8(ULONG val)
|
||||||
{
|
{
|
||||||
return (val > 255) ? 255 : val;
|
return (val > 255) ? 255 : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
@ -360,77 +346,77 @@ DIB_32BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
||||||
RECTL* SourceRect, CLIPOBJ* ClipRegion,
|
RECTL* SourceRect, CLIPOBJ* ClipRegion,
|
||||||
XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj)
|
XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj)
|
||||||
{
|
{
|
||||||
INT Rows, Cols, SrcX, SrcY;
|
INT Rows, Cols, SrcX, SrcY;
|
||||||
register PULONG Dst;
|
register PULONG Dst;
|
||||||
ULONG DstDelta;
|
ULONG DstDelta;
|
||||||
BLENDFUNCTION BlendFunc;
|
BLENDFUNCTION BlendFunc;
|
||||||
register NICEPIXEL32 DstPixel, SrcPixel;
|
register NICEPIXEL32 DstPixel, SrcPixel;
|
||||||
UCHAR Alpha, SrcBpp;
|
UCHAR Alpha, SrcBpp;
|
||||||
|
|
||||||
DPRINT("DIB_32BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
|
DPRINT("DIB_32BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
|
||||||
SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
|
SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
|
||||||
DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
|
DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
|
||||||
|
|
||||||
ASSERT(DestRect->bottom - DestRect->top == SourceRect->bottom - SourceRect->top &&
|
ASSERT(DestRect->bottom - DestRect->top == SourceRect->bottom - SourceRect->top &&
|
||||||
DestRect->right - DestRect->left == SourceRect->right - SourceRect->left);
|
DestRect->right - DestRect->left == SourceRect->right - SourceRect->left);
|
||||||
|
|
||||||
BlendFunc = BlendObj->BlendFunction;
|
BlendFunc = BlendObj->BlendFunction;
|
||||||
if (BlendFunc.BlendOp != AC_SRC_OVER)
|
if (BlendFunc.BlendOp != AC_SRC_OVER)
|
||||||
|
{
|
||||||
|
DPRINT1("BlendOp != AC_SRC_OVER\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (BlendFunc.BlendFlags != 0)
|
||||||
|
{
|
||||||
|
DPRINT1("BlendFlags != 0\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0)
|
||||||
|
{
|
||||||
|
DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 &&
|
||||||
|
BitsPerFormat(Source->iBitmapFormat) != 32)
|
||||||
|
{
|
||||||
|
DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dst = (PULONG)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) +
|
||||||
|
(DestRect->left << 2));
|
||||||
|
DstDelta = Dest->lDelta - ((DestRect->right - DestRect->left) << 2);
|
||||||
|
SrcBpp = BitsPerFormat(Source->iBitmapFormat);
|
||||||
|
|
||||||
|
Rows = DestRect->bottom - DestRect->top;
|
||||||
|
SrcY = SourceRect->top;
|
||||||
|
while (--Rows >= 0)
|
||||||
|
{
|
||||||
|
Cols = DestRect->right - DestRect->left;
|
||||||
|
SrcX = SourceRect->left;
|
||||||
|
while (--Cols >= 0)
|
||||||
{
|
{
|
||||||
DPRINT1("BlendOp != AC_SRC_OVER\n");
|
SrcPixel.ul = DIB_GetSource(Source, SrcX++, SrcY, ColorTranslation);
|
||||||
return FALSE;
|
SrcPixel.col.red = SrcPixel.col.red * BlendFunc.SourceConstantAlpha / 255;
|
||||||
}
|
SrcPixel.col.green = SrcPixel.col.green * BlendFunc.SourceConstantAlpha / 255;
|
||||||
if (BlendFunc.BlendFlags != 0)
|
SrcPixel.col.blue = SrcPixel.col.blue * BlendFunc.SourceConstantAlpha / 255;
|
||||||
{
|
SrcPixel.col.alpha = (SrcBpp == 32) ? (SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha / 255) : BlendFunc.SourceConstantAlpha;
|
||||||
DPRINT1("BlendFlags != 0\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0)
|
|
||||||
{
|
|
||||||
DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 &&
|
|
||||||
BitsPerFormat(Source->iBitmapFormat) != 32)
|
|
||||||
{
|
|
||||||
DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Dst = (PULONG)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) +
|
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
|
||||||
(DestRect->left << 2));
|
SrcPixel.col.alpha : BlendFunc.SourceConstantAlpha;
|
||||||
DstDelta = Dest->lDelta - ((DestRect->right - DestRect->left) << 2);
|
|
||||||
SrcBpp = BitsPerFormat(Source->iBitmapFormat);
|
|
||||||
|
|
||||||
Rows = DestRect->bottom - DestRect->top;
|
DstPixel.ul = *Dst;
|
||||||
SrcY = SourceRect->top;
|
DstPixel.col.red = Clamp8(DstPixel.col.red * (255 - Alpha) / 255 + SrcPixel.col.red);
|
||||||
while (--Rows >= 0)
|
DstPixel.col.green = Clamp8(DstPixel.col.green * (255 - Alpha) / 255 + SrcPixel.col.green);
|
||||||
{
|
DstPixel.col.blue = Clamp8(DstPixel.col.blue * (255 - Alpha) / 255 + SrcPixel.col.blue);
|
||||||
Cols = DestRect->right - DestRect->left;
|
DstPixel.col.alpha = Clamp8(DstPixel.col.alpha * (255 - Alpha) / 255 + SrcPixel.col.alpha);
|
||||||
SrcX = SourceRect->left;
|
*Dst++ = DstPixel.ul;
|
||||||
while (--Cols >= 0)
|
|
||||||
{
|
|
||||||
SrcPixel.ul = DIB_GetSource(Source, SrcX++, SrcY, ColorTranslation);
|
|
||||||
SrcPixel.col.red = SrcPixel.col.red * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel.col.green = SrcPixel.col.green * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel.col.blue = SrcPixel.col.blue * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel.col.alpha = (SrcBpp == 32) ? (SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha / 255) : BlendFunc.SourceConstantAlpha;
|
|
||||||
|
|
||||||
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
|
|
||||||
SrcPixel.col.alpha : BlendFunc.SourceConstantAlpha;
|
|
||||||
|
|
||||||
DstPixel.ul = *Dst;
|
|
||||||
DstPixel.col.red = Clamp8(DstPixel.col.red * (255 - Alpha) / 255 + SrcPixel.col.red);
|
|
||||||
DstPixel.col.green = Clamp8(DstPixel.col.green * (255 - Alpha) / 255 + SrcPixel.col.green);
|
|
||||||
DstPixel.col.blue = Clamp8(DstPixel.col.blue * (255 - Alpha) / 255 + SrcPixel.col.blue);
|
|
||||||
DstPixel.col.alpha = Clamp8(DstPixel.col.alpha * (255 - Alpha) / 255 + SrcPixel.col.alpha);
|
|
||||||
*Dst++ = DstPixel.ul;
|
|
||||||
}
|
|
||||||
Dst = (PULONG)((ULONG_PTR)Dst + DstDelta);
|
|
||||||
SrcY++;
|
|
||||||
}
|
}
|
||||||
|
Dst = (PULONG)((ULONG_PTR)Dst + DstDelta);
|
||||||
|
SrcY++;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,22 +1,11 @@
|
||||||
/*
|
/*
|
||||||
* ReactOS W32 Subsystem
|
* PROJECT: Win32 subsystem
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 2004, 2005, 2006 ReactOS Team
|
* LICENSE: See COPYING in the top level directory
|
||||||
*
|
* FILE: subsystems/win32/win32k/dib/dib32bppc.c
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* PURPOSE: C language equivalents of asm optimised 32bpp functions
|
||||||
* it under the terms of the GNU General Public License as published by
|
* PROGRAMMERS: Jason Filby
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* Magnus Olsen
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
*/
|
||||||
/* $Id: */
|
|
||||||
|
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
|
|
||||||
|
@ -26,27 +15,27 @@
|
||||||
VOID
|
VOID
|
||||||
DIB_32BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
DIB_32BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
{
|
{
|
||||||
PBYTE byteaddr = (PBYTE)((ULONG_PTR)SurfObj->pvScan0 + y * SurfObj->lDelta);
|
PBYTE byteaddr = (PBYTE)((ULONG_PTR)SurfObj->pvScan0 + y * SurfObj->lDelta);
|
||||||
PDWORD addr = (PDWORD)byteaddr + x1;
|
PDWORD addr = (PDWORD)byteaddr + x1;
|
||||||
LONG cx = x1;
|
LONG cx = x1;
|
||||||
|
|
||||||
while(cx < x2)
|
while(cx < x2)
|
||||||
{
|
{
|
||||||
*addr = (DWORD)c;
|
*addr = (DWORD)c;
|
||||||
++addr;
|
++addr;
|
||||||
++cx;
|
++cx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
DIB_32BPP_ColorFill(SURFOBJ* DestSurface, RECTL* DestRect, ULONG color)
|
DIB_32BPP_ColorFill(SURFOBJ* DestSurface, RECTL* DestRect, ULONG color)
|
||||||
{
|
{
|
||||||
ULONG DestY;
|
ULONG DestY;
|
||||||
|
|
||||||
for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
|
for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
|
||||||
{
|
{
|
||||||
DIB_32BPP_HLine (DestSurface, DestRect->left, DestRect->right, DestY, color);
|
DIB_32BPP_HLine (DestSurface, DestRect->left, DestRect->right, DestY, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,11 @@
|
||||||
/*
|
/*
|
||||||
* ReactOS W32 Subsystem
|
* PROJECT: Win32 subsystem
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
* LICENSE: See COPYING in the top level directory
|
||||||
*
|
* FILE: subsystems/win32/win32k/dib/dib4bpp.c
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* PURPOSE: Device Independant Bitmap functions, 4bpp
|
||||||
* it under the terms of the GNU General Public License as published by
|
* PROGRAMMERS: Jason Filby
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
*/
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
|
|
||||||
|
@ -43,7 +32,8 @@ DIB_4BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
PBYTE addr = (PBYTE)SurfObj->pvScan0 + (x1>>1) + y * SurfObj->lDelta;
|
PBYTE addr = (PBYTE)SurfObj->pvScan0 + (x1>>1) + y * SurfObj->lDelta;
|
||||||
LONG cx = x1;
|
LONG cx = x1;
|
||||||
|
|
||||||
while(cx < x2) {
|
while(cx < x2)
|
||||||
|
{
|
||||||
*addr = (*addr & notmask[x1&1]) | (c << ((1-(x1&1))<<2));
|
*addr = (*addr & notmask[x1&1]) | (c << ((1-(x1&1))<<2));
|
||||||
if((++x1 & 1) == 0)
|
if((++x1 & 1) == 0)
|
||||||
++addr;
|
++addr;
|
||||||
|
@ -58,7 +48,8 @@ DIB_4BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
int lDelta = SurfObj->lDelta;
|
int lDelta = SurfObj->lDelta;
|
||||||
|
|
||||||
addr += (x>>1) + y1 * lDelta;
|
addr += (x>>1) + y1 * lDelta;
|
||||||
while(y1++ < y2) {
|
while(y1++ < y2)
|
||||||
|
{
|
||||||
*addr = (*addr & notmask[x&1]) | (c << ((1-(x&1))<<2));
|
*addr = (*addr & notmask[x&1]) | (c << ((1-(x&1))<<2));
|
||||||
addr += lDelta;
|
addr += lDelta;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +81,9 @@ DIB_4BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
|
if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
|
||||||
{
|
{
|
||||||
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
|
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
|
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
|
||||||
}
|
}
|
||||||
sx++;
|
sx++;
|
||||||
|
@ -108,14 +101,14 @@ DIB_4BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
|
|
||||||
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
||||||
{
|
{
|
||||||
if (NULL != BltInfo->XlateSourceToDest)
|
if (NULL != BltInfo->XlateSourceToDest)
|
||||||
{
|
{
|
||||||
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_4BPP_GetPixel(BltInfo->SourceSurface, sx, sy)));
|
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_4BPP_GetPixel(BltInfo->SourceSurface, sx, sy)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, DIB_4BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
|
DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, DIB_4BPP_GetPixel(BltInfo->SourceSurface, sx, sy));
|
||||||
}
|
}
|
||||||
sx++;
|
sx++;
|
||||||
}
|
}
|
||||||
sy++;
|
sy++;
|
||||||
|
@ -227,138 +220,138 @@ DIB_4BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
DIB_4BPP_BitBlt(PBLTINFO BltInfo)
|
DIB_4BPP_BitBlt(PBLTINFO BltInfo)
|
||||||
{
|
{
|
||||||
ULONG DestX, DestY;
|
ULONG DestX, DestY;
|
||||||
ULONG SourceX, SourceY;
|
ULONG SourceX, SourceY;
|
||||||
ULONG PatternY = 0;
|
ULONG PatternY = 0;
|
||||||
ULONG Dest, Source = 0, Pattern = 0;
|
ULONG Dest, Source = 0, Pattern = 0;
|
||||||
BOOLEAN UsesSource;
|
BOOLEAN UsesSource;
|
||||||
BOOLEAN UsesPattern;
|
BOOLEAN UsesPattern;
|
||||||
PULONG DestBits;
|
PULONG DestBits;
|
||||||
LONG RoundedRight;
|
LONG RoundedRight;
|
||||||
static const ULONG ExpandSolidColor[16] =
|
static const ULONG ExpandSolidColor[16] =
|
||||||
{
|
{
|
||||||
0x00000000 /* 0 */,
|
0x00000000 /* 0 */,
|
||||||
0x11111111 /* 1 */,
|
0x11111111 /* 1 */,
|
||||||
0x22222222 /* 2 */,
|
0x22222222 /* 2 */,
|
||||||
0x33333333 /* 3 */,
|
0x33333333 /* 3 */,
|
||||||
0x44444444 /* 4 */,
|
0x44444444 /* 4 */,
|
||||||
0x55555555 /* 5 */,
|
0x55555555 /* 5 */,
|
||||||
0x66666666 /* 6 */,
|
0x66666666 /* 6 */,
|
||||||
0x77777777 /* 7 */,
|
0x77777777 /* 7 */,
|
||||||
0x88888888 /* 8 */,
|
0x88888888 /* 8 */,
|
||||||
0x99999999 /* 9 */,
|
0x99999999 /* 9 */,
|
||||||
0xAAAAAAAA /* 10 */,
|
0xAAAAAAAA /* 10 */,
|
||||||
0xBBBBBBBB /* 11 */,
|
0xBBBBBBBB /* 11 */,
|
||||||
0xCCCCCCCC /* 12 */,
|
0xCCCCCCCC /* 12 */,
|
||||||
0xDDDDDDDD /* 13 */,
|
0xDDDDDDDD /* 13 */,
|
||||||
0xEEEEEEEE /* 14 */,
|
0xEEEEEEEE /* 14 */,
|
||||||
0xFFFFFFFF /* 15 */,
|
0xFFFFFFFF /* 15 */,
|
||||||
};
|
};
|
||||||
|
|
||||||
UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4);
|
UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4);
|
||||||
UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4);
|
UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4);
|
||||||
|
|
||||||
SourceY = BltInfo->SourcePoint.y;
|
SourceY = BltInfo->SourcePoint.y;
|
||||||
RoundedRight = BltInfo->DestRect.right -
|
RoundedRight = BltInfo->DestRect.right -
|
||||||
((BltInfo->DestRect.right - BltInfo->DestRect.left) & 0x7);
|
((BltInfo->DestRect.right - BltInfo->DestRect.left) & 0x7);
|
||||||
|
|
||||||
|
if (UsesPattern)
|
||||||
|
{
|
||||||
|
if (BltInfo->PatternSurface)
|
||||||
|
{
|
||||||
|
PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
|
||||||
|
BltInfo->PatternSurface->sizlBitmap.cy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (BltInfo->Brush)
|
||||||
|
Pattern = ExpandSolidColor[BltInfo->Brush->iSolidColor];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
|
||||||
|
{
|
||||||
|
DestBits = (PULONG)(
|
||||||
|
(PBYTE)BltInfo->DestSurface->pvScan0 +
|
||||||
|
(BltInfo->DestRect.left >> 1) +
|
||||||
|
DestY * BltInfo->DestSurface->lDelta);
|
||||||
|
SourceX = BltInfo->SourcePoint.x;
|
||||||
|
DestX = BltInfo->DestRect.left;
|
||||||
|
|
||||||
|
if (DestX & 0x1)
|
||||||
|
{
|
||||||
|
Dest = DIB_4BPP_GetPixel(BltInfo->DestSurface, DestX, DestY);
|
||||||
|
|
||||||
|
if (UsesSource)
|
||||||
|
{
|
||||||
|
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
|
||||||
|
}
|
||||||
|
|
||||||
if (UsesPattern)
|
|
||||||
{
|
|
||||||
if (BltInfo->PatternSurface)
|
if (BltInfo->PatternSurface)
|
||||||
{
|
{
|
||||||
PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
|
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
|
||||||
BltInfo->PatternSurface->sizlBitmap.cy;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
DIB_4BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xF);
|
||||||
|
|
||||||
|
DestX++;
|
||||||
|
SourceX++;
|
||||||
|
DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; DestX < RoundedRight; DestX += 8, SourceX += 8, DestBits++)
|
||||||
|
{
|
||||||
|
Dest = *DestBits;
|
||||||
|
if (UsesSource)
|
||||||
{
|
{
|
||||||
if (BltInfo->Brush)
|
Source =
|
||||||
Pattern = ExpandSolidColor[BltInfo->Brush->iSolidColor];
|
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 1, SourceY, BltInfo->XlateSourceToDest)) |
|
||||||
|
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 0, SourceY, BltInfo->XlateSourceToDest) << 4) |
|
||||||
|
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 3, SourceY, BltInfo->XlateSourceToDest) << 8) |
|
||||||
|
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 2, SourceY, BltInfo->XlateSourceToDest) << 12) |
|
||||||
|
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 5, SourceY, BltInfo->XlateSourceToDest) << 16) |
|
||||||
|
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 4, SourceY, BltInfo->XlateSourceToDest) << 20) |
|
||||||
|
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 7, SourceY, BltInfo->XlateSourceToDest) << 24) |
|
||||||
|
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 6, SourceY, BltInfo->XlateSourceToDest) << 28);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
|
|
||||||
{
|
|
||||||
DestBits = (PULONG)(
|
|
||||||
(PBYTE)BltInfo->DestSurface->pvScan0 +
|
|
||||||
(BltInfo->DestRect.left >> 1) +
|
|
||||||
DestY * BltInfo->DestSurface->lDelta);
|
|
||||||
SourceX = BltInfo->SourcePoint.x;
|
|
||||||
DestX = BltInfo->DestRect.left;
|
|
||||||
|
|
||||||
if (DestX & 0x1)
|
|
||||||
{
|
|
||||||
Dest = DIB_4BPP_GetPixel(BltInfo->DestSurface, DestX, DestY);
|
|
||||||
|
|
||||||
if (UsesSource)
|
|
||||||
{
|
|
||||||
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (BltInfo->PatternSurface)
|
|
||||||
{
|
|
||||||
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
|
|
||||||
}
|
|
||||||
|
|
||||||
DIB_4BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xF);
|
|
||||||
|
|
||||||
DestX++;
|
|
||||||
SourceX++;
|
|
||||||
DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; DestX < RoundedRight; DestX += 8, SourceX += 8, DestBits++)
|
|
||||||
{
|
|
||||||
Dest = *DestBits;
|
|
||||||
if (UsesSource)
|
|
||||||
{
|
|
||||||
Source =
|
|
||||||
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 1, SourceY, BltInfo->XlateSourceToDest)) |
|
|
||||||
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 0, SourceY, BltInfo->XlateSourceToDest) << 4) |
|
|
||||||
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 3, SourceY, BltInfo->XlateSourceToDest) << 8) |
|
|
||||||
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 2, SourceY, BltInfo->XlateSourceToDest) << 12) |
|
|
||||||
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 5, SourceY, BltInfo->XlateSourceToDest) << 16) |
|
|
||||||
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 4, SourceY, BltInfo->XlateSourceToDest) << 20) |
|
|
||||||
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 7, SourceY, BltInfo->XlateSourceToDest) << 24) |
|
|
||||||
(DIB_GetSource(BltInfo->SourceSurface, SourceX + 6, SourceY, BltInfo->XlateSourceToDest) << 28);
|
|
||||||
}
|
|
||||||
if (BltInfo->PatternSurface)
|
|
||||||
{
|
|
||||||
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 1) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
|
|
||||||
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 0) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 4;
|
|
||||||
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 3) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 8;
|
|
||||||
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 2) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 12;
|
|
||||||
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 5) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 16;
|
|
||||||
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 4) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 20;
|
|
||||||
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 7) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 24;
|
|
||||||
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 6) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 28;
|
|
||||||
}
|
|
||||||
*DestBits = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Process the rest of pixel on the line */
|
|
||||||
for (; DestX < BltInfo->DestRect.right; DestX++, SourceX++)
|
|
||||||
{
|
|
||||||
Dest = DIB_4BPP_GetPixel(BltInfo->DestSurface, DestX, DestY);
|
|
||||||
if (UsesSource)
|
|
||||||
{
|
|
||||||
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
|
|
||||||
}
|
|
||||||
if (BltInfo->PatternSurface)
|
|
||||||
{
|
|
||||||
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
|
|
||||||
}
|
|
||||||
DIB_4BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xF);
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceY++;
|
|
||||||
if (BltInfo->PatternSurface)
|
if (BltInfo->PatternSurface)
|
||||||
{
|
{
|
||||||
PatternY++;
|
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 1) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
|
||||||
PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
|
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 0) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 4;
|
||||||
|
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 3) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 8;
|
||||||
|
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 2) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 12;
|
||||||
|
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 5) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 16;
|
||||||
|
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 4) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 20;
|
||||||
|
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 7) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 24;
|
||||||
|
Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + 6) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << 28;
|
||||||
}
|
}
|
||||||
}
|
*DestBits = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
/* Process the rest of pixel on the line */
|
||||||
|
for (; DestX < BltInfo->DestRect.right; DestX++, SourceX++)
|
||||||
|
{
|
||||||
|
Dest = DIB_4BPP_GetPixel(BltInfo->DestSurface, DestX, DestY);
|
||||||
|
if (UsesSource)
|
||||||
|
{
|
||||||
|
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
|
||||||
|
}
|
||||||
|
if (BltInfo->PatternSurface)
|
||||||
|
{
|
||||||
|
Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
|
||||||
|
}
|
||||||
|
DIB_4BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xF);
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceY++;
|
||||||
|
if (BltInfo->PatternSurface)
|
||||||
|
{
|
||||||
|
PatternY++;
|
||||||
|
PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BitBlt Optimize */
|
/* BitBlt Optimize */
|
||||||
|
@ -367,12 +360,11 @@ DIB_4BPP_ColorFill(SURFOBJ* DestSurface, RECTL* DestRect, ULONG color)
|
||||||
{
|
{
|
||||||
ULONG DestY;
|
ULONG DestY;
|
||||||
|
|
||||||
for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
|
for (DestY = DestRect->top; DestY < DestRect->bottom; DestY++)
|
||||||
{
|
{
|
||||||
DIB_4BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
|
DIB_4BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
|
||||||
}
|
}
|
||||||
|
return TRUE;
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
|
|
@ -1,22 +1,12 @@
|
||||||
/*
|
/*
|
||||||
* ReactOS W32 Subsystem
|
* PROJECT: Win32 subsystem
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
* LICENSE: See COPYING in the top level directory
|
||||||
*
|
* FILE: subsystems/win32/win32k/dib/dib8bpp.c
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* PURPOSE: Device Independant Bitmap functions, 8bpp
|
||||||
* it under the terms of the GNU General Public License as published by
|
* PROGRAMMERS: Jason Filby
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* Thomas Bluemel
|
||||||
* (at your option) any later version.
|
* Gregor Anich
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
*/
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
|
|
||||||
|
@ -53,7 +43,8 @@ DIB_8BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
LONG lDelta = SurfObj->lDelta;
|
LONG lDelta = SurfObj->lDelta;
|
||||||
|
|
||||||
byteaddr = addr;
|
byteaddr = addr;
|
||||||
while(y1++ < y2) {
|
while(y1++ < y2)
|
||||||
|
{
|
||||||
*addr = c;
|
*addr = c;
|
||||||
|
|
||||||
addr += lDelta;
|
addr += lDelta;
|
||||||
|
@ -83,7 +74,9 @@ DIB_8BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
|
if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
|
||||||
{
|
{
|
||||||
DIB_8BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
|
DIB_8BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
DIB_8BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
|
DIB_8BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1));
|
||||||
}
|
}
|
||||||
sx++;
|
sx++;
|
||||||
|
@ -117,62 +110,62 @@ DIB_8BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
case BMF_8BPP:
|
case BMF_8BPP:
|
||||||
if (NULL == BltInfo->XlateSourceToDest || 0 != (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL))
|
if (NULL == BltInfo->XlateSourceToDest || 0 != (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL))
|
||||||
{
|
{
|
||||||
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
|
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
|
||||||
{
|
{
|
||||||
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
|
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
|
||||||
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
||||||
{
|
{
|
||||||
RtlMoveMemory(DestBits, SourceBits, BltInfo->DestRect.right - BltInfo->DestRect.left);
|
RtlMoveMemory(DestBits, SourceBits, BltInfo->DestRect.right - BltInfo->DestRect.left);
|
||||||
SourceBits += BltInfo->SourceSurface->lDelta;
|
SourceBits += BltInfo->SourceSurface->lDelta;
|
||||||
DestBits += BltInfo->DestSurface->lDelta;
|
DestBits += BltInfo->DestSurface->lDelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
|
SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
|
||||||
DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left;
|
DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left;
|
||||||
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
|
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
|
||||||
{
|
{
|
||||||
RtlMoveMemory(DestBits, SourceBits, BltInfo->DestRect.right - BltInfo->DestRect.left);
|
RtlMoveMemory(DestBits, SourceBits, BltInfo->DestRect.right - BltInfo->DestRect.left);
|
||||||
SourceBits -= BltInfo->SourceSurface->lDelta;
|
SourceBits -= BltInfo->SourceSurface->lDelta;
|
||||||
DestBits -= BltInfo->DestSurface->lDelta;
|
DestBits -= BltInfo->DestSurface->lDelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
|
if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
|
||||||
{
|
{
|
||||||
SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
|
SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
|
||||||
DestLine = DestBits;
|
DestLine = DestBits;
|
||||||
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
|
||||||
{
|
{
|
||||||
SourceBits = SourceLine;
|
SourceBits = SourceLine;
|
||||||
DestBits = DestLine;
|
DestBits = DestLine;
|
||||||
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
||||||
{
|
{
|
||||||
*DestBits++ = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits++);
|
*DestBits++ = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits++);
|
||||||
}
|
}
|
||||||
SourceLine += BltInfo->SourceSurface->lDelta;
|
SourceLine += BltInfo->SourceSurface->lDelta;
|
||||||
DestLine += BltInfo->DestSurface->lDelta;
|
DestLine += BltInfo->DestSurface->lDelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
|
SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
|
||||||
DestLine = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left;
|
DestLine = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left;
|
||||||
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
|
for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
|
||||||
{
|
{
|
||||||
SourceBits = SourceLine;
|
SourceBits = SourceLine;
|
||||||
DestBits = DestLine;
|
DestBits = DestLine;
|
||||||
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
|
||||||
{
|
{
|
||||||
*DestBits++ = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits++);
|
*DestBits++ = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits++);
|
||||||
}
|
}
|
||||||
SourceLine -= BltInfo->SourceSurface->lDelta;
|
SourceLine -= BltInfo->SourceSurface->lDelta;
|
||||||
DestLine -= BltInfo->DestSurface->lDelta;
|
DestLine -= BltInfo->DestSurface->lDelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -190,7 +183,7 @@ DIB_8BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
xColor = *((PWORD) SourceBits);
|
xColor = *((PWORD) SourceBits);
|
||||||
*DestBits = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
|
*DestBits = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
|
||||||
SourceBits += 2;
|
SourceBits += 2;
|
||||||
DestBits += 1;
|
DestBits += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceLine += BltInfo->SourceSurface->lDelta;
|
SourceLine += BltInfo->SourceSurface->lDelta;
|
||||||
|
@ -214,7 +207,7 @@ DIB_8BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
(*(SourceBits));
|
(*(SourceBits));
|
||||||
*DestBits = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
|
*DestBits = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
|
||||||
SourceBits += 3;
|
SourceBits += 3;
|
||||||
DestBits += 1;
|
DestBits += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceLine += BltInfo->SourceSurface->lDelta;
|
SourceLine += BltInfo->SourceSurface->lDelta;
|
||||||
|
@ -236,7 +229,7 @@ DIB_8BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
||||||
xColor = *((PDWORD) SourceBits);
|
xColor = *((PDWORD) SourceBits);
|
||||||
*DestBits = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
|
*DestBits = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
|
||||||
SourceBits += 4;
|
SourceBits += 4;
|
||||||
DestBits += 1;
|
DestBits += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceLine += BltInfo->SourceSurface->lDelta;
|
SourceLine += BltInfo->SourceSurface->lDelta;
|
||||||
|
@ -258,10 +251,9 @@ DIB_8BPP_ColorFill(SURFOBJ* DestSurface, RECTL* DestRect, ULONG color)
|
||||||
{
|
{
|
||||||
ULONG DestY;
|
ULONG DestY;
|
||||||
for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
|
for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
|
||||||
{
|
{
|
||||||
DIB_8BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
|
DIB_8BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,28 +364,28 @@ DIB_8BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
ULONG ul;
|
ULONG ul;
|
||||||
struct {
|
struct {
|
||||||
UCHAR red;
|
UCHAR red;
|
||||||
UCHAR green;
|
UCHAR green;
|
||||||
UCHAR blue;
|
UCHAR blue;
|
||||||
UCHAR alpha;
|
UCHAR alpha;
|
||||||
} col;
|
} col;
|
||||||
} NICEPIXEL32;
|
} NICEPIXEL32;
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
USHORT us;
|
USHORT us;
|
||||||
struct {
|
struct {
|
||||||
USHORT red:5,
|
USHORT red:5,
|
||||||
green:6,
|
green:6,
|
||||||
blue:5;
|
blue:5;
|
||||||
} col;
|
} col;
|
||||||
} NICEPIXEL16;
|
} NICEPIXEL16;
|
||||||
|
|
||||||
static __inline UCHAR
|
static __inline UCHAR
|
||||||
Clamp8(ULONG val)
|
Clamp8(ULONG val)
|
||||||
{
|
{
|
||||||
return (val > 255) ? 255 : val;
|
return (val > 255) ? 255 : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
@ -401,107 +393,107 @@ DIB_8BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
||||||
RECTL* SourceRect, CLIPOBJ* ClipRegion,
|
RECTL* SourceRect, CLIPOBJ* ClipRegion,
|
||||||
XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj)
|
XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj)
|
||||||
{
|
{
|
||||||
INT Rows, Cols, SrcX, SrcY;
|
INT Rows, Cols, SrcX, SrcY;
|
||||||
register PUCHAR Dst;
|
register PUCHAR Dst;
|
||||||
ULONG DstDelta;
|
ULONG DstDelta;
|
||||||
BLENDFUNCTION BlendFunc;
|
BLENDFUNCTION BlendFunc;
|
||||||
register NICEPIXEL32 DstPixel32;
|
register NICEPIXEL32 DstPixel32;
|
||||||
register NICEPIXEL32 SrcPixel32;
|
register NICEPIXEL32 SrcPixel32;
|
||||||
register NICEPIXEL16 SrcPixel16;
|
register NICEPIXEL16 SrcPixel16;
|
||||||
UCHAR Alpha, SrcBpp;
|
UCHAR Alpha, SrcBpp;
|
||||||
XLATEGDI* XlateGDI;
|
XLATEGDI* XlateGDI;
|
||||||
XLATEOBJ* SrcXlateObj;
|
XLATEOBJ* SrcXlateObj;
|
||||||
|
|
||||||
DPRINT("DIB_8BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
|
DPRINT("DIB_8BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
|
||||||
SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
|
SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
|
||||||
DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
|
DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
|
||||||
|
|
||||||
ASSERT(DestRect->bottom - DestRect->top == SourceRect->bottom - SourceRect->top &&
|
ASSERT(DestRect->bottom - DestRect->top == SourceRect->bottom - SourceRect->top &&
|
||||||
DestRect->right - DestRect->left == SourceRect->right - SourceRect->left);
|
DestRect->right - DestRect->left == SourceRect->right - SourceRect->left);
|
||||||
|
|
||||||
BlendFunc = BlendObj->BlendFunction;
|
BlendFunc = BlendObj->BlendFunction;
|
||||||
if (BlendFunc.BlendOp != AC_SRC_OVER)
|
if (BlendFunc.BlendOp != AC_SRC_OVER)
|
||||||
{
|
{
|
||||||
DPRINT1("BlendOp != AC_SRC_OVER\n");
|
DPRINT1("BlendOp != AC_SRC_OVER\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (BlendFunc.BlendFlags != 0)
|
if (BlendFunc.BlendFlags != 0)
|
||||||
{
|
{
|
||||||
DPRINT1("BlendFlags != 0\n");
|
DPRINT1("BlendFlags != 0\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0)
|
if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0)
|
||||||
{
|
{
|
||||||
DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat);
|
DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 &&
|
if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 &&
|
||||||
BitsPerFormat(Source->iBitmapFormat) != 32)
|
BitsPerFormat(Source->iBitmapFormat) != 32)
|
||||||
{
|
{
|
||||||
DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n");
|
DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!ColorTranslation)
|
if (!ColorTranslation)
|
||||||
{
|
{
|
||||||
DPRINT1("ColorTranslation must not be NULL!\n");
|
DPRINT1("ColorTranslation must not be NULL!\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
XlateGDI = ObjToGDI(ColorTranslation, XLATE);
|
XlateGDI = ObjToGDI(ColorTranslation, XLATE);
|
||||||
SrcXlateObj = IntEngCreateXlate(0, 0, XlateGDI->SourcePal, XlateGDI->DestPal);
|
SrcXlateObj = IntEngCreateXlate(0, 0, XlateGDI->SourcePal, XlateGDI->DestPal);
|
||||||
|
|
||||||
if (!SrcXlateObj)
|
if (!SrcXlateObj)
|
||||||
{
|
{
|
||||||
DPRINT1("IntEngCreateXlate failed\n");
|
DPRINT1("IntEngCreateXlate failed\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dst = (PUCHAR)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) +
|
Dst = (PUCHAR)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) +
|
||||||
DestRect->left);
|
DestRect->left);
|
||||||
DstDelta = Dest->lDelta - (DestRect->right - DestRect->left);
|
DstDelta = Dest->lDelta - (DestRect->right - DestRect->left);
|
||||||
SrcBpp = BitsPerFormat(Source->iBitmapFormat);
|
SrcBpp = BitsPerFormat(Source->iBitmapFormat);
|
||||||
|
|
||||||
Rows = DestRect->bottom - DestRect->top;
|
Rows = DestRect->bottom - DestRect->top;
|
||||||
SrcY = SourceRect->top;
|
SrcY = SourceRect->top;
|
||||||
while (--Rows >= 0)
|
while (--Rows >= 0)
|
||||||
{
|
{
|
||||||
Cols = DestRect->right - DestRect->left;
|
Cols = DestRect->right - DestRect->left;
|
||||||
SrcX = SourceRect->left;
|
SrcX = SourceRect->left;
|
||||||
while (--Cols >= 0)
|
while (--Cols >= 0)
|
||||||
|
{
|
||||||
|
if (SrcBpp <= 16)
|
||||||
{
|
{
|
||||||
if (SrcBpp <= 16)
|
SrcPixel16.us = DIB_GetSource(Source, SrcX++, SrcY, ColorTranslation);
|
||||||
{
|
SrcPixel32.col.red = (SrcPixel16.col.red << 3) | (SrcPixel16.col.red >> 2);
|
||||||
SrcPixel16.us = DIB_GetSource(Source, SrcX++, SrcY, ColorTranslation);
|
SrcPixel32.col.green = (SrcPixel16.col.green << 2) | (SrcPixel16.col.green >> 4);
|
||||||
SrcPixel32.col.red = (SrcPixel16.col.red << 3) | (SrcPixel16.col.red >> 2);
|
SrcPixel32.col.blue = (SrcPixel16.col.blue << 3) | (SrcPixel16.col.blue >> 2);
|
||||||
SrcPixel32.col.green = (SrcPixel16.col.green << 2) | (SrcPixel16.col.green >> 4);
|
|
||||||
SrcPixel32.col.blue = (SrcPixel16.col.blue << 3) | (SrcPixel16.col.blue >> 2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SrcPixel32.ul = DIB_GetSourceIndex(Source, SrcX++, SrcY);
|
|
||||||
}
|
|
||||||
SrcPixel32.col.red = SrcPixel32.col.red * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel32.col.green = SrcPixel32.col.green * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel32.col.blue = SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel32.col.alpha = (SrcBpp == 32) ? (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha / 255) : BlendFunc.SourceConstantAlpha;
|
|
||||||
|
|
||||||
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
|
|
||||||
SrcPixel32.col.alpha : BlendFunc.SourceConstantAlpha;
|
|
||||||
|
|
||||||
DstPixel32.ul = XLATEOBJ_iXlate(SrcXlateObj, *Dst);
|
|
||||||
SrcPixel32.col.red = Clamp8(DstPixel32.col.red * (255 - Alpha) / 255 + SrcPixel32.col.red);
|
|
||||||
SrcPixel32.col.green = Clamp8(DstPixel32.col.green * (255 - Alpha) / 255 + SrcPixel32.col.green);
|
|
||||||
SrcPixel32.col.blue = Clamp8(DstPixel32.col.blue * (255 - Alpha) / 255 + SrcPixel32.col.blue);
|
|
||||||
*Dst++ = XLATEOBJ_iXlate(ColorTranslation, SrcPixel32.ul);
|
|
||||||
}
|
}
|
||||||
Dst = (PUCHAR)((ULONG_PTR)Dst + DstDelta);
|
else
|
||||||
SrcY++;
|
{
|
||||||
}
|
SrcPixel32.ul = DIB_GetSourceIndex(Source, SrcX++, SrcY);
|
||||||
|
}
|
||||||
|
SrcPixel32.col.red = SrcPixel32.col.red * BlendFunc.SourceConstantAlpha / 255;
|
||||||
|
SrcPixel32.col.green = SrcPixel32.col.green * BlendFunc.SourceConstantAlpha / 255;
|
||||||
|
SrcPixel32.col.blue = SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha / 255;
|
||||||
|
SrcPixel32.col.alpha = (SrcBpp == 32) ? (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha / 255) : BlendFunc.SourceConstantAlpha;
|
||||||
|
|
||||||
if (SrcXlateObj)
|
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
|
||||||
EngDeleteXlate(SrcXlateObj);
|
SrcPixel32.col.alpha : BlendFunc.SourceConstantAlpha;
|
||||||
|
|
||||||
return TRUE;
|
DstPixel32.ul = XLATEOBJ_iXlate(SrcXlateObj, *Dst);
|
||||||
|
SrcPixel32.col.red = Clamp8(DstPixel32.col.red * (255 - Alpha) / 255 + SrcPixel32.col.red);
|
||||||
|
SrcPixel32.col.green = Clamp8(DstPixel32.col.green * (255 - Alpha) / 255 + SrcPixel32.col.green);
|
||||||
|
SrcPixel32.col.blue = Clamp8(DstPixel32.col.blue * (255 - Alpha) / 255 + SrcPixel32.col.blue);
|
||||||
|
*Dst++ = XLATEOBJ_iXlate(ColorTranslation, SrcPixel32.ul);
|
||||||
|
}
|
||||||
|
Dst = (PUCHAR)((ULONG_PTR)Dst + DstDelta);
|
||||||
|
SrcY++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SrcXlateObj)
|
||||||
|
EngDeleteXlate(SrcXlateObj);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,182 +0,0 @@
|
||||||
/*
|
|
||||||
* ReactOS W32 Subsystem
|
|
||||||
* Copyright (C) 2009 ReactOS Team
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <w32k.h>
|
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
BOOLEAN DIB_XXBPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, SURFOBJ *MaskSurf,
|
|
||||||
SURFOBJ *PatternSurface,
|
|
||||||
RECTL *DestRect, RECTL *SourceRect,
|
|
||||||
POINTL *MaskOrigin, BRUSHOBJ *Brush,
|
|
||||||
POINTL *BrushOrigin, XLATEOBJ *ColorTranslation,
|
|
||||||
XLATEOBJ *XlatePatternToDest, ROP4 ROP)
|
|
||||||
{
|
|
||||||
LONG sx = 0;
|
|
||||||
LONG sy = 0;
|
|
||||||
LONG DesX;
|
|
||||||
LONG DesY;
|
|
||||||
|
|
||||||
LONG DstHeight;
|
|
||||||
LONG DstWidth;
|
|
||||||
LONG SrcHeight;
|
|
||||||
LONG SrcWidth;
|
|
||||||
|
|
||||||
ULONG Color;
|
|
||||||
ULONG Dest, Source = 0, Pattern = 0;
|
|
||||||
ULONG xxBPPMask;
|
|
||||||
BOOLEAN CanDraw;
|
|
||||||
|
|
||||||
PFN_DIB_GetPixel fnSource_GetPixel = NULL;
|
|
||||||
PFN_DIB_GetPixel fnDest_GetPixel = NULL;
|
|
||||||
PFN_DIB_PutPixel fnDest_PutPixel = NULL;
|
|
||||||
PFN_DIB_GetPixel fnPattern_GetPixel = NULL;
|
|
||||||
PFN_DIB_GetPixel fnMask_GetPixel = NULL;
|
|
||||||
|
|
||||||
LONG PatternX = 0, PatternY = 0;
|
|
||||||
|
|
||||||
BOOL UsesSource = ROP4_USES_SOURCE(ROP);
|
|
||||||
BOOL UsesPattern = ROP4_USES_PATTERN(ROP);
|
|
||||||
|
|
||||||
fnDest_GetPixel = DibFunctionsForBitmapFormat[DestSurf->iBitmapFormat].DIB_GetPixel;
|
|
||||||
fnDest_PutPixel = DibFunctionsForBitmapFormat[DestSurf->iBitmapFormat].DIB_PutPixel;
|
|
||||||
|
|
||||||
DPRINT("Dest BPP: %u, dstRect: (%d,%d)-(%d,%d)\n",
|
|
||||||
BitsPerFormat(DestSurf->iBitmapFormat), DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
|
|
||||||
|
|
||||||
if (UsesSource)
|
|
||||||
{
|
|
||||||
fnSource_GetPixel = DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat].DIB_GetPixel;
|
|
||||||
DPRINT("Source BPP: %u, srcRect: (%d,%d)-(%d,%d)\n",
|
|
||||||
BitsPerFormat(SourceSurf->iBitmapFormat), SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MaskSurf)
|
|
||||||
{
|
|
||||||
fnMask_GetPixel = DibFunctionsForBitmapFormat[MaskSurf->iBitmapFormat].DIB_GetPixel;
|
|
||||||
}
|
|
||||||
|
|
||||||
DstHeight = DestRect->bottom - DestRect->top;
|
|
||||||
DstWidth = DestRect->right - DestRect->left;
|
|
||||||
SrcHeight = SourceRect->bottom - SourceRect->top;
|
|
||||||
SrcWidth = SourceRect->right - SourceRect->left;
|
|
||||||
|
|
||||||
/* FIXME : MaskOrigin? */
|
|
||||||
|
|
||||||
switch(DestSurf->iBitmapFormat)
|
|
||||||
{
|
|
||||||
case BMF_1BPP: xxBPPMask = 0x1; break;
|
|
||||||
case BMF_4BPP: xxBPPMask = 0xF; break;
|
|
||||||
case BMF_8BPP: xxBPPMask = 0xFF; break;
|
|
||||||
case BMF_16BPP: xxBPPMask = 0xFFFF; break;
|
|
||||||
case BMF_24BPP: xxBPPMask = 0xFFFFFF; break;
|
|
||||||
default:
|
|
||||||
xxBPPMask = 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (UsesPattern)
|
|
||||||
{
|
|
||||||
if (PatternSurface)
|
|
||||||
{
|
|
||||||
PatternY = (DestRect->top - BrushOrigin->y) % PatternSurface->sizlBitmap.cy;
|
|
||||||
if (PatternY < 0)
|
|
||||||
{
|
|
||||||
PatternY += PatternSurface->sizlBitmap.cy;
|
|
||||||
}
|
|
||||||
fnPattern_GetPixel = DibFunctionsForBitmapFormat[PatternSurface->iBitmapFormat].DIB_GetPixel;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Brush)
|
|
||||||
Pattern = Brush->iSolidColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (DesY = DestRect->top; DesY < DestRect->bottom; DesY++)
|
|
||||||
{
|
|
||||||
if (PatternSurface)
|
|
||||||
{
|
|
||||||
PatternX = (DestRect->left - BrushOrigin->x) % PatternSurface->sizlBitmap.cx;
|
|
||||||
if (PatternX < 0)
|
|
||||||
{
|
|
||||||
PatternX += PatternSurface->sizlBitmap.cx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (UsesSource)
|
|
||||||
sy = SourceRect->top+(DesY - DestRect->top) * SrcHeight / DstHeight;
|
|
||||||
|
|
||||||
for (DesX = DestRect->left; DesX < DestRect->right; DesX++)
|
|
||||||
{
|
|
||||||
CanDraw = TRUE;
|
|
||||||
|
|
||||||
if (fnMask_GetPixel)
|
|
||||||
{
|
|
||||||
sx = SourceRect->left+(DesX - DestRect->left) * SrcWidth / DstWidth;
|
|
||||||
if (sx < 0 || sy < 0 ||
|
|
||||||
MaskSurf->sizlBitmap.cx < sx || MaskSurf->sizlBitmap.cy < sy ||
|
|
||||||
fnMask_GetPixel(MaskSurf, sx, sy) != 0)
|
|
||||||
{
|
|
||||||
CanDraw = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (UsesSource && CanDraw)
|
|
||||||
{
|
|
||||||
sx = SourceRect->left+(DesX - DestRect->left) * SrcWidth / DstWidth;
|
|
||||||
if (sx >= 0 && sy >= 0 &&
|
|
||||||
SourceSurf->sizlBitmap.cx > sx && SourceSurf->sizlBitmap.cy > sy)
|
|
||||||
{
|
|
||||||
Source = XLATEOBJ_iXlate(ColorTranslation, fnSource_GetPixel(SourceSurf, sx, sy));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Source = 0;
|
|
||||||
CanDraw = (ROP3_TO_ROP4(SRCCOPY) != ROP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CanDraw)
|
|
||||||
{
|
|
||||||
if (PatternSurface)
|
|
||||||
{
|
|
||||||
Pattern = XLATEOBJ_iXlate(XlatePatternToDest, fnPattern_GetPixel(PatternSurface, PatternX, PatternY));
|
|
||||||
PatternX++;
|
|
||||||
PatternX %= PatternSurface->sizlBitmap.cx;
|
|
||||||
}
|
|
||||||
|
|
||||||
Dest = fnDest_GetPixel(DestSurf, DesX, DesY);
|
|
||||||
Color = DIB_DoRop(ROP, Dest, Source, Pattern) & xxBPPMask;
|
|
||||||
|
|
||||||
fnDest_PutPixel(DestSurf, DesX, DesY, Color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PatternSurface)
|
|
||||||
{
|
|
||||||
PatternY++;
|
|
||||||
PatternY %= PatternSurface->sizlBitmap.cy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOF */
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS win32 subsystem
|
* PROJECT: ReactOS win32 subsystem
|
||||||
* PURPOSE: Flood filling support
|
* PURPOSE: Flood filling support
|
||||||
* FILE: subsystems/win32/win32k/dib/floodfill.c
|
* FILE: subsystems/win32/win32k/dib/floodfill.c
|
||||||
* PROGRAMMER: Gregor Schneider, <grschneider AT gmail DOT com>
|
* PROGRAMMER: Gregor Schneider, <grschneider AT gmail DOT com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
|
|
||||||
|
@ -23,33 +23,33 @@
|
||||||
/* Floodfil helper structures and functions */
|
/* Floodfil helper structures and functions */
|
||||||
typedef struct _floodItem
|
typedef struct _floodItem
|
||||||
{
|
{
|
||||||
ULONG x;
|
ULONG x;
|
||||||
ULONG y;
|
ULONG y;
|
||||||
} FLOODITEM;
|
} FLOODITEM;
|
||||||
|
|
||||||
typedef struct _floodInfo
|
typedef struct _floodInfo
|
||||||
{
|
{
|
||||||
ULONG floodLen;
|
ULONG floodLen;
|
||||||
FLOODITEM *floodStart;
|
FLOODITEM *floodStart;
|
||||||
FLOODITEM *floodData;
|
FLOODITEM *floodData;
|
||||||
} FLOODINFO;
|
} FLOODINFO;
|
||||||
|
|
||||||
static __inline BOOL initFlood(FLOODINFO *info, RECTL *DstRect)
|
static __inline BOOL initFlood(FLOODINFO *info, RECTL *DstRect)
|
||||||
{
|
{
|
||||||
ULONG width = DstRect->right - DstRect->left;
|
ULONG width = DstRect->right - DstRect->left;
|
||||||
ULONG height = DstRect->bottom - DstRect->top;
|
ULONG height = DstRect->bottom - DstRect->top;
|
||||||
info->floodData = ExAllocatePoolWithTag(NonPagedPool, width * height * sizeof(FLOODITEM), TAG_DIB);
|
info->floodData = ExAllocatePoolWithTag(NonPagedPool, width * height * sizeof(FLOODITEM), TAG_DIB);
|
||||||
if (info->floodData == NULL)
|
if (info->floodData == NULL)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
info->floodStart = info->floodData + (width * height);
|
info->floodStart = info->floodData + (width * height);
|
||||||
DPRINT("Allocated flood stack from %p to %p\n", info->floodData, info->floodStart);
|
DPRINT("Allocated flood stack from %p to %p\n", info->floodData, info->floodStart);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
static __inline VOID finalizeFlood(FLOODINFO *info)
|
static __inline VOID finalizeFlood(FLOODINFO *info)
|
||||||
{
|
{
|
||||||
ExFreePoolWithTag(info->floodData, TAG_DIB);
|
ExFreePoolWithTag(info->floodData, TAG_DIB);
|
||||||
}
|
}
|
||||||
static __inline VOID addItemFlood(FLOODINFO *info,
|
static __inline VOID addItemFlood(FLOODINFO *info,
|
||||||
ULONG x,
|
ULONG x,
|
||||||
|
@ -59,29 +59,29 @@ static __inline VOID addItemFlood(FLOODINFO *info,
|
||||||
ULONG Color,
|
ULONG Color,
|
||||||
BOOL isSurf)
|
BOOL isSurf)
|
||||||
{
|
{
|
||||||
if (x >= DstRect->left && x <= DstRect->right &&
|
if (x >= DstRect->left && x <= DstRect->right &&
|
||||||
y >= DstRect->top && y <= DstRect->bottom)
|
y >= DstRect->top && y <= DstRect->bottom)
|
||||||
|
{
|
||||||
|
if (isSurf == TRUE &&
|
||||||
|
DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_GetPixel(DstSurf, x, y) != Color)
|
||||||
{
|
{
|
||||||
if (isSurf == TRUE &&
|
return;
|
||||||
DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_GetPixel(DstSurf, x, y) != Color)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (isSurf == FALSE &&
|
|
||||||
DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_GetPixel(DstSurf, x, y) == Color)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
info->floodStart--;
|
|
||||||
info->floodStart->x = x;
|
|
||||||
info->floodStart->y = y;
|
|
||||||
info->floodLen++;
|
|
||||||
}
|
}
|
||||||
|
else if (isSurf == FALSE &&
|
||||||
|
DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_GetPixel(DstSurf, x, y) == Color)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
info->floodStart--;
|
||||||
|
info->floodStart->x = x;
|
||||||
|
info->floodStart->y = y;
|
||||||
|
info->floodLen++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
static __inline VOID removeItemFlood(FLOODINFO *info)
|
static __inline VOID removeItemFlood(FLOODINFO *info)
|
||||||
{
|
{
|
||||||
info->floodStart++;
|
info->floodStart++;
|
||||||
info->floodLen--;
|
info->floodLen--;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN DIB_XXBPP_FloodFillSolid(SURFOBJ *DstSurf,
|
BOOLEAN DIB_XXBPP_FloodFillSolid(SURFOBJ *DstSurf,
|
||||||
|
@ -91,84 +91,84 @@ BOOLEAN DIB_XXBPP_FloodFillSolid(SURFOBJ *DstSurf,
|
||||||
ULONG ConvColor,
|
ULONG ConvColor,
|
||||||
UINT FillType)
|
UINT FillType)
|
||||||
{
|
{
|
||||||
ULONG x, y;
|
ULONG x, y;
|
||||||
ULONG BrushColor;
|
ULONG BrushColor;
|
||||||
FLOODINFO flood = {0, NULL, NULL};
|
FLOODINFO flood = {0, NULL, NULL};
|
||||||
|
|
||||||
BrushColor = Brush->iSolidColor;
|
BrushColor = Brush->iSolidColor;
|
||||||
x = Origin->x;
|
x = Origin->x;
|
||||||
y = Origin->y;
|
y = Origin->y;
|
||||||
|
|
||||||
if (FillType == FLOODFILLBORDER)
|
if (FillType == FLOODFILLBORDER)
|
||||||
|
{
|
||||||
|
/* Check if the start pixel has the border color */
|
||||||
|
if (DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_GetPixel(DstSurf, x, y) == ConvColor)
|
||||||
{
|
{
|
||||||
/* Check if the start pixel has the border color */
|
return FALSE;
|
||||||
if (DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_GetPixel(DstSurf, x, y) == ConvColor)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (initFlood(&flood, DstRect) == FALSE)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
addItemFlood(&flood, x, y, DstSurf, DstRect, ConvColor, FALSE);
|
|
||||||
while (flood.floodLen != 0)
|
|
||||||
{
|
|
||||||
x = flood.floodStart->x;
|
|
||||||
y = flood.floodStart->y;
|
|
||||||
removeItemFlood(&flood);
|
|
||||||
|
|
||||||
DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_PutPixel(DstSurf, x, y, BrushColor);
|
|
||||||
if (flood.floodStart - 4 < flood.floodData)
|
|
||||||
{
|
|
||||||
DPRINT1("Can't finish flooding!\n");
|
|
||||||
finalizeFlood(&flood);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
addItemFlood(&flood, x, y + 1, DstSurf, DstRect, ConvColor, FALSE);
|
|
||||||
addItemFlood(&flood, x, y - 1, DstSurf, DstRect, ConvColor, FALSE);
|
|
||||||
addItemFlood(&flood, x + 1, y, DstSurf, DstRect, ConvColor, FALSE);
|
|
||||||
addItemFlood(&flood, x - 1, y, DstSurf, DstRect, ConvColor, FALSE);
|
|
||||||
}
|
|
||||||
finalizeFlood(&flood);
|
|
||||||
}
|
}
|
||||||
else if (FillType == FLOODFILLSURFACE)
|
|
||||||
|
if (initFlood(&flood, DstRect) == FALSE)
|
||||||
{
|
{
|
||||||
/* Check if the start pixel has the surface color */
|
return FALSE;
|
||||||
if (DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_GetPixel(DstSurf, x, y) != ConvColor)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (initFlood(&flood, DstRect) == FALSE)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
addItemFlood(&flood, x, y, DstSurf, DstRect, ConvColor, TRUE);
|
|
||||||
while (flood.floodLen != 0)
|
|
||||||
{
|
|
||||||
x = flood.floodStart->x;
|
|
||||||
y = flood.floodStart->y;
|
|
||||||
removeItemFlood(&flood);
|
|
||||||
|
|
||||||
DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_PutPixel(DstSurf, x, y, BrushColor);
|
|
||||||
if (flood.floodStart - 4 < flood.floodData)
|
|
||||||
{
|
|
||||||
DPRINT1("Can't finish flooding!\n");
|
|
||||||
finalizeFlood(&flood);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
addItemFlood(&flood, x, y + 1, DstSurf, DstRect, ConvColor, TRUE);
|
|
||||||
addItemFlood(&flood, x, y - 1, DstSurf, DstRect, ConvColor, TRUE);
|
|
||||||
addItemFlood(&flood, x + 1, y, DstSurf, DstRect, ConvColor, TRUE);
|
|
||||||
addItemFlood(&flood, x - 1, y, DstSurf, DstRect, ConvColor, TRUE);
|
|
||||||
}
|
|
||||||
finalizeFlood(&flood);
|
|
||||||
}
|
}
|
||||||
else
|
addItemFlood(&flood, x, y, DstSurf, DstRect, ConvColor, FALSE);
|
||||||
|
while (flood.floodLen != 0)
|
||||||
{
|
{
|
||||||
DPRINT1("Unsupported FloodFill type!\n");
|
x = flood.floodStart->x;
|
||||||
|
y = flood.floodStart->y;
|
||||||
|
removeItemFlood(&flood);
|
||||||
|
|
||||||
|
DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_PutPixel(DstSurf, x, y, BrushColor);
|
||||||
|
if (flood.floodStart - 4 < flood.floodData)
|
||||||
|
{
|
||||||
|
DPRINT1("Can't finish flooding!\n");
|
||||||
|
finalizeFlood(&flood);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
addItemFlood(&flood, x, y + 1, DstSurf, DstRect, ConvColor, FALSE);
|
||||||
|
addItemFlood(&flood, x, y - 1, DstSurf, DstRect, ConvColor, FALSE);
|
||||||
|
addItemFlood(&flood, x + 1, y, DstSurf, DstRect, ConvColor, FALSE);
|
||||||
|
addItemFlood(&flood, x - 1, y, DstSurf, DstRect, ConvColor, FALSE);
|
||||||
}
|
}
|
||||||
return TRUE;
|
finalizeFlood(&flood);
|
||||||
|
}
|
||||||
|
else if (FillType == FLOODFILLSURFACE)
|
||||||
|
{
|
||||||
|
/* Check if the start pixel has the surface color */
|
||||||
|
if (DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_GetPixel(DstSurf, x, y) != ConvColor)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (initFlood(&flood, DstRect) == FALSE)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
addItemFlood(&flood, x, y, DstSurf, DstRect, ConvColor, TRUE);
|
||||||
|
while (flood.floodLen != 0)
|
||||||
|
{
|
||||||
|
x = flood.floodStart->x;
|
||||||
|
y = flood.floodStart->y;
|
||||||
|
removeItemFlood(&flood);
|
||||||
|
|
||||||
|
DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_PutPixel(DstSurf, x, y, BrushColor);
|
||||||
|
if (flood.floodStart - 4 < flood.floodData)
|
||||||
|
{
|
||||||
|
DPRINT1("Can't finish flooding!\n");
|
||||||
|
finalizeFlood(&flood);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
addItemFlood(&flood, x, y + 1, DstSurf, DstRect, ConvColor, TRUE);
|
||||||
|
addItemFlood(&flood, x, y - 1, DstSurf, DstRect, ConvColor, TRUE);
|
||||||
|
addItemFlood(&flood, x + 1, y, DstSurf, DstRect, ConvColor, TRUE);
|
||||||
|
addItemFlood(&flood, x - 1, y, DstSurf, DstRect, ConvColor, TRUE);
|
||||||
|
}
|
||||||
|
finalizeFlood(&flood);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DPRINT1("Unsupported FloodFill type!\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* ReactOS W32 Subsystem
|
* PROJECT: Win32 subsystem
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 2004, 2005, 2006 ReactOS Team
|
* LICENSE: See COPYING in the top level directory
|
||||||
*
|
* FILE: subsystems/win32/win32k/dib/i386/dib24bpp_hline.c
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* PURPOSE: ASM optimised 24bpp HLine
|
||||||
* it under the terms of the GNU General Public License as published by
|
* PROGRAMMERS: Magnus Olsen
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
*/
|
||||||
/* $Id: */
|
|
||||||
|
|
||||||
.globl _DIB_24BPP_HLine
|
.globl _DIB_24BPP_HLine
|
||||||
.intel_syntax noprefix
|
.intel_syntax noprefix
|
||||||
|
@ -46,7 +34,7 @@
|
||||||
mov esi, edx
|
mov esi, edx
|
||||||
mov [esp+4], eax
|
mov [esp+4], eax
|
||||||
ja Align4byte
|
ja Align4byte
|
||||||
lea eax, [edx-1]
|
lea eax, [edx-1]
|
||||||
mov [esp], eax
|
mov [esp], eax
|
||||||
inc eax
|
inc eax
|
||||||
jnz small_fill
|
jnz small_fill
|
||||||
|
@ -55,7 +43,7 @@
|
||||||
pop esi
|
pop esi
|
||||||
pop edi
|
pop edi
|
||||||
ret
|
ret
|
||||||
|
|
||||||
/* For small fills, don't bother doing anything fancy */
|
/* For small fills, don't bother doing anything fancy */
|
||||||
small_fill:
|
small_fill:
|
||||||
movzx ecx, word ptr [esp+58]
|
movzx ecx, word ptr [esp+58]
|
||||||
|
@ -76,7 +64,7 @@
|
||||||
pop esi
|
pop esi
|
||||||
pop edi
|
pop edi
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Align4byte:
|
Align4byte:
|
||||||
/* Align to 4-byte address */
|
/* Align to 4-byte address */
|
||||||
test al, 3
|
test al, 3
|
||||||
|
@ -84,7 +72,7 @@
|
||||||
jz loop1
|
jz loop1
|
||||||
lea esi, [esi+0]
|
lea esi, [esi+0]
|
||||||
lea edi, [edi+0]
|
lea edi, [edi+0]
|
||||||
|
|
||||||
loopasmversion:
|
loopasmversion:
|
||||||
/* This is about 30% faster than the generic C code below */
|
/* This is about 30% faster than the generic C code below */
|
||||||
movzx edx, word ptr [esp+58]
|
movzx edx, word ptr [esp+58]
|
||||||
|
|
|
@ -1,23 +1,11 @@
|
||||||
|
/*
|
||||||
/*
|
* PROJECT: Win32 subsystem
|
||||||
* ReactOS W32 Subsystem
|
* LICENSE: See COPYING in the top level directory
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 2004, 2005, 2006 ReactOS Team
|
* FILE: subsystems/win32/win32k/dib/i386/dib32bpp_colorfill.c
|
||||||
*
|
* PURPOSE: ASM optimised 32bpp ColorFill
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* PROGRAMMERS: Magnus Olsen
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
*/
|
||||||
/* $Id: */
|
|
||||||
.globl _DIB_32BPP_ColorFill
|
.globl _DIB_32BPP_ColorFill
|
||||||
.intel_syntax noprefix
|
.intel_syntax noprefix
|
||||||
|
|
||||||
|
@ -52,7 +40,7 @@
|
||||||
sub eax, edi
|
sub eax, edi
|
||||||
mov [esp], eax
|
mov [esp], eax
|
||||||
lea esi, [esi+0]
|
lea esi, [esi+0]
|
||||||
|
|
||||||
for_loop:
|
for_loop:
|
||||||
mov eax, ebp
|
mov eax, ebp
|
||||||
cld
|
cld
|
||||||
|
@ -65,15 +53,15 @@
|
||||||
add [esp+4], edx
|
add [esp+4], edx
|
||||||
dec dword ptr [esp]
|
dec dword ptr [esp]
|
||||||
jnz for_loop
|
jnz for_loop
|
||||||
end:
|
end:
|
||||||
mov ebx, [esp+8]
|
mov ebx, [esp+8]
|
||||||
mov eax, 1
|
mov eax, 1
|
||||||
mov esi, [esp+12]
|
mov esi, [esp+12]
|
||||||
mov edi, [esp+16]
|
mov edi, [esp+16]
|
||||||
mov ebp, [esp+20]
|
mov ebp, [esp+20]
|
||||||
add esp, 24
|
add esp, 24
|
||||||
ret
|
ret
|
||||||
|
|
||||||
algin_draw:
|
algin_draw:
|
||||||
stosd
|
stosd
|
||||||
dec ebx
|
dec ebx
|
||||||
|
@ -83,7 +71,7 @@
|
||||||
add [esp+4], edx
|
add [esp+4], edx
|
||||||
dec dword ptr [esp]
|
dec dword ptr [esp]
|
||||||
jnz for_loop
|
jnz for_loop
|
||||||
|
|
||||||
mov ebx, [esp+8]
|
mov ebx, [esp+8]
|
||||||
mov eax, 1
|
mov eax, 1
|
||||||
mov esi, [esp+12]
|
mov esi, [esp+12]
|
||||||
|
|
|
@ -1,22 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* ReactOS W32 Subsystem
|
* PROJECT: Win32 subsystem
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 2004, 2005, 2006 ReactOS Team
|
* LICENSE: See COPYING in the top level directory
|
||||||
*
|
* FILE: subsystems/win32/win32k/dib/i386/dib32bpp_hline.c
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* PURPOSE: ASM optimised 32bpp HLine
|
||||||
* it under the terms of the GNU General Public License as published by
|
* PROGRAMMERS: Magnus Olsen
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
*/
|
||||||
/* $Id: */
|
|
||||||
|
|
||||||
.globl _DIB_32BPP_HLine
|
.globl _DIB_32BPP_HLine
|
||||||
.intel_syntax noprefix
|
.intel_syntax noprefix
|
||||||
|
@ -29,9 +17,9 @@
|
||||||
_DIB_32BPP_HLine:
|
_DIB_32BPP_HLine:
|
||||||
sub esp, 12 // rember the base is not hex it is dec
|
sub esp, 12 // rember the base is not hex it is dec
|
||||||
mov ecx, [esp+16]
|
mov ecx, [esp+16]
|
||||||
mov [esp+4], ebx
|
mov [esp+4], ebx
|
||||||
mov edx, [esp+20] // edx = LONG x1
|
mov edx, [esp+20] // edx = LONG x1
|
||||||
mov [esp+8], edi
|
mov [esp+8], edi
|
||||||
mov edi, [esp+28]
|
mov edi, [esp+28]
|
||||||
mov eax, [ecx+36]
|
mov eax, [ecx+36]
|
||||||
mov ebx, [esp+24] // ebx = LONG x2
|
mov ebx, [esp+24] // ebx = LONG x2
|
||||||
|
@ -39,16 +27,16 @@ _DIB_32BPP_HLine:
|
||||||
mov edi, [ecx+32]
|
mov edi, [ecx+32]
|
||||||
sub ebx, edx // cx = (x2 - x1) ;
|
sub ebx, edx // cx = (x2 - x1) ;
|
||||||
add eax, edi
|
add eax, edi
|
||||||
lea edx, [eax+edx*4]
|
lea edx, [eax+edx*4]
|
||||||
mov [esp], edx
|
mov [esp], edx
|
||||||
cld
|
cld
|
||||||
mov eax, [esp+32]
|
mov eax, [esp+32]
|
||||||
mov edi, [esp]
|
mov edi, [esp]
|
||||||
test edi, 3 // Align to fullword boundary
|
test edi, 3 // Align to fullword boundary
|
||||||
jnz short _save_rest
|
jnz short _save_rest
|
||||||
mov ecx, ebx // Setup count of fullwords to fill
|
mov ecx, ebx // Setup count of fullwords to fill
|
||||||
rep stosd
|
rep stosd
|
||||||
|
|
||||||
mov ebx, [esp+4]
|
mov ebx, [esp+4]
|
||||||
mov edi, [esp+8]
|
mov edi, [esp+8]
|
||||||
add esp, 12
|
add esp, 12
|
||||||
|
|
173
reactos/subsystems/win32/win32k/dib/stretchblt.c
Normal file
173
reactos/subsystems/win32/win32k/dib/stretchblt.c
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: Win32 subsystem
|
||||||
|
* LICENSE: See COPYING in the top level directory
|
||||||
|
* FILE: subsystems/win32/win32k/dib/stretchblt.c
|
||||||
|
* PURPOSE: StretchBlt implementation suitable for all bit depths
|
||||||
|
* PROGRAMMERS: Magnus Olsen
|
||||||
|
* Evgeniy Boltik
|
||||||
|
* Gregor Schneider
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <w32k.h>
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
BOOLEAN DIB_XXBPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, SURFOBJ *MaskSurf,
|
||||||
|
SURFOBJ *PatternSurface,
|
||||||
|
RECTL *DestRect, RECTL *SourceRect,
|
||||||
|
POINTL *MaskOrigin, BRUSHOBJ *Brush,
|
||||||
|
POINTL *BrushOrigin, XLATEOBJ *ColorTranslation,
|
||||||
|
XLATEOBJ *XlatePatternToDest, ROP4 ROP)
|
||||||
|
{
|
||||||
|
LONG sx = 0;
|
||||||
|
LONG sy = 0;
|
||||||
|
LONG DesX;
|
||||||
|
LONG DesY;
|
||||||
|
|
||||||
|
LONG DstHeight;
|
||||||
|
LONG DstWidth;
|
||||||
|
LONG SrcHeight;
|
||||||
|
LONG SrcWidth;
|
||||||
|
|
||||||
|
ULONG Color;
|
||||||
|
ULONG Dest, Source = 0, Pattern = 0;
|
||||||
|
ULONG xxBPPMask;
|
||||||
|
BOOLEAN CanDraw;
|
||||||
|
|
||||||
|
PFN_DIB_GetPixel fnSource_GetPixel = NULL;
|
||||||
|
PFN_DIB_GetPixel fnDest_GetPixel = NULL;
|
||||||
|
PFN_DIB_PutPixel fnDest_PutPixel = NULL;
|
||||||
|
PFN_DIB_GetPixel fnPattern_GetPixel = NULL;
|
||||||
|
PFN_DIB_GetPixel fnMask_GetPixel = NULL;
|
||||||
|
|
||||||
|
LONG PatternX = 0, PatternY = 0;
|
||||||
|
|
||||||
|
BOOL UsesSource = ROP4_USES_SOURCE(ROP);
|
||||||
|
BOOL UsesPattern = ROP4_USES_PATTERN(ROP);
|
||||||
|
|
||||||
|
fnDest_GetPixel = DibFunctionsForBitmapFormat[DestSurf->iBitmapFormat].DIB_GetPixel;
|
||||||
|
fnDest_PutPixel = DibFunctionsForBitmapFormat[DestSurf->iBitmapFormat].DIB_PutPixel;
|
||||||
|
|
||||||
|
DPRINT("Dest BPP: %u, dstRect: (%d,%d)-(%d,%d)\n",
|
||||||
|
BitsPerFormat(DestSurf->iBitmapFormat), DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
|
||||||
|
|
||||||
|
if (UsesSource)
|
||||||
|
{
|
||||||
|
fnSource_GetPixel = DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat].DIB_GetPixel;
|
||||||
|
DPRINT("Source BPP: %u, srcRect: (%d,%d)-(%d,%d)\n",
|
||||||
|
BitsPerFormat(SourceSurf->iBitmapFormat), SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MaskSurf)
|
||||||
|
{
|
||||||
|
fnMask_GetPixel = DibFunctionsForBitmapFormat[MaskSurf->iBitmapFormat].DIB_GetPixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
DstHeight = DestRect->bottom - DestRect->top;
|
||||||
|
DstWidth = DestRect->right - DestRect->left;
|
||||||
|
SrcHeight = SourceRect->bottom - SourceRect->top;
|
||||||
|
SrcWidth = SourceRect->right - SourceRect->left;
|
||||||
|
|
||||||
|
/* FIXME : MaskOrigin? */
|
||||||
|
|
||||||
|
switch(DestSurf->iBitmapFormat)
|
||||||
|
{
|
||||||
|
case BMF_1BPP: xxBPPMask = 0x1; break;
|
||||||
|
case BMF_4BPP: xxBPPMask = 0xF; break;
|
||||||
|
case BMF_8BPP: xxBPPMask = 0xFF; break;
|
||||||
|
case BMF_16BPP: xxBPPMask = 0xFFFF; break;
|
||||||
|
case BMF_24BPP: xxBPPMask = 0xFFFFFF; break;
|
||||||
|
default:
|
||||||
|
xxBPPMask = 0xFFFFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UsesPattern)
|
||||||
|
{
|
||||||
|
if (PatternSurface)
|
||||||
|
{
|
||||||
|
PatternY = (DestRect->top - BrushOrigin->y) % PatternSurface->sizlBitmap.cy;
|
||||||
|
if (PatternY < 0)
|
||||||
|
{
|
||||||
|
PatternY += PatternSurface->sizlBitmap.cy;
|
||||||
|
}
|
||||||
|
fnPattern_GetPixel = DibFunctionsForBitmapFormat[PatternSurface->iBitmapFormat].DIB_GetPixel;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Brush)
|
||||||
|
Pattern = Brush->iSolidColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (DesY = DestRect->top; DesY < DestRect->bottom; DesY++)
|
||||||
|
{
|
||||||
|
if (PatternSurface)
|
||||||
|
{
|
||||||
|
PatternX = (DestRect->left - BrushOrigin->x) % PatternSurface->sizlBitmap.cx;
|
||||||
|
if (PatternX < 0)
|
||||||
|
{
|
||||||
|
PatternX += PatternSurface->sizlBitmap.cx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (UsesSource)
|
||||||
|
sy = SourceRect->top+(DesY - DestRect->top) * SrcHeight / DstHeight;
|
||||||
|
|
||||||
|
for (DesX = DestRect->left; DesX < DestRect->right; DesX++)
|
||||||
|
{
|
||||||
|
CanDraw = TRUE;
|
||||||
|
|
||||||
|
if (fnMask_GetPixel)
|
||||||
|
{
|
||||||
|
sx = SourceRect->left+(DesX - DestRect->left) * SrcWidth / DstWidth;
|
||||||
|
if (sx < 0 || sy < 0 ||
|
||||||
|
MaskSurf->sizlBitmap.cx < sx || MaskSurf->sizlBitmap.cy < sy ||
|
||||||
|
fnMask_GetPixel(MaskSurf, sx, sy) != 0)
|
||||||
|
{
|
||||||
|
CanDraw = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UsesSource && CanDraw)
|
||||||
|
{
|
||||||
|
sx = SourceRect->left+(DesX - DestRect->left) * SrcWidth / DstWidth;
|
||||||
|
if (sx >= 0 && sy >= 0 &&
|
||||||
|
SourceSurf->sizlBitmap.cx > sx && SourceSurf->sizlBitmap.cy > sy)
|
||||||
|
{
|
||||||
|
Source = XLATEOBJ_iXlate(ColorTranslation, fnSource_GetPixel(SourceSurf, sx, sy));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Source = 0;
|
||||||
|
CanDraw = (ROP3_TO_ROP4(SRCCOPY) != ROP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CanDraw)
|
||||||
|
{
|
||||||
|
if (PatternSurface)
|
||||||
|
{
|
||||||
|
Pattern = XLATEOBJ_iXlate(XlatePatternToDest, fnPattern_GetPixel(PatternSurface, PatternX, PatternY));
|
||||||
|
PatternX++;
|
||||||
|
PatternX %= PatternSurface->sizlBitmap.cx;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dest = fnDest_GetPixel(DestSurf, DesX, DesY);
|
||||||
|
Color = DIB_DoRop(ROP, Dest, Source, Pattern) & xxBPPMask;
|
||||||
|
|
||||||
|
fnDest_PutPixel(DestSurf, DesX, DesY, Color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PatternSurface)
|
||||||
|
{
|
||||||
|
PatternY++;
|
||||||
|
PatternY %= PatternSurface->sizlBitmap.cy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -29,9 +29,9 @@
|
||||||
<file>dib16bpp.c</file>
|
<file>dib16bpp.c</file>
|
||||||
<file>dib24bpp.c</file>
|
<file>dib24bpp.c</file>
|
||||||
<file>dib32bpp.c</file>
|
<file>dib32bpp.c</file>
|
||||||
<file>dibXXbpp.c</file>
|
|
||||||
<file>dib.c</file>
|
<file>dib.c</file>
|
||||||
<file>floodfill.c</file>
|
<file>floodfill.c</file>
|
||||||
|
<file>stretchblt.c</file>
|
||||||
|
|
||||||
<if property="ARCH" value="i386">
|
<if property="ARCH" value="i386">
|
||||||
<directory name="i386">
|
<directory name="i386">
|
||||||
|
|
Loading…
Reference in a new issue