mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 15:13:18 +00:00
1. fixed crash in 1bpp blt code that was caused by an uninitialized variable.
2. speed improvements for patterned brushes svn path=/trunk/; revision=9000
This commit is contained in:
parent
bfde26a3f6
commit
9b45df9243
6 changed files with 136 additions and 117 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: dib4bpp.c,v 1.25 2004/04/06 17:54:32 weiden Exp $ */
|
||||
/* $Id: dib4bpp.c,v 1.26 2004/04/07 10:19:34 weiden Exp $ */
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -239,10 +239,10 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
|||
XLATEOBJ *ColorTranslation, ULONG Rop4)
|
||||
{
|
||||
LONG i, j, sx, sy;
|
||||
ULONG Dest, Source, Pattern;
|
||||
ULONG Dest, Source, Pattern = 0, PatternY;
|
||||
PULONG DestBits;
|
||||
BOOL UsesSource;
|
||||
BOOL UsesPattern;
|
||||
BOOL UsesPattern, CalcPattern;
|
||||
LONG RoundedRight;
|
||||
/* Pattern brushes */
|
||||
PGDIBRUSHOBJ GdiBrush;
|
||||
|
@ -284,11 +284,11 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
|||
UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
|
||||
UsesPattern = ((Rop4 & 0xF00000) >> 4) != (Rop4 & 0x0F0000);
|
||||
|
||||
if (UsesPattern)
|
||||
if ((CalcPattern = UsesPattern))
|
||||
{
|
||||
if (Brush == NULL)
|
||||
{
|
||||
UsesPattern = FALSE;
|
||||
UsesPattern = CalcPattern = FALSE;
|
||||
} else
|
||||
if (Brush->iSolidColor == 0xFFFFFFFF)
|
||||
{
|
||||
|
@ -306,6 +306,12 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
|||
PatternObj = (PSURFOBJ)AccessUserObject((ULONG)PatternSurface);
|
||||
PatternWidth = PatternObj->sizlBitmap.cx;
|
||||
PatternHeight = PatternObj->sizlBitmap.cy;
|
||||
CalcPattern = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
CalcPattern = FALSE;
|
||||
Pattern = Brush->iSolidColor & 0xF;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,6 +324,9 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
|||
sx = SourcePoint->x;
|
||||
i = DestRect->left;
|
||||
|
||||
if(CalcPattern)
|
||||
PatternY = j % PatternHeight;
|
||||
|
||||
if (i & 0x1)
|
||||
{
|
||||
Dest = DIB_4BPP_GetPixel(DestSurf, i, j);
|
||||
|
@ -327,12 +336,9 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
|||
Source = DIB_GetSource(SourceSurf, SourceGDI, sx, sy, ColorTranslation);
|
||||
}
|
||||
|
||||
if (UsesPattern)
|
||||
if (UsesPattern && (Brush->iSolidColor == 0xFFFFFFFF))
|
||||
{
|
||||
if (Brush->iSolidColor == 0xFFFFFFFF)
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, i % PatternWidth, j % PatternHeight) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
else
|
||||
Pattern = Brush->iSolidColor & 0xF;
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, i % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
}
|
||||
|
||||
DIB_4BPP_PutPixel(DestSurf, i, j, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xF);
|
||||
|
@ -361,18 +367,19 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
|||
{
|
||||
if (Brush->iSolidColor == 0xFFFFFFFF)
|
||||
{
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, i % PatternWidth, j % PatternHeight) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 1) % PatternWidth, j % PatternHeight) ? GdiBrush->crFore : GdiBrush->crBack) << 4;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 2) % PatternWidth, j % PatternHeight) ? GdiBrush->crFore : GdiBrush->crBack) << 8;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 3) % PatternWidth, j % PatternHeight) ? GdiBrush->crFore : GdiBrush->crBack) << 12;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 4) % PatternWidth, j % PatternHeight) ? GdiBrush->crFore : GdiBrush->crBack) << 16;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 5) % PatternWidth, j % PatternHeight) ? GdiBrush->crFore : GdiBrush->crBack) << 20;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 6) % PatternWidth, j % PatternHeight) ? GdiBrush->crFore : GdiBrush->crBack) << 24;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 7) % PatternWidth, j % PatternHeight) ? GdiBrush->crFore : GdiBrush->crBack) << 28;
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, i % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 1) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 4;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 2) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 8;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 3) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 12;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 4) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 16;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 5) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 20;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 6) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 24;
|
||||
Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 7) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 28;
|
||||
}
|
||||
else
|
||||
{
|
||||
Pattern = ExpandSolidColor[Brush->iSolidColor & 0xF];
|
||||
*DestBits = DIB_DoRop(Rop4, Dest, Source, ExpandSolidColor[Brush->iSolidColor & 0xF]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
*DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
|
||||
|
@ -386,12 +393,9 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
|||
{
|
||||
Source = DIB_GetSource(SourceSurf, SourceGDI, sx, sy, ColorTranslation);
|
||||
}
|
||||
if (UsesPattern)
|
||||
if (UsesPattern && (Brush->iSolidColor == 0xFFFFFFFF))
|
||||
{
|
||||
if (Brush->iSolidColor == 0xFFFFFFFF)
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, i % PatternWidth, j % PatternHeight) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
else
|
||||
Pattern = Brush->iSolidColor & 0xF;
|
||||
Pattern = DIB_1BPP_GetPixel(PatternObj, i % PatternWidth, j % PatternHeight) ? GdiBrush->crFore : GdiBrush->crBack;
|
||||
}
|
||||
DIB_4BPP_PutPixel(DestSurf, i, j, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xF);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue