Add generation of 32bpp DIB code

svn path=/trunk/; revision=17429
This commit is contained in:
Gé van Geldorp 2005-08-18 19:26:37 +00:00
parent 106794e0ab
commit a6b62e7c0d
5 changed files with 158 additions and 461 deletions

View file

@ -129,12 +129,6 @@ BOOLEAN DIB_32BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIP
BOOLEAN DIB_32BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
BOOLEAN DIB_32BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
BOOLEAN FASTCALL DIB_32DstInvert(PBLTINFO);
BOOLEAN FASTCALL DIB32_SrcPaint(PBLTINFO);
BOOLEAN FASTCALL DIB32_NotSrcErase(PBLTINFO);
BOOLEAN FASTCALL DIB32_SrcErase(PBLTINFO);
extern unsigned char notmask[2];
extern unsigned char altnotmask[2];
#define MASK1BPP(x) (1<<(7-((x)&7)))

View file

@ -325,381 +325,6 @@ DIB_32BPP_BitBltSrcCopy(PBLTINFO BltInfo)
return TRUE;
}
BOOLEAN
DIB_32BPP_BitBlt(PBLTINFO BltInfo)
{
ULONG DestX, DestY;
ULONG SourceX, SourceY;
ULONG PatternY = 0, PatternX = 0, orgPatternX = 0;
ULONG Source = 0, Pattern = 0;
BOOL UsesSource;
BOOL UsesPattern;
PULONG DestBits;
ULONG Delta;
switch (BltInfo->Rop4)
{
case ROP4_DSTINVERT:
return DIB_32DstInvert(BltInfo);
break;
case ROP4_SRCPAINT:
return DIB32_SrcPaint(BltInfo);
break;
case ROP4_NOTSRCERASE:
return DIB32_NotSrcErase(BltInfo);
break;
case ROP4_SRCERASE:
return DIB32_SrcErase(BltInfo);
break;
default:
break;
}
UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4);
UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4);
SourceY = BltInfo->SourcePoint.y;
DestBits = (PULONG)((PBYTE)BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.left << 2) +
BltInfo->DestRect.top * BltInfo->DestSurface->lDelta);
Delta = BltInfo->DestSurface->lDelta - ((BltInfo->DestRect.right - BltInfo->DestRect.left) << 2);
if ((UsesSource) && (BltInfo->PatternSurface))
{
if (UsesPattern)
{
PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
BltInfo->PatternSurface->sizlBitmap.cy;
}
orgPatternX = (BltInfo->DestRect.left + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx;
for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
{
SourceX = BltInfo->SourcePoint.x;
PatternX = orgPatternX;
for (DestX = BltInfo->DestRect.left; DestX < BltInfo->DestRect.right; DestX++, DestBits++, SourceX++)
{
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
Pattern = DIB_GetSource(BltInfo->PatternSurface, PatternX, PatternY, BltInfo->XlatePatternToDest);
*DestBits = DIB_DoRop(BltInfo->Rop4, *DestBits, Source, Pattern);
PatternX++;
PatternX %= BltInfo->PatternSurface->sizlBitmap.cx;
}
SourceY++;
PatternY++;
PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
DestBits = (PULONG)((ULONG_PTR)DestBits + Delta);
}
}
else if ((UsesSource) && (!BltInfo->PatternSurface))
{
if (UsesPattern)
{
Pattern = BltInfo->Brush->iSolidColor;
}
for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
{
SourceX = BltInfo->SourcePoint.x;
for (DestX = BltInfo->DestRect.left; DestX < BltInfo->DestRect.right; DestX++, DestBits++, SourceX++)
{
Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
*DestBits = DIB_DoRop(BltInfo->Rop4, *DestBits, Source, Pattern);
}
SourceY++;
DestBits = (PULONG)((ULONG_PTR)DestBits + Delta);
}
}
else if ((!UsesSource) && (BltInfo->PatternSurface))
{
if (UsesPattern)
{
PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
BltInfo->PatternSurface->sizlBitmap.cy;
}
orgPatternX = (BltInfo->DestRect.left + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx;
for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
{
PatternX = orgPatternX;
for (DestX = BltInfo->DestRect.left; DestX < BltInfo->DestRect.right; DestX++, DestBits++)
{
Pattern = DIB_GetSource(BltInfo->PatternSurface, PatternX, PatternY, BltInfo->XlatePatternToDest);
*DestBits = DIB_DoRop(BltInfo->Rop4, *DestBits, 0, Pattern);
PatternX++;
PatternX %= BltInfo->PatternSurface->sizlBitmap.cx;
}
PatternY++;
PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
DestBits = (PULONG)((ULONG_PTR)DestBits + Delta);
}
}
else if ((!UsesSource) && (!BltInfo->PatternSurface))
{
if (UsesPattern)
{
Pattern = BltInfo->Brush->iSolidColor;
}
for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
{
for (DestX = BltInfo->DestRect.left; DestX < BltInfo->DestRect.right; DestX++, DestBits++)
{
*DestBits = DIB_DoRop(BltInfo->Rop4, *DestBits, 0, Pattern);
}
DestBits = (PULONG)((ULONG_PTR)DestBits + Delta);
}
}
return TRUE;
}
/* Optimize functions for bitblt */
BOOLEAN
FASTCALL
DIB_32DstInvert(PBLTINFO BltInfo)
{
ULONG DestX, DestY;
PULONG DestBits;
ULONG bottom = BltInfo->DestRect.bottom;
ULONG right = BltInfo->DestRect.right;
ULONG delta = BltInfo->DestSurface->lDelta - ((BltInfo->DestRect.right - BltInfo->DestRect.left) <<2) ;
DestBits = (PULONG)((PBYTE)BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.left << 2) +
BltInfo->DestRect.top * BltInfo->DestSurface->lDelta);
for (DestY = BltInfo->DestRect.top; DestY < bottom; DestY++)
{
for (DestX = BltInfo->DestRect.left; DestX < right; DestX++, DestBits++)
{
*DestBits = ~*DestBits ;
}
DestBits = (PULONG)((ULONG_PTR)DestBits + delta);
}
/* Return TRUE */
return TRUE;
}
BOOLEAN
FASTCALL
DIB32_SrcErase(PBLTINFO BltInfo)
{
BOOLEAN status = FALSE;
switch (BltInfo->SourceSurface->iBitmapFormat)
{
case BMF_1BPP:
case BMF_4BPP:
case BMF_16BPP:
case BMF_24BPP:
case BMF_32BPP:
{
ULONG DestX, DestY;
ULONG SourceX, SourceY;
PULONG DestBits;
ULONG bottom = BltInfo->DestRect.bottom;
ULONG right = BltInfo->DestRect.right;
ULONG delta = BltInfo->DestSurface->lDelta - ((BltInfo->DestRect.right - BltInfo->DestRect.left) <<2) ;
DestBits = (PULONG)((PBYTE)BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.left << 2) +
BltInfo->DestRect.top * BltInfo->DestSurface->lDelta);
SourceY = BltInfo->SourcePoint.y;
for (DestY = BltInfo->DestRect.top; DestY < bottom; DestY++)
{
SourceX = BltInfo->SourcePoint.x;
for (DestX = BltInfo->DestRect.left; DestX < right; DestX++, DestBits++, SourceX++)
{
*DestBits = ~(*DestBits & DIB_GetSource(BltInfo->SourceSurface, SourceX,
SourceY, BltInfo->XlateSourceToDest));
}
DestBits = (PULONG)((ULONG_PTR)DestBits + delta);
SourceY++;
}
}
status = TRUE;
break;
default:
break;
}
return status;
}
BOOLEAN
FASTCALL
DIB32_NotSrcErase(PBLTINFO BltInfo)
{
BOOLEAN status = FALSE;
switch (BltInfo->SourceSurface->iBitmapFormat)
{
case BMF_1BPP:
case BMF_4BPP:
case BMF_16BPP:
case BMF_24BPP:
case BMF_32BPP:
{
ULONG DestX, DestY;
ULONG SourceX, SourceY;
PULONG DestBits;
ULONG bottom = BltInfo->DestRect.bottom;
ULONG right = BltInfo->DestRect.right;
ULONG delta = BltInfo->DestSurface->lDelta - ((BltInfo->DestRect.right - BltInfo->DestRect.left) <<2);
DestBits = (PULONG)((PBYTE)BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.left << 2) +
BltInfo->DestRect.top * BltInfo->DestSurface->lDelta);
SourceY = BltInfo->SourcePoint.y;
for (DestY = BltInfo->DestRect.top; DestY < bottom; DestY++)
{
SourceX = BltInfo->SourcePoint.x;
for (DestX = BltInfo->DestRect.left; DestX < right; DestX++, DestBits++, SourceX++)
{
*DestBits = ~(*DestBits | DIB_GetSource(BltInfo->SourceSurface, SourceX,
SourceY, BltInfo->XlateSourceToDest));
}
DestBits = (PULONG)((ULONG_PTR)DestBits + delta);
SourceY++;
}
}
status = TRUE;
break;
default:
break;
}
return status;
}
BOOLEAN
FASTCALL
DIB32_SrcPaint(PBLTINFO BltInfo)
{
BOOLEAN status = FALSE;
switch (BltInfo->SourceSurface->iBitmapFormat)
{
case BMF_1BPP:
case BMF_4BPP:
case BMF_16BPP:
case BMF_24BPP:
{
ULONG DestX, DestY;
ULONG SourceX, SourceY;
PULONG DestBits;
ULONG bottom = BltInfo->DestRect.bottom;
ULONG right = BltInfo->DestRect.right;
ULONG delta = BltInfo->DestSurface->lDelta - ((BltInfo->DestRect.right - BltInfo->DestRect.left) <<2) ;
DestBits = (PULONG)((PBYTE)BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.left << 2) +
BltInfo->DestRect.top * BltInfo->DestSurface->lDelta);
SourceY = BltInfo->SourcePoint.y;
for (DestY = BltInfo->DestRect.top; DestY < bottom; DestY++)
{
SourceX = BltInfo->SourcePoint.x;
for (DestX = BltInfo->DestRect.left; DestX < right; DestX++, DestBits++, SourceX++)
{
*DestBits = (*DestBits | DIB_GetSource(BltInfo->SourceSurface, SourceX,
SourceY, BltInfo->XlateSourceToDest));
}
DestBits = (PULONG)((ULONG_PTR)DestBits + delta);
SourceY++;
}
}
status = TRUE;
break;
case BMF_32BPP:
{
ULONG DestX, DestY;
ULONG SourceX, SourceY;
PULONG DestBits;
ULONG bottom = BltInfo->DestRect.bottom;
ULONG right = BltInfo->DestRect.right;
ULONG delta = BltInfo->DestSurface->lDelta - ((BltInfo->DestRect.right - BltInfo->DestRect.left) <<2) ;
DestBits = (PULONG)((PBYTE)BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.left << 2) +
BltInfo->DestRect.top * BltInfo->DestSurface->lDelta);
SourceY = BltInfo->SourcePoint.y;
for (DestY = BltInfo->DestRect.top; DestY < bottom; DestY++)
{
SourceX = BltInfo->SourcePoint.x;
for (DestX = BltInfo->DestRect.left; DestX < right; DestX++, DestBits++, SourceX++)
{
*DestBits = (*DestBits | DIB_32BPP_GetPixel(BltInfo->SourceSurface, SourceX, SourceY));
}
DestBits = (PULONG)((ULONG_PTR)DestBits + delta);
SourceY++;
}
}
status = TRUE;
break;
default:
break;
}
return status;
}
BOOLEAN
DIB_32BPP_ColorFill(SURFOBJ* DestSurface, RECTL* DestRect, ULONG color)
{

View file

@ -18,6 +18,7 @@
<file>dib16gen.c</file>
<file>dib24bpp.c</file>
<file>dib32bpp.c</file>
<file>dib32gen.c</file>
<file>dib.c</file>
</directory>
<directory name="eng">

View file

@ -423,7 +423,14 @@ CreateGetSource(FILE *Out, unsigned Bpp, PROPINFO RopInfo, int Flags,
Output(Out, ") & 0x%x)", (1 << SourceBpp) - 1);
}
}
Output(Out, " & 0xffff)%s;\n", After);
if (32 == Bpp)
{
Output(Out, ")%s;\n", After);
}
else
{
Output(Out, " & 0x%x)%s;\n", (1 << Bpp) - 1, After);
}
if (SourceBpp <= 16)
{
Output(Out, "SourcePixels--;\n");
@ -436,20 +443,29 @@ CreateGetSource(FILE *Out, unsigned Bpp, PROPINFO RopInfo, int Flags,
}
static void
CreateCounts(FILE *Out)
CreateCounts(FILE *Out, unsigned Bpp)
{
MARK(Out);
Output(Out, "LeftCount = ((ULONG_PTR) DestBase >> 1) & 0x01;\n");
Output(Out, "CenterCount = (BltInfo->DestRect.right - BltInfo->DestRect.left -\n");
Output(Out, " LeftCount) / 2;\n");
Output(Out, "RightCount = (BltInfo->DestRect.right - BltInfo->DestRect.left -\n");
Output(Out, " LeftCount - 2 * CenterCount);\n");
if (32 != Bpp)
{
Output(Out, "LeftCount = ((ULONG_PTR) DestBase >> 1) & 0x01;\n");
Output(Out, "CenterCount = (BltInfo->DestRect.right - BltInfo->DestRect.left -\n");
Output(Out, " LeftCount) / 2;\n");
Output(Out, "RightCount = (BltInfo->DestRect.right - BltInfo->DestRect.left -\n");
Output(Out, " LeftCount - 2 * CenterCount);\n");
}
else
{
Output(Out, "CenterCount = BltInfo->DestRect.right - BltInfo->DestRect.left;\n");
}
}
static void
CreateBitCase(FILE *Out, unsigned Bpp, PROPINFO RopInfo, int Flags,
unsigned SourceBpp)
{
unsigned Partial;
MARK(Out);
if (RopInfo->UsesSource)
{
@ -458,7 +474,7 @@ CreateBitCase(FILE *Out, unsigned Bpp, PROPINFO RopInfo, int Flags,
CreateBase(Out, 1, Flags, SourceBpp);
}
CreateBase(Out, 0, Flags, Bpp);
CreateCounts(Out);
CreateCounts(Out, Bpp);
MARK(Out);
}
if (RopInfo->UsesPattern && 0 != (Flags & FLAG_PATTERNSURFACE))
@ -518,56 +534,67 @@ CreateBitCase(FILE *Out, unsigned Bpp, PROPINFO RopInfo, int Flags,
else
{
Output(Out, "\n");
Output(Out, "if (0 != LeftCount)\n");
Output(Out, "{\n");
if (RopInfo->UsesSource && 0 == (Flags & FLAG_FORCENOUSESSOURCE))
if (32 != Bpp)
{
CreateGetSource(Out, Bpp, RopInfo, Flags | FLAG_FORCERAWSOURCEAVAIL,
SourceBpp, 0);
MARK(Out);
}
if (RopInfo->UsesPattern && 0 != (Flags & FLAG_PATTERNSURFACE))
{
Output(Out, "Pattern = DIB_GetSource(BltInfo->PatternSurface, PatternX, PatternY, BltInfo->XlatePatternToDest);\n");
Output(Out, "if (BltInfo->PatternSurface->sizlBitmap.cx <= ++PatternX)\n");
Output(Out, "if (0 != LeftCount)\n");
Output(Out, "{\n");
Output(Out, "PatternX -= BltInfo->PatternSurface->sizlBitmap.cx;\n");
if (RopInfo->UsesSource && 0 == (Flags & FLAG_FORCENOUSESSOURCE))
{
CreateGetSource(Out, Bpp, RopInfo, Flags | FLAG_FORCERAWSOURCEAVAIL,
SourceBpp, 0);
MARK(Out);
}
if (RopInfo->UsesPattern && 0 != (Flags & FLAG_PATTERNSURFACE))
{
Output(Out, "Pattern = DIB_GetSource(BltInfo->PatternSurface, PatternX, PatternY, BltInfo->XlatePatternToDest);\n");
Output(Out, "if (BltInfo->PatternSurface->sizlBitmap.cx <= ++PatternX)\n");
Output(Out, "{\n");
Output(Out, "PatternX -= BltInfo->PatternSurface->sizlBitmap.cx;\n");
Output(Out, "}\n");
}
if ((RopInfo->UsesSource && 0 == (Flags & FLAG_FORCENOUSESSOURCE) &&
Bpp != SourceBpp) ||
(RopInfo->UsesPattern && 0 != (Flags & FLAG_PATTERNSURFACE)))
{
Output(Out, "\n");
}
CreateOperation(Out, Bpp, RopInfo, SourceBpp, 16);
Output(Out, ";\n");
MARK(Out);
Output(Out, "\n");
Output(Out, "DestPtr = (PULONG)((char *) DestPtr + 2);\n");
Output(Out, "}\n");
}
if ((RopInfo->UsesSource && 0 == (Flags & FLAG_FORCENOUSESSOURCE) &&
Bpp != SourceBpp) ||
(RopInfo->UsesPattern && 0 != (Flags & FLAG_PATTERNSURFACE)))
{
Output(Out, "\n");
}
CreateOperation(Out, Bpp, RopInfo, SourceBpp, 16);
Output(Out, ";\n");
MARK(Out);
Output(Out, "\n");
Output(Out, "DestPtr = (PULONG)((char *) DestPtr + 2);\n");
Output(Out, "}\n");
Output(Out, "\n");
Output(Out, "for (i = 0; i < CenterCount; i++)\n");
Output(Out, "{\n");
if (RopInfo->UsesSource && 0 == (Flags & FLAG_FORCENOUSESSOURCE))
{
CreateGetSource(Out, Bpp, RopInfo, Flags, SourceBpp, 0);
CreateGetSource(Out, Bpp, RopInfo, Flags, SourceBpp, 16);
MARK(Out);
for (Partial = 0; Partial < 32 / Bpp; Partial++)
{
CreateGetSource(Out, Bpp, RopInfo, Flags, SourceBpp,
Partial * Bpp);
MARK(Out);
}
Output(Out, "\n");
}
if (RopInfo->UsesPattern && 0 != (Flags & FLAG_PATTERNSURFACE))
{
Output(Out, "Pattern = DIB_GetSource(BltInfo->PatternSurface, PatternX, PatternY, BltInfo->XlatePatternToDest);\n");
Output(Out, "if (BltInfo->PatternSurface->sizlBitmap.cx <= ++PatternX)\n");
Output(Out, "{\n");
Output(Out, "PatternX -= BltInfo->PatternSurface->sizlBitmap.cx;\n");
Output(Out, "}\n");
Output(Out, "Pattern |= DIB_GetSource(BltInfo->PatternSurface, PatternX, PatternY, BltInfo->XlatePatternToDest) << 16;\n");
Output(Out, "if (BltInfo->PatternSurface->sizlBitmap.cx <= ++PatternX)\n");
Output(Out, "{\n");
Output(Out, "PatternX -= BltInfo->PatternSurface->sizlBitmap.cx;\n");
Output(Out, "}\n");
for (Partial = 0; Partial < 32 / Bpp; Partial++)
{
if (0 == Partial)
{
Output(Out, "Pattern = DIB_GetSource(BltInfo->PatternSurface, PatternX, PatternY, BltInfo->XlatePatternToDest);\n");
}
else
{
Output(Out, "Pattern |= DIB_GetSource(BltInfo->PatternSurface, PatternX, PatternY, BltInfo->XlatePatternToDest) << %u;\n", Partial * Bpp);
}
Output(Out, "if (BltInfo->PatternSurface->sizlBitmap.cx <= ++PatternX)\n");
Output(Out, "{\n");
Output(Out, "PatternX -= BltInfo->PatternSurface->sizlBitmap.cx;\n");
Output(Out, "}\n");
}
Output(Out, "\n");
}
CreateOperation(Out, Bpp, RopInfo, SourceBpp, 32);
@ -577,27 +604,30 @@ CreateBitCase(FILE *Out, unsigned Bpp, PROPINFO RopInfo, int Flags,
Output(Out, "DestPtr++;\n");
Output(Out, "}\n");
Output(Out, "\n");
Output(Out, "if (0 != RightCount)\n");
Output(Out, "{\n");
if (RopInfo->UsesSource && 0 == (Flags & FLAG_FORCENOUSESSOURCE))
if (32 != Bpp)
{
CreateGetSource(Out, Bpp, RopInfo, Flags, SourceBpp, 0);
Output(Out, "if (0 != RightCount)\n");
Output(Out, "{\n");
if (RopInfo->UsesSource && 0 == (Flags & FLAG_FORCENOUSESSOURCE))
{
CreateGetSource(Out, Bpp, RopInfo, Flags, SourceBpp, 0);
MARK(Out);
}
if (RopInfo->UsesPattern && 0 != (Flags & FLAG_PATTERNSURFACE))
{
Output(Out, "Pattern = DIB_GetSource(BltInfo->PatternSurface, PatternX, PatternY, BltInfo->XlatePatternToDest);\n");
}
if ((RopInfo->UsesSource && 0 == (Flags & FLAG_FORCENOUSESSOURCE)) ||
(RopInfo->UsesPattern && 0 != (Flags & FLAG_PATTERNSURFACE)))
{
Output(Out, "\n");
}
CreateOperation(Out, Bpp, RopInfo, SourceBpp, 16);
Output(Out, ";\n");
MARK(Out);
}
if (RopInfo->UsesPattern && 0 != (Flags & FLAG_PATTERNSURFACE))
{
Output(Out, "Pattern = DIB_GetSource(BltInfo->PatternSurface, PatternX, PatternY, BltInfo->XlatePatternToDest);\n");
}
if ((RopInfo->UsesSource && 0 == (Flags & FLAG_FORCENOUSESSOURCE)) ||
(RopInfo->UsesPattern && 0 != (Flags & FLAG_PATTERNSURFACE)))
{
Output(Out, "}\n");
Output(Out, "\n");
}
CreateOperation(Out, Bpp, RopInfo, SourceBpp, 16);
Output(Out, ";\n");
MARK(Out);
Output(Out, "}\n");
Output(Out, "\n");
if (RopInfo->UsesPattern && 0 != (Flags & FLAG_PATTERNSURFACE))
{
if (0 == (Flags & FLAG_BOTTOMUP))
@ -716,6 +746,7 @@ static void
CreatePrimitive(FILE *Out, unsigned Bpp, PROPINFO RopInfo)
{
int First;
unsigned Partial;
MARK(Out);
Output(Out, "\n");
@ -741,12 +772,6 @@ CreatePrimitive(FILE *Out, unsigned Bpp, PROPINFO RopInfo)
{
Output(Out, "ULONG LineIndex, LineCount;\n");
Output(Out, "ULONG i;\n");
#ifdef TODO
if (RopInfo->UsesSource)
{
Output(Out, "ULONG SourceX, SourceY;\n");
}
#endif
if (RopInfo->UsesPattern)
{
Output(Out, "ULONG PatternX =0, PatternY = 0, BasePatternX = 0;\n");
@ -775,7 +800,14 @@ CreatePrimitive(FILE *Out, unsigned Bpp, PROPINFO RopInfo)
Output(Out, "ULONG RawSource;\n");
Output(Out, "unsigned SourcePixels, BaseSourcePixels;\n");
}
Output(Out, "ULONG LeftCount, CenterCount, RightCount;\n");
if (32 == Bpp)
{
Output(Out, "ULONG CenterCount;\n");
}
else
{
Output(Out, "ULONG LeftCount, CenterCount, RightCount;\n");
}
if (ROPCODE_GENERIC == RopInfo->RopCode)
{
Output(Out, "BOOLEAN UsesDest, UsesSource, UsesPattern;\n");
@ -788,7 +820,7 @@ CreatePrimitive(FILE *Out, unsigned Bpp, PROPINFO RopInfo)
if (! RopInfo->UsesSource)
{
CreateBase(Out, 0, 0, Bpp);
CreateCounts(Out);
CreateCounts(Out, Bpp);
MARK(Out);
}
Output(Out, "LineCount = BltInfo->DestRect.bottom - BltInfo->DestRect.top;\n");
@ -815,8 +847,26 @@ CreatePrimitive(FILE *Out, unsigned Bpp, PROPINFO RopInfo)
Output(Out, "if (UsesPattern)\n");
Output(Out, "{\n");
}
Output(Out, "Pattern = BltInfo->Brush->iSolidColor |\n");
Output(Out, " (BltInfo->Brush->iSolidColor << 16);\n");
for (Partial = 0; Partial < 32 / Bpp; Partial++)
{
if (0 == Partial)
{
Output(Out, "Pattern = BltInfo->Brush->iSolidColor");
}
else
{
Output(Out, " (BltInfo->Brush->iSolidColor << %d)",
Partial * Bpp);
}
if (32 / Bpp <= Partial + 1)
{
Output(Out, ";\n");
}
else
{
Output(Out, " |\n");
}
}
if (ROPCODE_PATINVERT == RopInfo->RopCode ||
ROPCODE_MERGECOPY == RopInfo->RopCode)
{
@ -892,16 +942,29 @@ CreateBitBlt(FILE *Out, unsigned Bpp)
Output(Out, "}\n");
}
int
main(int argc, char *argv[])
static void
Generate(char *OutputDir, unsigned Bpp)
{
FILE *Out;
unsigned RopCode;
unsigned Bpp;
PROPINFO RopInfo;
char *FileName;
Bpp = 16;
Out = fopen(argv[1], "w");
FileName = malloc(strlen(OutputDir) + 12);
if (NULL == FileName)
{
fprintf(stderr, "Out of memory\n");
exit(1);
}
strcpy(FileName, OutputDir);
if ('/' != FileName[strlen(FileName) - 1])
{
strcat(FileName, "/");
}
sprintf(FileName + strlen(FileName), "dib%ugen.c", Bpp);
Out = fopen(FileName, "w");
free(FileName);
if (NULL == Out)
{
perror("Error opening output file");
@ -928,6 +991,19 @@ main(int argc, char *argv[])
CreateBitBlt(Out, Bpp);
fclose(Out);
}
int
main(int argc, char *argv[])
{
unsigned Index;
static unsigned DestBpp[] =
{ 16, 32 };
for (Index = 0; Index < sizeof(DestBpp) / sizeof(DestBpp[0]); Index++)
{
Generate(argv[1], DestBpp[Index]);
}
return 0;
}

View file

@ -41,11 +41,12 @@ gendib_clean:
-@$(rm) $(GENDIB_TARGET) $(GENDIB_OBJECTS) 2>$(NUL)
clean: gendib_clean
GENDIB_16BPP_FILE = subsys$(SEP)win32k$(SEP)dib$(SEP)dib16gen.c
GENDIB_DIB_DIR = subsys$(SEP)win32k$(SEP)dib
GENDIB_DIB_FILES = \
$(GENDIB_16BPP_FILE)
$(GENDIB_DIB_DIR)$(SEP)dib16gen.c \
$(GENDIB_DIB_DIR)$(SEP)dib32gen.c
$(GENDIB_DIB_FILES): $(GENDIB_TARGET)
$(ECHO_GENDIB)
$(Q)$(GENDIB_TARGET) $(GENDIB_DIB_FILES)
$(Q)$(GENDIB_TARGET) $(GENDIB_DIB_DIR)