mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
- Pass the rop code to PatBlt down to the BitBlt functions.
- Emulate all rop codes on dib 4bpp surfaces. I left the current code as an optimized case for SRCCOPY. svn path=/trunk/; revision=5292
This commit is contained in:
parent
f858d1a51d
commit
df807693a0
12 changed files with 284 additions and 53 deletions
|
@ -9,7 +9,8 @@ VOID DIB_1BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
||||||
BOOLEAN DIB_1BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
BOOLEAN DIB_1BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
XLATEOBJ *ColorTranslation);
|
PBRUSHOBJ Brush, PPOINTL BrushOrigin,
|
||||||
|
XLATEOBJ *ColorTranslation, ULONG Rop4);
|
||||||
|
|
||||||
VOID DIB_4BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
VOID DIB_4BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
||||||
ULONG DIB_4BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
ULONG DIB_4BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
||||||
|
@ -18,7 +19,8 @@ VOID DIB_4BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
||||||
BOOLEAN DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
BOOLEAN DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
XLATEOBJ *ColorTranslation);
|
PBRUSHOBJ Brush, PPOINTL BrushOrigin,
|
||||||
|
XLATEOBJ *ColorTranslation, ULONG Rop4);
|
||||||
|
|
||||||
VOID DIB_8BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
VOID DIB_8BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
||||||
ULONG DIB_8BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
ULONG DIB_8BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
||||||
|
@ -27,7 +29,8 @@ VOID DIB_8BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
||||||
BOOLEAN DIB_8BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
BOOLEAN DIB_8BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
XLATEOBJ *ColorTranslation);
|
PBRUSHOBJ Brush, PPOINTL BrushOrigin,
|
||||||
|
XLATEOBJ *ColorTranslation, ULONG Rop4);
|
||||||
|
|
||||||
VOID DIB_16BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
VOID DIB_16BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
||||||
ULONG DIB_16BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
ULONG DIB_16BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
||||||
|
@ -36,7 +39,8 @@ VOID DIB_16BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
||||||
BOOLEAN DIB_16BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
BOOLEAN DIB_16BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
XLATEOBJ *ColorTranslation);
|
PBRUSHOBJ Brush, PPOINTL BrushOrigin,
|
||||||
|
XLATEOBJ *ColorTranslation, ULONG Rop4);
|
||||||
|
|
||||||
VOID DIB_24BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
VOID DIB_24BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
||||||
ULONG DIB_24BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
ULONG DIB_24BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
||||||
|
@ -45,7 +49,8 @@ VOID DIB_24BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
||||||
BOOLEAN DIB_24BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
BOOLEAN DIB_24BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
XLATEOBJ *ColorTranslation);
|
PBRUSHOBJ Brush, PPOINTL BrushOrigin,
|
||||||
|
XLATEOBJ *ColorTranslation, ULONG Rop4);
|
||||||
|
|
||||||
VOID DIB_32BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
VOID DIB_32BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
||||||
ULONG DIB_32BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
ULONG DIB_32BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
||||||
|
@ -54,4 +59,5 @@ VOID DIB_32BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
||||||
BOOLEAN DIB_32BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
BOOLEAN DIB_32BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
XLATEOBJ *ColorTranslation);
|
PBRUSHOBJ Brush, PPOINTL BrushOrigin,
|
||||||
|
XLATEOBJ *ColorTranslation, ULONG Rop4);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dib16bpp.c,v 1.4 2003/05/18 17:16:17 ea Exp $ */
|
/* $Id: dib16bpp.c,v 1.5 2003/07/27 18:37:23 dwelch Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -77,9 +77,10 @@ DIB_16BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
DIB_16BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
DIB_16BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
XLATEOBJ *ColorTranslation)
|
PBRUSHOBJ BrushObj, PPOINTL BrushOrigin,
|
||||||
|
XLATEOBJ *ColorTranslation, ULONG Rop4)
|
||||||
{
|
{
|
||||||
LONG i, j, sx, sy, xColor, f1;
|
LONG i, j, sx, sy, xColor, f1;
|
||||||
PBYTE SourceBits, DestBits, SourceLine, DestLine;
|
PBYTE SourceBits, DestBits, SourceLine, DestLine;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dib1bpp.c,v 1.6 2003/05/18 17:16:17 ea Exp $ */
|
/* $Id: dib1bpp.c,v 1.7 2003/07/27 18:37:23 dwelch Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -72,9 +72,10 @@ DIB_1BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
DIB_1BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
DIB_1BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
XLATEOBJ *ColorTranslation)
|
PBRUSHOBJ BrushObj, PPOINTL BrushOrigin,
|
||||||
|
XLATEOBJ *ColorTranslation, ULONG Rop4)
|
||||||
{
|
{
|
||||||
LONG i, j, sx, sy = SourcePoint->y;
|
LONG i, j, sx, sy = SourcePoint->y;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dib24bpp.c,v 1.11 2003/05/18 17:16:17 ea Exp $ */
|
/* $Id: dib24bpp.c,v 1.12 2003/07/27 18:37:23 dwelch Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -77,9 +77,10 @@ DIB_24BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
DIB_24BPP_BitBlt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
DIB_24BPP_BitBlt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
XLATEOBJ *ColorTranslation)
|
PBRUSHOBJ BrushObj, PPOINTL BrushOrigin,
|
||||||
|
XLATEOBJ *ColorTranslation, ULONG Rop4)
|
||||||
{
|
{
|
||||||
LONG i, j, sx, sy, xColor, f1;
|
LONG i, j, sx, sy, xColor, f1;
|
||||||
PBYTE SourceBits, DestBits, SourceLine, DestLine;
|
PBYTE SourceBits, DestBits, SourceLine, DestLine;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dib32bpp.c,v 1.2 2003/05/18 17:16:17 ea Exp $ */
|
/* $Id: dib32bpp.c,v 1.3 2003/07/27 18:37:23 dwelch Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -76,9 +76,10 @@ DIB_32BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
DIB_32BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
DIB_32BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
XLATEOBJ *ColorTranslation)
|
PBRUSHOBJ BrushObj, PPOINTL BrushOrigin,
|
||||||
|
XLATEOBJ *ColorTranslation, ULONG Rop4)
|
||||||
{
|
{
|
||||||
ULONG i, j, sx, sy, xColor, f1;
|
ULONG i, j, sx, sy, xColor, f1;
|
||||||
PBYTE SourceBits, DestBits, SourceLine, DestLine;
|
PBYTE SourceBits, DestBits, SourceLine, DestLine;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dib4bpp.c,v 1.14 2003/07/14 17:34:52 gvg Exp $ */
|
/* $Id: dib4bpp.c,v 1.15 2003/07/27 18:37:23 dwelch Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -71,13 +71,150 @@ DIB_4BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
ULONG
|
||||||
DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern)
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
|
||||||
XLATEOBJ *ColorTranslation)
|
|
||||||
{
|
{
|
||||||
LONG i, j, sx, sy, f1, f2, xColor;
|
ULONG ResultNibble;
|
||||||
|
ULONG Result;
|
||||||
|
ULONG i;
|
||||||
|
static const ULONG ExpandDest[16] =
|
||||||
|
{
|
||||||
|
0x55555555 /* 0000 */,
|
||||||
|
0x555555AA /* 0001 */,
|
||||||
|
0x5555AA55 /* 0010 */,
|
||||||
|
0x5555AAAA /* 0011 */,
|
||||||
|
0x55AA5555 /* 0100 */,
|
||||||
|
0x55AA55AA /* 0101 */,
|
||||||
|
0x55AAAA55 /* 0110 */,
|
||||||
|
0x55AAAAAA /* 0111 */,
|
||||||
|
0xAA555555 /* 1000 */,
|
||||||
|
0xAA5555AA /* 1001 */,
|
||||||
|
0xAA55AA55 /* 1010 */,
|
||||||
|
0xAA55AAAA /* 1011 */,
|
||||||
|
0xAAAA5555 /* 1100 */,
|
||||||
|
0xAAAA55AA /* 1101 */,
|
||||||
|
0xAAAAAA55 /* 1110 */,
|
||||||
|
0xAAAAAAAA /* 1111 */,
|
||||||
|
};
|
||||||
|
static const ULONG ExpandSource[16] =
|
||||||
|
{
|
||||||
|
0x33333333 /* 0000 */,
|
||||||
|
0x333333CC /* 0001 */,
|
||||||
|
0x3333CC33 /* 0010 */,
|
||||||
|
0x3333CCCC /* 0011 */,
|
||||||
|
0x33CC3333 /* 0100 */,
|
||||||
|
0x33CC33CC /* 0101 */,
|
||||||
|
0x33CCCC33 /* 0110 */,
|
||||||
|
0x33CCCCCC /* 0111 */,
|
||||||
|
0xCC333333 /* 1000 */,
|
||||||
|
0xCC3333CC /* 1001 */,
|
||||||
|
0xCC33CC33 /* 1010 */,
|
||||||
|
0xCC33CCCC /* 1011 */,
|
||||||
|
0xCCCC3333 /* 1100 */,
|
||||||
|
0xCCCC33CC /* 1101 */,
|
||||||
|
0xCCCCCC33 /* 1110 */,
|
||||||
|
0xCCCCCCCC /* 1111 */,
|
||||||
|
};
|
||||||
|
static const ULONG ExpandPattern[16] =
|
||||||
|
{
|
||||||
|
0x0F0F0F0F /* 0000 */,
|
||||||
|
0x0F0F0FF0 /* 0001 */,
|
||||||
|
0x0F0FF00F /* 0010 */,
|
||||||
|
0x0F0FF0F0 /* 0011 */,
|
||||||
|
0x0FF00F0F /* 0100 */,
|
||||||
|
0x0FF00FF0 /* 0101 */,
|
||||||
|
0x0FF0F00F /* 0110 */,
|
||||||
|
0x0FF0F0F0 /* 0111 */,
|
||||||
|
0xF00F0F0F /* 1000 */,
|
||||||
|
0xF00F0FF0 /* 1001 */,
|
||||||
|
0xF00FF00F /* 1010 */,
|
||||||
|
0xF00FF0F0 /* 1011 */,
|
||||||
|
0xF0F00F0F /* 1100 */,
|
||||||
|
0xF0F00FF0 /* 1101 */,
|
||||||
|
0xF0F0F00F /* 1110 */,
|
||||||
|
0xF0F0F0F0 /* 1111 */,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Optimized code for the various named rop codes. */
|
||||||
|
switch (Rop)
|
||||||
|
{
|
||||||
|
case BLACKNESS: return(0);
|
||||||
|
case NOTSRCERASE: return(~(Dest | Source));
|
||||||
|
case NOTSRCCOPY: return(~Source);
|
||||||
|
case SRCERASE: return((~Dest) & Source);
|
||||||
|
case DSTINVERT: return(~Dest);
|
||||||
|
case PATINVERT: return(Dest ^ Pattern);
|
||||||
|
case SRCINVERT: return(Dest ^ Source);
|
||||||
|
case SRCAND: return(Dest & Source);
|
||||||
|
case MERGEPAINT: return(Dest & (~Source));
|
||||||
|
case SRCPAINT: return(Dest | Source);
|
||||||
|
case MERGECOPY: return(Source & Pattern);
|
||||||
|
case SRCCOPY: return(Source);
|
||||||
|
case PATCOPY: return(Pattern);
|
||||||
|
case PATPAINT: return(Dest | (~Source) | Pattern);
|
||||||
|
case WHITENESS: return(0xFFFFFFFF);
|
||||||
|
}
|
||||||
|
/* Expand the ROP operation to all four bytes */
|
||||||
|
Rop &= 0x00FF0000;
|
||||||
|
Rop = (Rop << 8) | (Rop) | (Rop >> 8) | (Rop >> 16);
|
||||||
|
/* Do the operation on four bits simultaneously. */
|
||||||
|
Result = 0;
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
ResultNibble = Rop & ExpandDest[Dest & 0xF] & ExpandSource[Source & 0xF] & ExpandPattern[Pattern & 0xF];
|
||||||
|
Result |= (((ResultNibble & 0xFF000000) ? 0x8 : 0x0) | ((ResultNibble & 0x00FF0000) ? 0x4 : 0x0) |
|
||||||
|
((ResultNibble & 0x0000FF00) ? 0x2 : 0x0) | ((ResultNibble & 0x000000FF) ? 0x1 : 0x0)) << (i * 4);
|
||||||
|
Dest >>= 4;
|
||||||
|
Source >>= 4;
|
||||||
|
Pattern >>= 4;
|
||||||
|
}
|
||||||
|
return(Result);
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
DIB_4BPP_GetSource(SURFOBJ* SourceSurf, SURFGDI* SourceGDI, ULONG sx, ULONG sy, XLATEOBJ* ColorTranslation)
|
||||||
|
{
|
||||||
|
switch (SourceGDI->BitsPerPixel)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
if (DIB_1BPP_GetPixel(SourceSurf, sx, sy))
|
||||||
|
{
|
||||||
|
return(XLATEOBJ_iXlate(ColorTranslation, 0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return(XLATEOBJ_iXlate(ColorTranslation, 1));
|
||||||
|
}
|
||||||
|
case 4:
|
||||||
|
if (ColorTranslation != NULL)
|
||||||
|
{
|
||||||
|
return(XLATEOBJ_iXlate(ColorTranslation, DIB_4BPP_GetPixel(SourceSurf, sx, sy)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return(DIB_4BPP_GetPixel(SourceSurf, sx, sy));
|
||||||
|
}
|
||||||
|
case 8:
|
||||||
|
return(XLATEOBJ_iXlate(ColorTranslation, DIB_8BPP_GetPixel(SourceSurf, sx, sy)));
|
||||||
|
case 16:
|
||||||
|
return(XLATEOBJ_iXlate(ColorTranslation, DIB_16BPP_GetPixel(SourceSurf, sx, sy)));
|
||||||
|
case 24:
|
||||||
|
return(XLATEOBJ_iXlate(ColorTranslation, DIB_24BPP_GetPixel(SourceSurf, sx, sy)));
|
||||||
|
case 32:
|
||||||
|
return(XLATEOBJ_iXlate(ColorTranslation, DIB_8BPP_GetPixel(SourceSurf, sx, sy)));
|
||||||
|
default:
|
||||||
|
DbgPrint("DIB_4BPP_ExpandSource: Unhandled number of bits per pixel in source.\n");
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN STATIC
|
||||||
|
DIB_4BPP_BitBltSrcCopy(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
|
XLATEOBJ* ColorTranslation)
|
||||||
|
{
|
||||||
|
LONG i, j, sx, sy, f2, xColor;
|
||||||
PBYTE SourceBits_24BPP, SourceLine_24BPP;
|
PBYTE SourceBits_24BPP, SourceLine_24BPP;
|
||||||
PBYTE DestBits, DestLine, SourceBits_8BPP, SourceLine_8BPP;
|
PBYTE DestBits, DestLine, SourceBits_8BPP, SourceLine_8BPP;
|
||||||
PBYTE SourceBits, SourceLine;
|
PBYTE SourceBits, SourceLine;
|
||||||
|
@ -229,7 +366,92 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
DbgPrint("DIB_4BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI->BitsPerPixel);
|
DbgPrint("DIB_4BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI->BitsPerPixel);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
|
PBRUSHOBJ Brush, PPOINTL BrushOrigin,
|
||||||
|
XLATEOBJ *ColorTranslation, ULONG Rop4)
|
||||||
|
{
|
||||||
|
LONG i, j, k, sx, sy;
|
||||||
|
ULONG Dest, Source, Pattern;
|
||||||
|
PULONG DestBits;
|
||||||
|
BOOL UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
|
||||||
|
BOOL UsesPattern = ((Rop4 & 0xF00000) >> 4) != (Rop4 & 0x0F0000);
|
||||||
|
ULONG RoundedRight = ((DestRect->right + 0x7) & ~0x7);
|
||||||
|
static const ULONG ExpandSolidColor[16] =
|
||||||
|
{
|
||||||
|
0x00000000 /* 0 */,
|
||||||
|
0x11111111 /* 1 */,
|
||||||
|
0x22222222 /* 2 */,
|
||||||
|
0x33333333 /* 3 */,
|
||||||
|
0x44444444 /* 4 */,
|
||||||
|
0x55555555 /* 5 */,
|
||||||
|
0x66666666 /* 6 */,
|
||||||
|
0x77777777 /* 7 */,
|
||||||
|
0x88888888 /* 8 */,
|
||||||
|
0x99999999 /* 9 */,
|
||||||
|
0xAAAAAAAA /* 10 */,
|
||||||
|
0xBBBBBBBB /* 11 */,
|
||||||
|
0xCCCCCCCC /* 12 */,
|
||||||
|
0xDDDDDDDD /* 13 */,
|
||||||
|
0xEEEEEEEE /* 14 */,
|
||||||
|
0xFFFFFFFF /* 15 */,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (Rop4 == SRCCOPY)
|
||||||
|
{
|
||||||
|
return(DIB_4BPP_BitBltSrcCopy(DestSurf, SourceSurf, DestGDI, SourceGDI, DestRect, SourcePoint, ColorTranslation));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sy = SourcePoint->y;
|
||||||
|
|
||||||
|
for (j=DestRect->top; j<DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
sx = SourcePoint->x;
|
||||||
|
DestBits = (PULONG)(DestSurf->pvScan0 + (DestRect->left>>1) + j * DestSurf->lDelta);
|
||||||
|
for (i=DestRect->left; i<RoundedRight; i+=8, DestBits++)
|
||||||
|
{
|
||||||
|
Dest = *DestBits;
|
||||||
|
if (UsesSource)
|
||||||
|
{
|
||||||
|
Source = 0;
|
||||||
|
for (k = 0; k < 8; k++)
|
||||||
|
{
|
||||||
|
Source |= (DIB_4BPP_GetSource(SourceSurf, SourceGDI, sx + i + k, sy, ColorTranslation) << (k * 4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (UsesPattern)
|
||||||
|
{
|
||||||
|
/* FIXME: No support for pattern brushes. */
|
||||||
|
Pattern = ExpandSolidColor[Brush->iSolidColor & 0xF];
|
||||||
|
}
|
||||||
|
*DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
|
||||||
|
}
|
||||||
|
if (i < DestRect->right)
|
||||||
|
{
|
||||||
|
Dest = *DestBits;
|
||||||
|
for (; i < DestRect->right; i++)
|
||||||
|
{
|
||||||
|
if (UsesSource)
|
||||||
|
{
|
||||||
|
Source = DIB_4BPP_GetSource(SourceSurf, SourceGDI, sx + i, sy, ColorTranslation);
|
||||||
|
}
|
||||||
|
if (UsesPattern)
|
||||||
|
{
|
||||||
|
/* FIXME: No support for pattern brushes. */
|
||||||
|
Pattern = ExpandSolidColor[Brush->iSolidColor & 0xF];
|
||||||
|
}
|
||||||
|
DIB_4BPP_PutPixel(DestSurf, i, j, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xF);
|
||||||
|
Dest >>= 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dib8bpp.c,v 1.2 2003/05/18 17:16:17 ea Exp $ */
|
/* $Id: dib8bpp.c,v 1.3 2003/07/27 18:37:23 dwelch Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -74,9 +74,10 @@ DIB_8BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
DIB_8BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
DIB_8BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
XLATEOBJ *ColorTranslation)
|
PBRUSHOBJ BrushObj, PPOINTL BrushOrigin,
|
||||||
|
XLATEOBJ *ColorTranslation, ULONG Rop4)
|
||||||
{
|
{
|
||||||
ULONG i, j, sx, sy, xColor, f1;
|
ULONG i, j, sx, sy, xColor, f1;
|
||||||
PBYTE SourceBits, DestBits, SourceLine, DestLine;
|
PBYTE SourceBits, DestBits, SourceLine, DestLine;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: bitblt.c,v 1.23 2003/07/11 15:59:37 royce Exp $
|
/* $Id: bitblt.c,v 1.24 2003/07/27 18:37:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -175,7 +175,7 @@ CallDibBitBlt(PSURFOBJ OutputObj,
|
||||||
PPOINTL BrushOrigin,
|
PPOINTL BrushOrigin,
|
||||||
ROP4 Rop4)
|
ROP4 Rop4)
|
||||||
{
|
{
|
||||||
return OutputGDI->DIB_BitBlt(OutputObj, InputObj, OutputGDI, InputGDI, OutputRect, InputPoint, ColorTranslation);
|
return OutputGDI->DIB_BitBlt(OutputObj, InputObj, OutputGDI, InputGDI, OutputRect, InputPoint, Brush, BrushOrigin, ColorTranslation, Rop4);
|
||||||
}
|
}
|
||||||
|
|
||||||
INT abs(INT nm);
|
INT abs(INT nm);
|
||||||
|
@ -249,6 +249,10 @@ EngBitBlt(SURFOBJ *DestObj,
|
||||||
{
|
{
|
||||||
InputGDI = (PSURFGDI) AccessInternalObjectFromUserObject(InputObj);
|
InputGDI = (PSURFGDI) AccessInternalObjectFromUserObject(InputObj);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
InputGDI = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
OutputRect = *DestRect;
|
OutputRect = *DestRect;
|
||||||
if (NULL != ClipRegion)
|
if (NULL != ClipRegion)
|
||||||
|
@ -301,14 +305,6 @@ EngBitBlt(SURFOBJ *DestObj,
|
||||||
OutputGDI = (PSURFGDI)AccessInternalObjectFromUserObject(OutputObj);
|
OutputGDI = (PSURFGDI)AccessInternalObjectFromUserObject(OutputObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME The code currently assumes there will be a source bitmap. This is not true when, for example, using this function to
|
|
||||||
* paint a brush pattern on the destination. */
|
|
||||||
if (NULL == InputObj && 0xaacc != Rop4 && PATCOPY != Rop4)
|
|
||||||
{
|
|
||||||
DbgPrint("EngBitBlt: A source is currently required, even though not all operations require one (FIXME)\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine clipping type
|
// Determine clipping type
|
||||||
if (ClipRegion == (CLIPOBJ *) NULL)
|
if (ClipRegion == (CLIPOBJ *) NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: copybits.c,v 1.15 2003/07/11 15:59:37 royce Exp $
|
/* $Id: copybits.c,v 1.16 2003/07/27 18:37:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -129,7 +129,7 @@ EngCopyBits(SURFOBJ *Dest,
|
||||||
switch(clippingType)
|
switch(clippingType)
|
||||||
{
|
{
|
||||||
case DC_TRIVIAL:
|
case DC_TRIVIAL:
|
||||||
DestGDI->DIB_BitBlt(Dest, Source, DestGDI, SourceGDI, DestRect, SourcePoint, ColorTranslation);
|
DestGDI->DIB_BitBlt(Dest, Source, DestGDI, SourceGDI, DestRect, SourcePoint, NULL, NULL, ColorTranslation, SRCCOPY);
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(Source, SourceGDI);
|
MouseSafetyOnDrawEnd(Source, SourceGDI);
|
||||||
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
||||||
|
@ -143,7 +143,7 @@ EngCopyBits(SURFOBJ *Dest,
|
||||||
ptlTmp.x = SourcePoint->x + rclTmp.left - DestRect->left;
|
ptlTmp.x = SourcePoint->x + rclTmp.left - DestRect->left;
|
||||||
ptlTmp.y = SourcePoint->y + rclTmp.top - DestRect->top;
|
ptlTmp.y = SourcePoint->y + rclTmp.top - DestRect->top;
|
||||||
|
|
||||||
DestGDI->DIB_BitBlt(Dest, Source, DestGDI, SourceGDI, &rclTmp, &ptlTmp, ColorTranslation);
|
DestGDI->DIB_BitBlt(Dest, Source, DestGDI, SourceGDI, &rclTmp, &ptlTmp, NULL, NULL, ColorTranslation, SRCCOPY);
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(Source, SourceGDI);
|
MouseSafetyOnDrawEnd(Source, SourceGDI);
|
||||||
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
||||||
|
@ -169,7 +169,7 @@ EngCopyBits(SURFOBJ *Dest,
|
||||||
ptlTmp.y = SourcePoint->y + prcl->top - DestRect->top;
|
ptlTmp.y = SourcePoint->y + prcl->top - DestRect->top;
|
||||||
|
|
||||||
if(!DestGDI->DIB_BitBlt(Dest, Source, DestGDI, SourceGDI,
|
if(!DestGDI->DIB_BitBlt(Dest, Source, DestGDI, SourceGDI,
|
||||||
prcl, &ptlTmp, ColorTranslation)) return FALSE;
|
prcl, &ptlTmp, NULL, NULL, ColorTranslation, SRCCOPY)) return FALSE;
|
||||||
|
|
||||||
prcl++;
|
prcl++;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: objects.h,v 1.15 2003/05/18 17:16:17 ea Exp $
|
/* $Id: objects.h,v 1.16 2003/07/27 18:37:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -167,7 +167,8 @@ typedef VOID (*PFN_DIB_VLine) (PSURFOBJ, LONG, LONG, LONG, ULONG);
|
||||||
typedef BOOLEAN (*PFN_DIB_BitBlt) (PSURFOBJ DestSurf, PSURFOBJ SourceSurf,
|
typedef BOOLEAN (*PFN_DIB_BitBlt) (PSURFOBJ DestSurf, PSURFOBJ SourceSurf,
|
||||||
PSURFGDI DestGDI, PSURFGDI SourceGDI,
|
PSURFGDI DestGDI, PSURFGDI SourceGDI,
|
||||||
PRECTL DestRect, PPOINTL SourcePoint,
|
PRECTL DestRect, PPOINTL SourcePoint,
|
||||||
XLATEOBJ *ColorTranslation);
|
PBRUSHOBJ BrushObj, PPOINTL BrushOrigin,
|
||||||
|
XLATEOBJ *ColorTranslation, ULONG Rop4);
|
||||||
|
|
||||||
typedef struct _SURFGDI {
|
typedef struct _SURFGDI {
|
||||||
ENGOBJ Header;
|
ENGOBJ Header;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: surface.c,v 1.20 2003/07/11 15:59:37 royce Exp $
|
/* $Id: surface.c,v 1.21 2003/07/27 18:37:23 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -98,7 +98,8 @@ static VOID Dummy_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
static BOOLEAN Dummy_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
static BOOLEAN Dummy_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
XLATEOBJ *ColorTranslation)
|
PBRUSHOBJ BrushObj, POINTL* BrushOrign,
|
||||||
|
XLATEOBJ *ColorTranslation, ULONG Rop4)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: brush.c,v 1.21 2003/06/28 08:39:18 gvg Exp $
|
/* $Id: brush.c,v 1.22 2003/07/27 18:37:23 dwelch Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ BOOL STDCALL W32kPatBlt(HDC hDC,
|
||||||
NULL,
|
NULL,
|
||||||
BrushObj,
|
BrushObj,
|
||||||
NULL,
|
NULL,
|
||||||
PATCOPY);
|
ROP);
|
||||||
}
|
}
|
||||||
GDIOBJ_UnlockObj( dc->w.hBrush, GO_BRUSH_MAGIC );
|
GDIOBJ_UnlockObj( dc->w.hBrush, GO_BRUSH_MAGIC );
|
||||||
DC_ReleasePtr( hDC );
|
DC_ReleasePtr( hDC );
|
||||||
|
|
Loading…
Reference in a new issue