Author: gschneider
Date: Mon Apr 6 03:13:09 2009
New Revision: 40380
URL:
http://svn.reactos.org/svn/reactos?rev=40380&view=rev
Log:
- Evgeny Boltik, <BSTSoft AT narod DOT ru>: Add stretching support to
TransparentBlt
- This should improve themes support & probably show some bitmaps that were hidden
before in certain applications
- See bug #4337 for more information
Modified:
trunk/reactos/subsystems/win32/win32k/dib/dib.c
trunk/reactos/subsystems/win32/win32k/dib/dib.h
trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c
trunk/reactos/subsystems/win32/win32k/dib/dib1bpp.c
trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c
trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c
trunk/reactos/subsystems/win32/win32k/dib/dib4bpp.c
trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c
trunk/reactos/subsystems/win32/win32k/eng/transblt.c
trunk/reactos/subsystems/win32/win32k/objects/bitblt.c
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib.c [iso-8859-1] Mon Apr 6 03:13:09 2009
@@ -235,7 +235,7 @@
}
BOOLEAN Dummy_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
- RECTL* DestRect, POINTL *SourcePoint,
+ RECTL* DestRect, RECTL *SourceRect,
XLATEOBJ *ColorTranslation, ULONG iTransColor)
{
return FALSE;
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib.h [iso-8859-1] Mon Apr 6 03:13:09 2009
@@ -42,7 +42,7 @@
typedef VOID (*PFN_DIB_VLine)(SURFOBJ*,LONG,LONG,LONG,ULONG);
typedef BOOLEAN (*PFN_DIB_BitBlt)(PBLTINFO);
typedef BOOLEAN
(*PFN_DIB_StretchBlt)(SURFOBJ*,SURFOBJ*,SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,BRUSHOBJ*,POINTL*,XLATEOBJ*,XLATEOBJ*,ROP4);
-typedef BOOLEAN
(*PFN_DIB_TransparentBlt)(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
+typedef BOOLEAN
(*PFN_DIB_TransparentBlt)(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
typedef BOOLEAN (*PFN_DIB_ColorFill)(SURFOBJ*, RECTL*, ULONG);
typedef BOOLEAN (*PFN_DIB_AlphaBlend)(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*,
XLATEOBJ*, BLENDOBJ*);
@@ -68,7 +68,7 @@
VOID Dummy_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
BOOLEAN Dummy_BitBlt(PBLTINFO);
BOOLEAN
Dummy_StretchBlt(SURFOBJ*,SURFOBJ*,SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,BRUSHOBJ*,POINTL*,XLATEOBJ*,XLATEOBJ*,ROP4);
-BOOLEAN Dummy_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
+BOOLEAN Dummy_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
BOOLEAN Dummy_ColorFill(SURFOBJ*, RECTL*, ULONG);
BOOLEAN Dummy_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*,
BLENDOBJ*);
@@ -78,7 +78,7 @@
VOID DIB_1BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
BOOLEAN DIB_1BPP_BitBlt(PBLTINFO);
BOOLEAN DIB_1BPP_BitBltSrcCopy(PBLTINFO);
-BOOLEAN DIB_1BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
+BOOLEAN DIB_1BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
BOOLEAN DIB_1BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
BOOLEAN DIB_1BPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*,
BLENDOBJ*);
@@ -88,7 +88,7 @@
VOID DIB_4BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
BOOLEAN DIB_4BPP_BitBlt(PBLTINFO);
BOOLEAN DIB_4BPP_BitBltSrcCopy(PBLTINFO);
-BOOLEAN DIB_4BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
+BOOLEAN DIB_4BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
BOOLEAN DIB_4BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
BOOLEAN DIB_4BPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*,
BLENDOBJ*);
@@ -98,7 +98,7 @@
VOID DIB_8BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
BOOLEAN DIB_8BPP_BitBlt(PBLTINFO);
BOOLEAN DIB_8BPP_BitBltSrcCopy(PBLTINFO);
-BOOLEAN DIB_8BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
+BOOLEAN DIB_8BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
BOOLEAN DIB_8BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
BOOLEAN DIB_8BPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*,
BLENDOBJ*);
@@ -108,7 +108,7 @@
VOID DIB_16BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
BOOLEAN DIB_16BPP_BitBlt(PBLTINFO);
BOOLEAN DIB_16BPP_BitBltSrcCopy(PBLTINFO);
-BOOLEAN DIB_16BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
+BOOLEAN DIB_16BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
BOOLEAN DIB_16BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
BOOLEAN DIB_16BPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*,
BLENDOBJ*);
@@ -118,7 +118,7 @@
VOID DIB_24BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
BOOLEAN DIB_24BPP_BitBlt(PBLTINFO);
BOOLEAN DIB_24BPP_BitBltSrcCopy(PBLTINFO);
-BOOLEAN DIB_24BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
+BOOLEAN DIB_24BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
BOOLEAN DIB_24BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
BOOLEAN DIB_24BPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*,
BLENDOBJ*);
@@ -128,7 +128,7 @@
VOID DIB_32BPP_VLine(SURFOBJ*,LONG,LONG,LONG,ULONG);
BOOLEAN DIB_32BPP_BitBlt(PBLTINFO);
BOOLEAN DIB_32BPP_BitBltSrcCopy(PBLTINFO);
-BOOLEAN DIB_32BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
+BOOLEAN DIB_32BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,XLATEOBJ*,ULONG);
BOOLEAN DIB_32BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
BOOLEAN DIB_32BPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*,
BLENDOBJ*);
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 [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c [iso-8859-1] Mon Apr 6 03:13:09
2009
@@ -455,14 +455,23 @@
BOOLEAN
DIB_16BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
- RECTL* DestRect, POINTL *SourcePoint,
+ RECTL* DestRect, RECTL *SourceRect,
XLATEOBJ *ColorTranslation, ULONG iTransColor)
{
- ULONG RoundedRight, X, Y, SourceX, SourceY, Source, wd, Dest;
+ ULONG RoundedRight, X, Y, SourceX = 0, SourceY = 0, Source, wd, Dest;
ULONG *DestBits;
+ LONG DstHeight;
+ LONG DstWidth;
+ LONG SrcHeight;
+ LONG SrcWidth;
+
+ DstHeight = DestRect->bottom - DestRect->top;
+ DstWidth = DestRect->right - DestRect->left;
+ SrcHeight = SourceRect->bottom - SourceRect->top;
+ SrcWidth = SourceRect->right - SourceRect->left;
+
RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) &
0x1);
- SourceY = SourcePoint->y;
DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 +
(DestRect->left << 1) +
DestRect->top * DestSurf->lDelta);
@@ -470,41 +479,55 @@
for(Y = DestRect->top; Y < DestRect->bottom; Y++)
{
- SourceX = SourcePoint->x;
+ SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
for(X = DestRect->left; X < RoundedRight; X += 2, DestBits++, SourceX +=
2)
{
Dest = *DestBits;
- Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
-
- if(Source != iTransColor)
- {
- Dest &= 0xFFFF0000;
- Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFFFF);
- }
-
- Source = DIB_GetSourceIndex(SourceSurf, SourceX + 1, SourceY);
- if(Source != iTransColor)
- {
- Dest &= 0xFFFF;
- Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) << 16);
- }
-
- *DestBits = Dest;
- }
-
- if(X < DestRect->right)
+
+ SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
+ if (SourceX >= 0 && SourceY >= 0 &&
+ SourceSurf->sizlBitmap.cx > SourceX &&
SourceSurf->sizlBitmap.cy > SourceY)
{
Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
if(Source != iTransColor)
{
- *((USHORT*)DestBits) = (USHORT)XLATEOBJ_iXlate(ColorTranslation,
+ Dest &= 0xFFFF0000;
+ Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFFFF);
+ }
+ }
+
+ SourceX = SourceRect->left+(X+1 - DestRect->left) * SrcWidth /
DstWidth;
+ if (SourceX >= 0 && SourceY >= 0 &&
+ SourceSurf->sizlBitmap.cx > SourceX &&
SourceSurf->sizlBitmap.cy > SourceY)
+ {
+ Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
+ if(Source != iTransColor)
+ {
+ Dest &= 0xFFFF;
+ Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) << 16);
+ }
+ }
+
+ *DestBits = Dest;
+ }
+
+ if(X < DestRect->right)
+ {
+ SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth /
DstWidth;
+ if (SourceX >= 0 && SourceY >= 0 &&
+ SourceSurf->sizlBitmap.cx > SourceX &&
SourceSurf->sizlBitmap.cy > SourceY)
+ {
+ Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
+ if(Source != iTransColor)
+ {
+ *((USHORT*)DestBits) = (USHORT)XLATEOBJ_iXlate(ColorTranslation,
Source);
+ }
}
DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
}
- SourceY++;
DestBits = (ULONG*)((ULONG_PTR)DestBits + wd);
}
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib1bpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib1bpp.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib1bpp.c [iso-8859-1] Mon Apr 6 03:13:09
2009
@@ -481,7 +481,7 @@
BOOLEAN
DIB_1BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
- RECTL* DestRect, POINTL *SourcePoint,
+ RECTL* DestRect, RECTL *SourceRect,
XLATEOBJ *ColorTranslation, ULONG iTransColor)
{
return FALSE;
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c [iso-8859-1] Mon Apr 6 03:13:09
2009
@@ -406,13 +406,22 @@
BOOLEAN
DIB_24BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
- RECTL* DestRect, POINTL *SourcePoint,
+ RECTL* DestRect, RECTL *SourceRect,
XLATEOBJ *ColorTranslation, ULONG iTransColor)
{
- ULONG X, Y, SourceX, SourceY, Source, wd, Dest;
+ ULONG X, Y, SourceX, SourceY = 0, Source = 0, wd, Dest;
BYTE *DestBits;
- SourceY = SourcePoint->y;
+ LONG DstHeight;
+ LONG DstWidth;
+ LONG SrcHeight;
+ LONG SrcWidth;
+
+ DstHeight = DestRect->bottom - DestRect->top;
+ DstWidth = DestRect->right - DestRect->left;
+ SrcHeight = SourceRect->bottom - SourceRect->top;
+ SrcWidth = SourceRect->right - SourceRect->left;
+
DestBits = (BYTE*)((PBYTE)DestSurf->pvScan0 +
(DestRect->left * 3) +
DestRect->top * DestSurf->lDelta);
@@ -420,19 +429,23 @@
for(Y = DestRect->top; Y < DestRect->bottom; Y++)
{
- SourceX = SourcePoint->x;
- for(X = DestRect->left; X < DestRect->right; X++, DestBits += 3, SourceX++)
+ SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
+ for(X = DestRect->left; X < DestRect->right; X++, DestBits += 3)
{
- Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
- if(Source != iTransColor)
- {
- Dest = XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFFFFFF;
- *(PUSHORT)(DestBits) = Dest & 0xFFFF;
- *(DestBits + 2) = Dest >> 16;
+ SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
+ if (SourceX >= 0 && SourceY >= 0 &&
+ SourceSurf->sizlBitmap.cx > SourceX &&
SourceSurf->sizlBitmap.cy > SourceY)
+ {
+ Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
+ if(Source != iTransColor)
+ {
+ Dest = XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFFFFFF;
+ *(PUSHORT)(DestBits) = Dest & 0xFFFF;
+ *(DestBits + 2) = Dest >> 16;
+ }
}
}
- SourceY++;
DestBits = (BYTE*)((ULONG_PTR)DestBits + wd);
}
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 [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c [iso-8859-1] Mon Apr 6 03:13:09
2009
@@ -279,13 +279,22 @@
BOOLEAN
DIB_32BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
- RECTL* DestRect, POINTL *SourcePoint,
+ RECTL* DestRect, RECTL *SourceRect,
XLATEOBJ *ColorTranslation, ULONG iTransColor)
{
- ULONG X, Y, SourceX, SourceY, Source, wd;
+ ULONG X, Y, SourceX, SourceY = 0, Source = 0, wd;
ULONG *DestBits;
- SourceY = SourcePoint->y;
+ LONG DstHeight;
+ LONG DstWidth;
+ LONG SrcHeight;
+ LONG SrcWidth;
+
+ DstHeight = DestRect->bottom - DestRect->top;
+ DstWidth = DestRect->right - DestRect->left;
+ SrcHeight = SourceRect->bottom - SourceRect->top;
+ SrcWidth = SourceRect->right - SourceRect->left;
+
DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 +
(DestRect->left << 2) +
DestRect->top * DestSurf->lDelta);
@@ -293,17 +302,21 @@
for(Y = DestRect->top; Y < DestRect->bottom; Y++)
{
- SourceX = SourcePoint->x;
- for(X = DestRect->left; X < DestRect->right; X++, DestBits++, SourceX++)
+ SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
+ for(X = DestRect->left; X < DestRect->right; X++, DestBits++)
{
- Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
- if(Source != iTransColor)
- {
- *DestBits = XLATEOBJ_iXlate(ColorTranslation, Source);
+ SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
+ 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);
+ }
}
}
- SourceY++;
DestBits = (ULONG*)((ULONG_PTR)DestBits + wd);
}
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib4bpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib4bpp.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib4bpp.c [iso-8859-1] Mon Apr 6 03:13:09
2009
@@ -377,7 +377,7 @@
BOOLEAN
DIB_4BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
- RECTL* DestRect, POINTL *SourcePoint,
+ RECTL* DestRect, RECTL *SourceRect,
XLATEOBJ *ColorTranslation, ULONG iTransColor)
{
return FALSE;
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 [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c [iso-8859-1] Mon Apr 6 03:13:09
2009
@@ -268,14 +268,23 @@
BOOLEAN
DIB_8BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
- RECTL* DestRect, POINTL *SourcePoint,
+ RECTL* DestRect, RECTL *SourceRect,
XLATEOBJ *ColorTranslation, ULONG iTransColor)
{
- ULONG RoundedRight, X, Y, SourceX, SourceY, Source, wd, Dest;
+ ULONG RoundedRight, X, Y, SourceX = 0, SourceY = 0, Source, wd, Dest;
ULONG *DestBits;
+ LONG DstHeight;
+ LONG DstWidth;
+ LONG SrcHeight;
+ LONG SrcWidth;
+
+ DstHeight = DestRect->bottom - DestRect->top;
+ DstWidth = DestRect->right - DestRect->left;
+ SrcHeight = SourceRect->bottom - SourceRect->top;
+ SrcWidth = SourceRect->right - SourceRect->left;
+
RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) &
0x3);
- SourceY = SourcePoint->y;
DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 + DestRect->left +
(DestRect->top * DestSurf->lDelta));
wd = DestSurf->lDelta - (DestRect->right - DestRect->left);
@@ -284,37 +293,57 @@
{
DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 + DestRect->left +
(Y * DestSurf->lDelta));
- SourceX = SourcePoint->x;
+ SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
for (X = DestRect->left; X < RoundedRight; X += 4, DestBits++)
{
Dest = *DestBits;
- Source = DIB_GetSourceIndex(SourceSurf, SourceX++, SourceY);
- if(Source != iTransColor)
- {
- Dest &= 0xFFFFFF00;
- Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFF);
- }
-
- Source = DIB_GetSourceIndex(SourceSurf, SourceX++, SourceY);
- if(Source != iTransColor)
- {
- Dest &= 0xFFFF00FF;
- Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 8) & 0xFF00);
- }
-
- Source = DIB_GetSourceIndex(SourceSurf, SourceX++, SourceY);
- if(Source != iTransColor)
- {
- Dest &= 0xFF00FFFF;
- Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 16) &
0xFF0000);
- }
-
- Source = DIB_GetSourceIndex(SourceSurf, SourceX++, SourceY);
- if(Source != iTransColor)
- {
- Dest &= 0x00FFFFFF;
- Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 24) &
0xFF000000);
+ SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
+ if (SourceX >= 0 && SourceY >= 0 &&
+ SourceSurf->sizlBitmap.cx > SourceX &&
SourceSurf->sizlBitmap.cy > SourceY)
+ {
+ Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
+ if(Source != iTransColor)
+ {
+ Dest &= 0xFFFFFF00;
+ Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFF);
+ }
+ }
+
+ SourceX = SourceRect->left+(X+1 - DestRect->left) * SrcWidth / DstWidth;
+ if (SourceX >= 0 && SourceY >= 0 &&
+ SourceSurf->sizlBitmap.cx > SourceX &&
SourceSurf->sizlBitmap.cy > SourceY)
+ {
+ Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
+ if(Source != iTransColor)
+ {
+ Dest &= 0xFFFF00FF;
+ Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 8) & 0xFF00);
+ }
+ }
+
+ SourceX = SourceRect->left+(X+2 - DestRect->left) * SrcWidth / DstWidth;
+ if (SourceX >= 0 && SourceY >= 0 &&
+ SourceSurf->sizlBitmap.cx > SourceX &&
SourceSurf->sizlBitmap.cy > SourceY)
+ {
+ Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
+ if(Source != iTransColor)
+ {
+ Dest &= 0xFF00FFFF;
+ Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 16) &
0xFF0000);
+ }
+ }
+
+ SourceX = SourceRect->left+(X+3 - DestRect->left) * SrcWidth / DstWidth;
+ if (SourceX >= 0 && SourceY >= 0 &&
+ SourceSurf->sizlBitmap.cx > SourceX &&
SourceSurf->sizlBitmap.cy > SourceY)
+ {
+ Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
+ if(Source != iTransColor)
+ {
+ Dest &= 0x00FFFFFF;
+ Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 24) &
0xFF000000);
+ }
}
*DestBits = Dest;
@@ -324,15 +353,19 @@
{
for (; X < DestRect->right; X++)
{
- Source = DIB_GetSourceIndex(SourceSurf, SourceX++, SourceY);
- if(Source != iTransColor)
- {
- *((BYTE*)DestBits) = (BYTE)(XLATEOBJ_iXlate(ColorTranslation, Source) &
0xFF);
+ SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
+ if (SourceX >= 0 && SourceY >= 0 &&
+ SourceSurf->sizlBitmap.cx > SourceX &&
SourceSurf->sizlBitmap.cy > SourceY)
+ {
+ Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
+ if(Source != iTransColor)
+ {
+ *((BYTE*)DestBits) = (BYTE)(XLATEOBJ_iXlate(ColorTranslation, Source) &
0xFF);
+ }
}
DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
}
}
- SourceY++;
}
return TRUE;
Modified: trunk/reactos/subsystems/win32/win32k/eng/transblt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/transblt.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/transblt.c [iso-8859-1] Mon Apr 6 03:13:09
2009
@@ -47,28 +47,41 @@
INTENG_ENTER_LEAVE EnterLeaveSource, EnterLeaveDest;
SURFOBJ *InputObj, *OutputObj;
RECTL OutputRect, InputRect;
- POINTL Translate, InputPoint;
-
- InputRect.left = 0;
- InputRect.right = DestRect->right - DestRect->left;
- InputRect.top = 0;
- InputRect.bottom = DestRect->bottom - DestRect->top;
+ POINTL Translate;
+
+ LONG DstHeight;
+ LONG DstWidth;
+ LONG SrcHeight;
+ LONG SrcWidth;
+
+ InputRect = *SourceRect;
if(!IntEngEnter(&EnterLeaveSource, psoSource, &InputRect, TRUE, &Translate,
&InputObj))
{
return FALSE;
}
-
- InputPoint.x = SourceRect->left + Translate.x;
- InputPoint.y = SourceRect->top + Translate.y;
+ InputRect.left += Translate.x;
+ InputRect.right += Translate.x;
+ InputRect.top += Translate.y;
+ InputRect.bottom += Translate.y;
OutputRect = *DestRect;
+ if (OutputRect.right < OutputRect.left)
+ {
+ OutputRect.left = DestRect->right;
+ OutputRect.right = DestRect->left;
+ }
+ if (OutputRect.bottom < OutputRect.top)
+ {
+ OutputRect.top = DestRect->bottom;
+ OutputRect.bottom = DestRect->top;
+ }
+
if(Clip)
{
if(OutputRect.left < Clip->rclBounds.left)
{
InputRect.left += Clip->rclBounds.left - OutputRect.left;
- InputPoint.x += Clip->rclBounds.left - OutputRect.left;
OutputRect.left = Clip->rclBounds.left;
}
if(Clip->rclBounds.right < OutputRect.right)
@@ -79,7 +92,6 @@
if(OutputRect.top < Clip->rclBounds.top)
{
InputRect.top += Clip->rclBounds.top - OutputRect.top;
- InputPoint.y += Clip->rclBounds.top - OutputRect.top;
OutputRect.top = Clip->rclBounds.top;
}
if(Clip->rclBounds.bottom < OutputRect.bottom)
@@ -110,28 +122,36 @@
ClippingType = (Clip ? Clip->iDComplexity : DC_TRIVIAL);
+ DstHeight = OutputRect.bottom - OutputRect.top;
+ DstWidth = OutputRect.right - OutputRect.left;
+ SrcHeight = InputRect.bottom - InputRect.top;
+ SrcWidth = InputRect.right - InputRect.left;
switch(ClippingType)
{
case DC_TRIVIAL:
{
Ret = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_TransparentBlt(
- OutputObj, InputObj, &OutputRect, &InputPoint, ColorTranslation,
iTransColor);
+ OutputObj, InputObj, &OutputRect, &InputRect, ColorTranslation,
iTransColor);
break;
}
case DC_RECT:
{
RECTL ClipRect, CombinedRect;
- POINTL Pt;
+ RECTL InputToCombinedRect;
ClipRect.left = Clip->rclBounds.left + Translate.x;
ClipRect.right = Clip->rclBounds.right + Translate.x;
ClipRect.top = Clip->rclBounds.top + Translate.y;
ClipRect.bottom = Clip->rclBounds.bottom + Translate.y;
- EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect);
- Pt.x = InputPoint.x + CombinedRect.left - OutputRect.left;
- Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top;
- Ret = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_TransparentBlt(
- OutputObj, InputObj, &CombinedRect, &Pt, ColorTranslation, iTransColor);
+ if (EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
+ {
+ InputToCombinedRect.top = InputRect.top + (CombinedRect.top - OutputRect.top) *
SrcHeight / DstHeight;
+ InputToCombinedRect.bottom = InputRect.top + (CombinedRect.bottom -
OutputRect.top) * SrcHeight / DstHeight;
+ InputToCombinedRect.left = InputRect.left + (CombinedRect.left - OutputRect.left)
* SrcWidth / DstWidth;
+ InputToCombinedRect.right = InputRect.left + (CombinedRect.right -
OutputRect.left) * SrcWidth / DstWidth;
+ Ret = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_TransparentBlt(
+ OutputObj, InputObj, &CombinedRect, &InputToCombinedRect,
ColorTranslation, iTransColor);
+ }
break;
}
case DC_COMPLEX:
@@ -139,17 +159,16 @@
ULONG Direction, i;
RECT_ENUM RectEnum;
BOOL EnumMore;
- POINTL Pt;
if(OutputObj == InputObj)
{
- if(OutputRect.top < InputPoint.y)
+ if(OutputRect.top < InputRect.top)
{
- Direction = OutputRect.left < (InputPoint.x ? CD_RIGHTDOWN : CD_LEFTDOWN);
+ Direction = OutputRect.left < (InputRect.left ? CD_RIGHTDOWN :
CD_LEFTDOWN);
}
else
{
- Direction = OutputRect.left < (InputPoint.x ? CD_RIGHTUP : CD_LEFTUP);
+ Direction = OutputRect.left < (InputRect.left ? CD_RIGHTUP : CD_LEFTUP);
}
}
else
@@ -164,19 +183,25 @@
for (i = 0; i < RectEnum.c; i++)
{
RECTL ClipRect, CombinedRect;
+ RECTL InputToCombinedRect;
ClipRect.left = RectEnum.arcl[i].left + Translate.x;
ClipRect.right = RectEnum.arcl[i].right + Translate.x;
ClipRect.top = RectEnum.arcl[i].top + Translate.y;
ClipRect.bottom = RectEnum.arcl[i].bottom + Translate.y;
- EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect);
- Pt.x = InputPoint.x + CombinedRect.left - OutputRect.left;
- Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top;
- Ret =
DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_TransparentBlt(
- OutputObj, InputObj, &CombinedRect, &Pt, ColorTranslation,
iTransColor);
- if(!Ret)
+ if (EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
{
- break;
+ InputToCombinedRect.top = InputRect.top + (CombinedRect.top - OutputRect.top)
* SrcHeight / DstHeight;
+ InputToCombinedRect.bottom = InputRect.top + (CombinedRect.bottom -
OutputRect.top) * SrcHeight / DstHeight;
+ InputToCombinedRect.left = InputRect.left + (CombinedRect.left -
OutputRect.left) * SrcWidth / DstWidth;
+ InputToCombinedRect.right = InputRect.left + (CombinedRect.right -
OutputRect.left) * SrcWidth / DstWidth;
+
+ Ret =
DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_TransparentBlt(
+ OutputObj, InputObj, &CombinedRect, &InputToCombinedRect,
ColorTranslation, iTransColor);
+ if(!Ret)
+ {
+ break;
+ }
}
}
} while(EnumMore && Ret);
@@ -209,6 +234,8 @@
RECTL OutputRect, InputClippedRect;
SURFACE *psurfDest;
SURFACE *psurfSource;
+ RECTL InputRect;
+ LONG InputClWidth, InputClHeight, InputWidth, InputHeight;
ASSERT(psoDest);
ASSERT(psoSource);
@@ -232,6 +259,7 @@
InputClippedRect.bottom = DestRect->top;
}
+ InputRect = *SourceRect;
/* Clip against the bounds of the clipping region so we won't try to write
* outside the surface */
if(Clip)
@@ -240,21 +268,27 @@
{
return TRUE;
}
- SourceRect->left += OutputRect.left - DestRect->left;
- SourceRect->top += OutputRect.top - DestRect->top;
- SourceRect->right += OutputRect.left - DestRect->left;
- SourceRect->bottom += OutputRect.top - DestRect->top;
+ /* Update source rect */
+ InputClWidth = InputClippedRect.right - InputClippedRect.left;
+ InputClHeight = InputClippedRect.bottom - InputClippedRect.top;
+ InputWidth = InputRect.right - InputRect.left;
+ InputHeight = InputRect.bottom - InputRect.top;
+
+ InputRect.left += (InputWidth * (OutputRect.left - InputClippedRect.left)) /
InputClWidth;
+ InputRect.right -= (InputWidth * (InputClippedRect.right - OutputRect.right)) /
InputClWidth;
+ InputRect.top += (InputHeight * (OutputRect.top - InputClippedRect.top)) /
InputClHeight;
+ InputRect.bottom -= (InputHeight * (InputClippedRect.bottom - OutputRect.bottom)) /
InputClHeight;
}
else
{
- OutputRect = *DestRect;
+ OutputRect = InputClippedRect;
}
if(psoSource != psoDest)
{
SURFACE_LockBitmapBits(psurfSource);
- MouseSafetyOnDrawStart(psoSource, SourceRect->left, SourceRect->top,
- SourceRect->right, SourceRect->bottom);
+ MouseSafetyOnDrawStart(psoSource, InputRect.left, InputRect.top,
+ InputRect.right, InputRect.bottom);
}
SURFACE_LockBitmapBits(psurfDest);
MouseSafetyOnDrawStart(psoDest, OutputRect.left, OutputRect.top,
@@ -264,7 +298,7 @@
{
Ret = GDIDEVFUNCS(psoDest).TransparentBlt(
psoDest, psoSource, Clip, ColorTranslation, &OutputRect,
- SourceRect, iTransColor, Reserved);
+ &InputRect, iTransColor, Reserved);
}
else
Ret = FALSE;
@@ -272,7 +306,7 @@
if(!Ret)
{
Ret = EngTransparentBlt(psoDest, psoSource, Clip, ColorTranslation,
- &OutputRect, SourceRect, iTransColor, Reserved);
+ &OutputRect, &InputRect, iTransColor, Reserved);
}
MouseSafetyOnDrawEnd(psoDest);
Modified: trunk/reactos/subsystems/win32/win32k/objects/bitblt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1] Mon Apr 6
03:13:09 2009
@@ -455,12 +455,6 @@
rcSrc.right = rcSrc.left + cxSrc;
rcSrc.bottom = rcSrc.top + cySrc;
IntLPtoDP(DCSrc, (LPPOINT)&rcSrc, 2);
-
- if((cxDst != cxSrc) || (cyDst != cySrc))
- {
- DPRINT1("TransparentBlt() does not support stretching at the
moment!\n");
- goto done;
- }
Ret = IntEngTransparentBlt(&BitmapDest->SurfObj, &BitmapSrc->SurfObj,
DCDest->rosdc.CombinedClip, XlateObj, &rcDest, &rcSrc,