Author: greatlrd
Date: Fri Dec 29 16:16:53 2006
New Revision: 25237
URL:
http://svn.reactos.org/svn/reactos?rev=25237&view=rev
Log:
commit same strechblt code for 8,16,32, it does not using putpixel anylong for 8 and 32,
and small cleanup
this code can be makefaster, how remove getpixel that will doing huge incress in speed,
split calc to
simple 1x 2x .. zoom in/out now we are using 1.1x 2.2x Zoom and 1x 2x zoom same code. if
we split it we will
see a speed incress.
Modified:
trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c
trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c
trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c Fri Dec 29 16:16:53 2006
@@ -741,7 +741,6 @@
LONG sy = 0;
LONG DesX;
LONG DesY;
- LONG color;
PULONG DestBits;
LONG DifflDelta;
@@ -784,6 +783,10 @@
sy_max = DesSizeY;
sy = SourceRect->top;
+ DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1) +
+ DestRect->top * DestSurf->lDelta);
+
+ DifflDelta = DestSurf->lDelta - (DesSizeX << 1);
switch(SourceSurf->iBitmapFormat)
{
@@ -792,10 +795,6 @@
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
- DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1) +
- DestRect->top * DestSurf->lDelta);
- DifflDelta = DestSurf->lDelta - (DesSizeX << 1);
-
for (DesY=0; DesY<DesSizeY; DesY++)
{
sx = SourceRect->left;
@@ -803,17 +802,11 @@
for (DesX=0; DesX<DesSizeX; DesX++)
{
- if(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
- {
- *DestBits = XLATEOBJ_iXlate(ColorTranslation, 0);
- DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
- }
- else
- {
- *DestBits = XLATEOBJ_iXlate(ColorTranslation, 1);
- DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
- }
-
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_1BPP_GetPixel(SourceSurf, sx, sy));
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
+
sx += SrcZoomXHight;
sx_dec += SrcZoomXLow;
if (sx_dec >= sx_max)
@@ -839,11 +832,6 @@
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
- DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1)
+
- DestRect->top * DestSurf->lDelta);
-
- DifflDelta = DestSurf->lDelta - (DesSizeX << 1);
-
for (DesY=0; DesY<DesSizeY; DesY++)
{
sx = SourceRect->left;
@@ -851,9 +839,9 @@
for (DesX=0; DesX<DesSizeX; DesX++)
{
- color = DIB_4BPP_GetPixel(SourceSurf, sx, sy);
- color = XLATEOBJ_iXlate(ColorTranslation, color);
- *DestBits = color;
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_4BPP_GetPixel(SourceSurf, sx, sy));
+
DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
sx += SrcZoomXHight;
@@ -881,10 +869,6 @@
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
- DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1)
+
- DestRect->top * DestSurf->lDelta);
- DifflDelta = DestSurf->lDelta - (DesSizeX << 1);
-
for (DesY=0; DesY<DesSizeY; DesY++)
{
sx = SourceRect->left;
@@ -892,9 +876,9 @@
for (DesX=0; DesX<DesSizeX; DesX++)
{
- color = DIB_8BPP_GetPixel(SourceSurf, sx, sy);
- color = XLATEOBJ_iXlate(ColorTranslation, color);
- *DestBits = color;
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_8BPP_GetPixel(SourceSurf, sx, sy));
+
DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
sx += SrcZoomXHight;
@@ -935,9 +919,9 @@
for (DesX=0; DesX<DesSizeX; DesX++)
{
- color = DIB_24BPP_GetPixel(SourceSurf, sx, sy);
- color = XLATEOBJ_iXlate(ColorTranslation, color);
- *DestBits = color;
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_24BPP_GetPixel(SourceSurf, sx, sy));
+
DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
sx += SrcZoomXHight;
@@ -965,10 +949,6 @@
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
- DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1)
+
- DestRect->top * DestSurf->lDelta);
- DifflDelta = DestSurf->lDelta - (DesSizeX << 1);
-
for (DesY=0; DesY<DesSizeY; DesY++)
{
sx = SourceRect->left;
@@ -976,9 +956,9 @@
for (DesX=0; DesX<DesSizeX; DesX++)
{
- color = DIB_32BPP_GetPixel(SourceSurf, sx, sy);
- color = XLATEOBJ_iXlate(ColorTranslation, color);
- *DestBits = color;
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_32BPP_GetPixel(SourceSurf, sx, sy));
+
DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
sx += SrcZoomXHight;
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c Fri Dec 29 16:16:53 2006
@@ -475,160 +475,243 @@
CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation,
ULONG Mode)
{
-
+
LONG SrcSizeY;
LONG SrcSizeX;
LONG DesSizeY;
- LONG DesSizeX;
- LONG sx;
- LONG sy;
+ LONG DesSizeX;
+ LONG sx = 0;
+ LONG sy = 0;
LONG DesX;
LONG DesY;
- LONG color;
PULONG DestBits;
LONG DifflDelta;
+
+ LONG SrcZoomXHight;
+ LONG SrcZoomXLow;
+ LONG SrcZoomYHight;
+ LONG SrcZoomYLow;
+
+ LONG sy_dec = 0;
+ LONG sy_max;
+
+ LONG sx_dec = 0;
+ LONG sx_max;
DPRINT("DIB_32BPP_StretchBlt: Source BPP: %u, srcRect: (%d,%d)-(%d,%d), dstRect:
(%d,%d)-(%d,%d)\n",
BitsPerFormat(SourceSurf->iBitmapFormat), SourceRect->left,
SourceRect->top, SourceRect->right,
SourceRect->bottom, DestRect->left, DestRect->top,
DestRect->right, DestRect->bottom);
+ /* Calc the Zoom height of Source */
SrcSizeY = SourceRect->bottom - SourceRect->top;
+
+ /* Calc the Zoom Width of Source */
SrcSizeX = SourceRect->right - SourceRect->left;
+ /* Calc the Zoom height of Destions */
DesSizeY = DestRect->bottom - DestRect->top;
- DesSizeX = DestRect->right - DestRect->left;
-
+
+ /* Calc the Zoom width of Destions */
+ DesSizeX = DestRect->right - DestRect->left;
+
+ /* Calc the zoom factor of soruce height */
+ SrcZoomYHight = SrcSizeY / DesSizeY;
+ SrcZoomYLow = SrcSizeY - (SrcZoomYHight * DesSizeY);
+
+ /* Calc the zoom factor of soruce width */
+ SrcZoomXHight = SrcSizeX / DesSizeX;
+ SrcZoomXLow = SrcSizeX - (SrcZoomXHight * DesSizeX);
+
+ sx_max = DesSizeX;
+ sy_max = DesSizeY;
+ sy = SourceRect->top;
+
+ DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 2) +
+ DestRect->top * DestSurf->lDelta);
+
+ DifflDelta = DestSurf->lDelta - (DesSizeX << 2);
switch(SourceSurf->iBitmapFormat)
{
- case BMF_1BPP:
- /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
- /* This is a reference implementation, it hasn't been optimized for speed */
-
- DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 2) +
- DestRect->top * DestSurf->lDelta);
-
- DifflDelta = DestSurf->lDelta - (DesSizeX << 2);
-
+ case BMF_1BPP:
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
+ /* This is a reference implementation, it hasn't been optimized for speed */
for (DesY=0; DesY<DesSizeY; DesY++)
- {
- sy = ((DesY * SrcSizeY) / DesSizeY) + SourceRect->top;
-
- for (DesX=0; DesX<DesSizeX; DesX++, DestBits++ )
- {
- sx = ((DesX * SrcSizeX) / DesSizeX) + SourceRect->left;
-
- if(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
- {
- *DestBits = XLATEOBJ_iXlate(ColorTranslation, 0);
- }
- else
- {
- *DestBits = XLATEOBJ_iXlate(ColorTranslation, 1);
- }
- }
+ {
+ sx = SourceRect->left;
+ sx_dec = 0;
+ for (DesX=0; DesX<DesSizeX; DesX++)
+ {
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_1BPP_GetPixel(SourceSurf, sx, sy));
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + 4);
+
+ sx += SrcZoomXHight;
+ sx_dec += SrcZoomXLow;
+ if (sx_dec >= sx_max)
+ {
+ sx++;
+ sx_dec -= sx_max;
+ }
+ }
+
DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
- }
-
- break;
-
- case BMF_4BPP:
+
+ sy += SrcZoomYHight;
+ sy_dec += SrcZoomYLow;
+ if (sy_dec >= sy_max)
+ {
+ sy++;
+ sy_dec -= sy_max;
+ }
+ }
+ break;
+
+ case BMF_4BPP:
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
- DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 2) +
- DestRect->top * DestSurf->lDelta);
-
- DifflDelta = DestSurf->lDelta - (DesSizeX << 2);
-
for (DesY=0; DesY<DesSizeY; DesY++)
- {
- sy = ((DesY * SrcSizeY) / DesSizeY) + SourceRect->top;
-
- for (DesX=0; DesX<DesSizeX; DesX++, DestBits++ )
- {
- sx = ((DesX * SrcSizeX) / DesSizeX) + SourceRect->left;
- color = DIB_4BPP_GetPixel(SourceSurf, sx, sy);
- color = XLATEOBJ_iXlate(ColorTranslation, color);
- *DestBits = color;
- }
-
+ {
+ sx = SourceRect->left;
+ sx_dec = 0;
+ for (DesX=0; DesX<DesSizeX; DesX++)
+ {
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_4BPP_GetPixel(SourceSurf, sx, sy));
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + 4);
+
+ sx += SrcZoomXHight;
+ sx_dec += SrcZoomXLow;
+ if (sx_dec >= sx_max)
+ {
+ sx++;
+ sx_dec -= sx_max;
+ }
+ }
+
DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
- }
+
+ sy += SrcZoomYHight;
+ sy_dec += SrcZoomYLow;
+ if (sy_dec >= sy_max)
+ {
+ sy++;
+ sy_dec -= sy_max;
+ }
+ }
break;
case BMF_8BPP:
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
- DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 2) +
- DestRect->top * DestSurf->lDelta);
-
- DifflDelta = DestSurf->lDelta - (DesSizeX << 2);
-
for (DesY=0; DesY<DesSizeY; DesY++)
- {
- sy = ((DesY * SrcSizeY) / DesSizeY) + SourceRect->top;
-
- for (DesX=0; DesX<DesSizeX; DesX++, DestBits++)
- {
- sx = ((DesX * SrcSizeX) / DesSizeX) + SourceRect->left;
- color = DIB_8BPP_GetPixel(SourceSurf, sx, sy);
- color = XLATEOBJ_iXlate(ColorTranslation, color);
- *DestBits = color;
- }
+ {
+ sx = SourceRect->left;
+ sx_dec = 0;
+ for (DesX=0; DesX<DesSizeX; DesX++)
+ {
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_8BPP_GetPixel(SourceSurf, sx, sy));
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + 4);
+
+ sx += SrcZoomXHight;
+ sx_dec += SrcZoomXLow;
+ if (sx_dec >= sx_max)
+ {
+ sx++;
+ sx_dec -= sx_max;
+ }
+ }
+
DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
- }
+
+ sy += SrcZoomYHight;
+ sy_dec += SrcZoomYLow;
+ if (sy_dec >= sy_max)
+ {
+ sy++;
+ sy_dec -= sy_max;
+ }
+ }
break;
- case BMF_16BPP:
+ case BMF_16BPP:
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
- DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 2) +
- DestRect->top * DestSurf->lDelta);
-
- DifflDelta = DestSurf->lDelta - (DesSizeX << 2);
-
for (DesY=0; DesY<DesSizeY; DesY++)
- {
- sy = ((DesY * SrcSizeY) / DesSizeY) + SourceRect->top;
-
- for (DesX=0; DesX<DesSizeX; DesX++, DestBits++)
- {
- sx = ((DesX * SrcSizeX) / DesSizeX) + SourceRect->left;
- color = DIB_16BPP_GetPixel(SourceSurf, sx, sy);
- color = XLATEOBJ_iXlate(ColorTranslation, color);
- *DestBits = color;
- }
+ {
+ sx = SourceRect->left;
+ sx_dec = 0;
+ for (DesX=0; DesX<DesSizeX; DesX++)
+ {
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_16BPP_GetPixel(SourceSurf, sx, sy));
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + 4);
+
+ sx += SrcZoomXHight;
+ sx_dec += SrcZoomXLow;
+ if (sx_dec >= sx_max)
+ {
+ sx++;
+ sx_dec -= sx_max;
+ }
+ }
+
DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
- }
- break;
+
+ sy += SrcZoomYHight;
+ sy_dec += SrcZoomYLow;
+ if (sy_dec >= sy_max)
+ {
+ sy++;
+ sy_dec -= sy_max;
+ }
+ }
+ break;
case BMF_24BPP:
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
- DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 2) +
- DestRect->top * DestSurf->lDelta);
-
- DifflDelta = DestSurf->lDelta - (DesSizeX << 2);
-
for (DesY=0; DesY<DesSizeY; DesY++)
- {
- sy = ((DesY * SrcSizeY) / DesSizeY) + SourceRect->top;
-
- for (DesX=0; DesX<DesSizeX; DesX++, DestBits++)
- {
- sx = ((DesX * SrcSizeX) / DesSizeX) + SourceRect->left;
- color = DIB_24BPP_GetPixel(SourceSurf, sx, sy);
- color = XLATEOBJ_iXlate(ColorTranslation, color);
- *DestBits = color;
- }
+ {
+ sx = SourceRect->left;
+ sx_dec = 0;
+ for (DesX=0; DesX<DesSizeX; DesX++)
+ {
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_24BPP_GetPixel(SourceSurf, sx, sy));
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + 4);
+
+ sx += SrcZoomXHight;
+ sx_dec += SrcZoomXLow;
+ if (sx_dec >= sx_max)
+ {
+ sx++;
+ sx_dec -= sx_max;
+ }
+ }
+
DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
- }
- break;
+
+ sy += SrcZoomYHight;
+ sy_dec += SrcZoomYLow;
+ if (sy_dec >= sy_max)
+ {
+ sy++;
+ sy_dec -= sy_max;
+ }
+ }
+ break;
case BMF_32BPP:
return ScaleRectAvg32(DestSurf, SourceSurf, DestRect, SourceRect, MaskOrigin,
BrushOrigin,
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c Fri Dec 29 16:16:53 2006
@@ -463,65 +463,128 @@
LONG SrcSizeY;
LONG SrcSizeX;
LONG DesSizeY;
- LONG DesSizeX;
- LONG sx;
- LONG sy;
+ LONG DesSizeX;
+ LONG sx = 0;
+ LONG sy = 0;
LONG DesX;
LONG DesY;
- LONG color;
+ PULONG DestBits;
+ LONG DifflDelta;
+
+ LONG SrcZoomXHight;
+ LONG SrcZoomXLow;
+ LONG SrcZoomYHight;
+ LONG SrcZoomYLow;
+
+ LONG sy_dec = 0;
+ LONG sy_max;
+
+ LONG sx_dec = 0;
+ LONG sx_max;
DPRINT("DIB_8BPP_StretchBlt: Source BPP: %u, srcRect: (%d,%d)-(%d,%d), dstRect:
(%d,%d)-(%d,%d)\n",
BitsPerFormat(SourceSurf->iBitmapFormat), SourceRect->left,
SourceRect->top, SourceRect->right, SourceRect->bottom,
DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
+ /* Calc the Zoom height of Source */
SrcSizeY = SourceRect->bottom - SourceRect->top;
+
+ /* Calc the Zoom Width of Source */
SrcSizeX = SourceRect->right - SourceRect->left;
+ /* Calc the Zoom height of Destions */
DesSizeY = DestRect->bottom - DestRect->top;
+
+ /* Calc the Zoom width of Destions */
DesSizeX = DestRect->right - DestRect->left;
+
+ /* Calc the zoom factor of soruce height */
+ SrcZoomYHight = SrcSizeY / DesSizeY;
+ SrcZoomYLow = SrcSizeY - (SrcZoomYHight * DesSizeY);
+
+ /* Calc the zoom factor of soruce width */
+ SrcZoomXHight = SrcSizeX / DesSizeX;
+ SrcZoomXLow = SrcSizeX - (SrcZoomXHight * DesSizeX);
+
+ sx_max = DesSizeX;
+ sy_max = DesSizeY;
+ sy = SourceRect->top;
+
+ DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left) +
+ DestRect->top * DestSurf->lDelta);
+
+ DifflDelta = DestSurf->lDelta - DesSizeX ;
switch(SourceSurf->iBitmapFormat)
{
case BMF_1BPP:
- /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
- /* This is a reference implementation, it hasn't been optimized for speed */
-
- for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
- {
- sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) +
SourceRect->top;
-
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) +
SourceRect->left;
-
- if(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
- {
- DIB_8BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, 0));
- }
- else
- {
- DIB_8BPP_PutPixel(DestSurf, DesX, DesY,
XLATEOBJ_iXlate(ColorTranslation, 1));
- }
- }
- }
-
- break;
-
- case BMF_4BPP:
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
-
- for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
- {
- sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) +
SourceRect->top;
-
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) +
SourceRect->left;
- color = DIB_4BPP_GetPixel(SourceSurf, sx, sy);
- DIB_8BPP_PutPixel(DestSurf, DesX, DesY,
XLATEOBJ_iXlate(ColorTranslation, color));
+ for (DesY=0; DesY<DesSizeY; DesY++)
+ {
+ sx = SourceRect->left;
+ sx_dec = 0;
+ for (DesX=0; DesX<DesSizeX; DesX++)
+ {
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_1BPP_GetPixel(SourceSurf, sx, sy));
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
+
+ sx += SrcZoomXHight;
+ sx_dec += SrcZoomXLow;
+ if (sx_dec >= sx_max)
+ {
+ sx++;
+ sx_dec -= sx_max;
+ }
}
- }
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
+
+ sy += SrcZoomYHight;
+ sy_dec += SrcZoomYLow;
+ if (sy_dec >= sy_max)
+ {
+ sy++;
+ sy_dec -= sy_max;
+ }
+ }
+ break;
+
+ case BMF_4BPP:
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
+ /* This is a reference implementation, it hasn't been optimized for speed */
+ for (DesY=0; DesY<DesSizeY; DesY++)
+ {
+ sx = SourceRect->left;
+ sx_dec = 0;
+ for (DesX=0; DesX<DesSizeX; DesX++)
+ {
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_4BPP_GetPixel(SourceSurf, sx, sy));
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
+
+ sx += SrcZoomXHight;
+ sx_dec += SrcZoomXLow;
+ if (sx_dec >= sx_max)
+ {
+ sx++;
+ sx_dec -= sx_max;
+ }
+ }
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
+
+ sy += SrcZoomYHight;
+ sy_dec += SrcZoomYLow;
+ if (sy_dec >= sy_max)
+ {
+ sy++;
+ sy_dec -= sy_max;
+ }
+ }
break;
case BMF_8BPP:
@@ -529,56 +592,108 @@
ClipRegion, ColorTranslation, Mode);
break;
- case BMF_16BPP:
+ case BMF_16BPP:
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
-
- for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
- {
- sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) +
SourceRect->top;
-
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) +
SourceRect->left;
- color = DIB_16BPP_GetPixel(SourceSurf, sx, sy);
- DIB_8BPP_PutPixel(DestSurf, DesX, DesY,
XLATEOBJ_iXlate(ColorTranslation, color));
+ for (DesY=0; DesY<DesSizeY; DesY++)
+ {
+ sx = SourceRect->left;
+ sx_dec = 0;
+ for (DesX=0; DesX<DesSizeX; DesX++)
+ {
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_16BPP_GetPixel(SourceSurf, sx, sy));
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
+
+ sx += SrcZoomXHight;
+ sx_dec += SrcZoomXLow;
+ if (sx_dec >= sx_max)
+ {
+ sx++;
+ sx_dec -= sx_max;
+ }
}
- }
- break;
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
+
+ sy += SrcZoomYHight;
+ sy_dec += SrcZoomYLow;
+ if (sy_dec >= sy_max)
+ {
+ sy++;
+ sy_dec -= sy_max;
+ }
+ }
+ break;
case BMF_24BPP:
- /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
- /* This is a reference implementation, it hasn't been optimized for speed */
-
- for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
- {
- sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) +
SourceRect->top;
-
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) +
SourceRect->left;
- color = DIB_24BPP_GetPixel(SourceSurf, sx, sy);
- DIB_8BPP_PutPixel(DestSurf, DesX, DesY,
XLATEOBJ_iXlate(ColorTranslation, color));
+ for (DesY=0; DesY<DesSizeY; DesY++)
+ {
+ sx = SourceRect->left;
+ sx_dec = 0;
+ for (DesX=0; DesX<DesSizeX; DesX++)
+ {
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_24BPP_GetPixel(SourceSurf, sx, sy));
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
+
+ sx += SrcZoomXHight;
+ sx_dec += SrcZoomXLow;
+ if (sx_dec >= sx_max)
+ {
+ sx++;
+ sx_dec -= sx_max;
+ }
}
- }
- break;
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
+
+ sy += SrcZoomYHight;
+ sy_dec += SrcZoomYLow;
+ if (sy_dec >= sy_max)
+ {
+ sy++;
+ sy_dec -= sy_max;
+ }
+ }
+ break;
case BMF_32BPP:
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
-
- for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
- {
- sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) +
SourceRect->top;
-
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) +
SourceRect->left;
- color = DIB_32BPP_GetPixel(SourceSurf, sx, sy);
- DIB_8BPP_PutPixel(DestSurf, DesX, DesY,
XLATEOBJ_iXlate(ColorTranslation, color));
+ for (DesY=0; DesY<DesSizeY; DesY++)
+ {
+ sx = SourceRect->left;
+ sx_dec = 0;
+ for (DesX=0; DesX<DesSizeX; DesX++)
+ {
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_1BPP_GetPixel(SourceSurf, sx, sy));
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
+
+ sx += SrcZoomXHight;
+ sx_dec += SrcZoomXLow;
+ if (sx_dec >= sx_max)
+ {
+ sx++;
+ sx_dec -= sx_max;
+ }
}
- }
- break;
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
+
+ sy += SrcZoomYHight;
+ sy_dec += SrcZoomYLow;
+ if (sy_dec >= sy_max)
+ {
+ sy++;
+ sy_dec -= sy_max;
+ }
+ }
+ break;