14 modified files
reactos/subsys/win32k/dib
diff -u -r1.7 -r1.8
--- dib.c 21 Mar 2004 04:17:33 -0000 1.7
+++ dib.c 6 Apr 2004 17:54:32 -0000 1.8
@@ -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: dib.c,v 1.7 2004/03/21 04:17:33 royce Exp $ */
+/* $Id: dib.c,v 1.8 2004/04/06 17:54:32 weiden Exp $ */
#include <windows.h>
#include <ddk/winddi.h>
@@ -68,6 +68,29 @@
}
ULONG
+DIB_GetOriginalSource(SURFOBJ* SourceSurf, SURFGDI* SourceGDI, ULONG sx, ULONG sy)
+{
+ switch (SourceGDI->BitsPerPixel)
+ {
+ case 1:
+ return DIB_1BPP_GetPixel(SourceSurf, sx, sy);
+ case 4:
+ return DIB_4BPP_GetPixel(SourceSurf, sx, sy);
+ case 8:
+ return DIB_8BPP_GetPixel(SourceSurf, sx, sy);
+ case 16:
+ return DIB_16BPP_GetPixel(SourceSurf, sx, sy);
+ case 24:
+ return DIB_24BPP_GetPixel(SourceSurf, sx, sy);
+ case 32:
+ return DIB_32BPP_GetPixel(SourceSurf, sx, sy);
+ default:
+ DPRINT1("DIB_GetOriginalSource: Unhandled number of bits per pixel in source (%d).\n", SourceGDI->BitsPerPixel);
+ return(0);
+ }
+}
+
+ULONG
DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern)
{
ULONG ResultNibble;
reactos/subsys/win32k/dib
diff -u -r1.17 -r1.18
--- dib.h 21 Mar 2004 04:17:33 -0000 1.17
+++ dib.h 6 Apr 2004 17:54:32 -0000 1.18
@@ -3,6 +3,7 @@
#define MASK1BPP(x) (1<<(7-((x)&7)))
ULONG DIB_DoRop(ULONG Rop, ULONG Dest, ULONG Source, ULONG Pattern);
ULONG DIB_GetSource(SURFOBJ* SourceSurf, SURFGDI* SourceGDI, ULONG sx, ULONG sy, XLATEOBJ* ColorTranslation);
+ULONG DIB_GetOriginalSource(SURFOBJ* SourceSurf, SURFGDI* SourceGDI, ULONG sx, ULONG sy);
VOID DIB_1BPP_PutPixel(SURFOBJ* SurfObj, LONG x, LONG y, ULONG c);
ULONG DIB_1BPP_GetPixel(SURFOBJ* SurfObj, LONG x, LONG y);
@@ -18,6 +19,10 @@
RECTL* DestRect, RECTL *SourceRect,
POINTL* MaskOrigin, POINTL* BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Mode);
+BOOLEAN DIB_1BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
+ PSURFGDI DestGDI, PSURFGDI SourceGDI,
+ RECTL* DestRect, POINTL *SourcePoint,
+ XLATEOBJ *ColorTranslation, ULONG iTransColor);
VOID DIB_4BPP_PutPixel(SURFOBJ* SurfObj, LONG x, LONG y, ULONG c);
ULONG DIB_4BPP_GetPixel(SURFOBJ* SurfObj, LONG x, LONG y);
@@ -33,6 +38,10 @@
RECTL* DestRect, RECTL *SourceRect,
POINTL* MaskOrigin, POINTL* BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Mode);
+BOOLEAN DIB_4BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
+ PSURFGDI DestGDI, PSURFGDI SourceGDI,
+ RECTL* DestRect, POINTL *SourcePoint,
+ XLATEOBJ *ColorTranslation, ULONG iTransColor);
VOID DIB_8BPP_PutPixel(SURFOBJ* SurfObj, LONG x, LONG y, ULONG c);
ULONG DIB_8BPP_GetPixel(SURFOBJ* SurfObj, LONG x, LONG y);
@@ -48,6 +57,10 @@
RECTL* DestRect, RECTL *SourceRect,
POINTL* MaskOrigin, POINTL* BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Mode);
+BOOLEAN DIB_8BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
+ PSURFGDI DestGDI, PSURFGDI SourceGDI,
+ RECTL* DestRect, POINTL *SourcePoint,
+ XLATEOBJ *ColorTranslation, ULONG iTransColor);
VOID DIB_16BPP_PutPixel(SURFOBJ* SurfObj, LONG x, LONG y, ULONG c);
ULONG DIB_16BPP_GetPixel(SURFOBJ* SurfObj, LONG x, LONG y);
@@ -63,6 +76,10 @@
RECTL* DestRect, RECTL *SourceRect,
POINTL* MaskOrigin, POINTL* BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Mode);
+BOOLEAN DIB_16BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
+ PSURFGDI DestGDI, PSURFGDI SourceGDI,
+ RECTL* DestRect, POINTL *SourcePoint,
+ XLATEOBJ *ColorTranslation, ULONG iTransColor);
VOID DIB_24BPP_PutPixel(SURFOBJ* SurfObj, LONG x, LONG y, ULONG c);
ULONG DIB_24BPP_GetPixel(SURFOBJ* SurfObj, LONG x, LONG y);
@@ -78,6 +95,10 @@
RECTL* DestRect, RECTL *SourceRect,
POINTL* MaskOrigin, POINTL* BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Mode);
+BOOLEAN DIB_24BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
+ PSURFGDI DestGDI, PSURFGDI SourceGDI,
+ RECTL* DestRect, POINTL *SourcePoint,
+ XLATEOBJ *ColorTranslation, ULONG iTransColor);
VOID DIB_32BPP_PutPixel(SURFOBJ* SurfObj, LONG x, LONG y, ULONG c);
ULONG DIB_32BPP_GetPixel(SURFOBJ* SurfObj, LONG x, LONG y);
@@ -93,4 +114,8 @@
RECTL* DestRect, RECTL *SourceRect,
POINTL* MaskOrigin, POINTL* BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Mode);
+BOOLEAN DIB_32BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
+ PSURFGDI DestGDI, PSURFGDI SourceGDI,
+ RECTL* DestRect, POINTL *SourcePoint,
+ XLATEOBJ *ColorTranslation, ULONG iTransColor);
reactos/subsys/win32k/dib
diff -u -r1.22 -r1.23
--- dib16bpp.c 5 Apr 2004 21:26:24 -0000 1.22
+++ dib16bpp.c 6 Apr 2004 17:54:32 -0000 1.23
@@ -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: dib16bpp.c,v 1.22 2004/04/05 21:26:24 navaraf Exp $ */
+/* $Id: dib16bpp.c,v 1.23 2004/04/06 17:54:32 weiden Exp $ */
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
@@ -602,4 +602,13 @@
return TRUE;
}
+BOOLEAN
+DIB_16BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
+ PSURFGDI DestGDI, PSURFGDI SourceGDI,
+ RECTL* DestRect, POINTL *SourcePoint,
+ XLATEOBJ *ColorTranslation, ULONG iTransColor)
+{
+ return FALSE;
+}
+
/* EOF */
reactos/subsys/win32k/dib
diff -u -r1.17 -r1.18
--- dib1bpp.c 5 Apr 2004 21:26:24 -0000 1.17
+++ dib1bpp.c 6 Apr 2004 17:54:32 -0000 1.18
@@ -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: dib1bpp.c,v 1.17 2004/04/05 21:26:24 navaraf Exp $ */
+/* $Id: dib1bpp.c,v 1.18 2004/04/06 17:54:32 weiden Exp $ */
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -536,4 +536,13 @@
return FALSE;
}
+BOOLEAN
+DIB_1BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
+ PSURFGDI DestGDI, PSURFGDI SourceGDI,
+ RECTL* DestRect, POINTL *SourcePoint,
+ XLATEOBJ *ColorTranslation, ULONG iTransColor)
+{
+ return FALSE;
+}
+
/* EOF */
reactos/subsys/win32k/dib
diff -u -r1.18 -r1.19
--- dib24bpp.c 5 Apr 2004 21:26:24 -0000 1.18
+++ dib24bpp.c 6 Apr 2004 17:54:32 -0000 1.19
@@ -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: dib24bpp.c,v 1.18 2004/04/05 21:26:24 navaraf Exp $ */
+/* $Id: dib24bpp.c,v 1.19 2004/04/06 17:54:32 weiden Exp $ */
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
@@ -361,4 +361,13 @@
return FALSE;
}
+BOOLEAN
+DIB_24BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
+ PSURFGDI DestGDI, PSURFGDI SourceGDI,
+ RECTL* DestRect, POINTL *SourcePoint,
+ XLATEOBJ *ColorTranslation, ULONG iTransColor)
+{
+ return FALSE;
+}
+
/* EOF */
reactos/subsys/win32k/dib
diff -u -r1.18 -r1.19
--- dib32bpp.c 5 Apr 2004 21:26:24 -0000 1.18
+++ dib32bpp.c 6 Apr 2004 17:54:32 -0000 1.19
@@ -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: dib32bpp.c,v 1.18 2004/04/05 21:26:24 navaraf Exp $ */
+/* $Id: dib32bpp.c,v 1.19 2004/04/06 17:54:32 weiden Exp $ */
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
@@ -304,7 +304,7 @@
{
ULONG X, Y;
ULONG SourceX, SourceY;
- ULONG Dest, Source, Pattern;
+ ULONG Dest, Source, Pattern, wd;
PULONG DestBits;
BOOL UsesSource;
BOOL UsesPattern;
@@ -359,7 +359,8 @@
DestSurf->pvScan0 +
(DestRect->left << 2) +
DestRect->top * DestSurf->lDelta);
-
+ wd = ((DestRect->right - DestRect->left) << 2) - DestSurf->lDelta;
+
for (Y = DestRect->top; Y < DestRect->bottom; Y++)
{
SourceX = SourcePoint->x;
@@ -390,9 +391,7 @@
SourceY++;
DestBits = (PULONG)(
- (ULONG_PTR)DestBits -
- ((DestRect->right - DestRect->left) << 2) +
- DestSurf->lDelta);
+ (ULONG_PTR)DestBits - wd);
}
if (PatternSurface != NULL)
@@ -567,4 +566,45 @@
return TRUE;
}
+BOOLEAN
+DIB_32BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
+ PSURFGDI DestGDI, PSURFGDI SourceGDI,
+ RECTL* DestRect, POINTL *SourcePoint,
+ XLATEOBJ *ColorTranslation, ULONG iTransColor)
+{
+ ULONG X, Y;
+ ULONG SourceX, SourceY, Source, wd;
+ PULONG DestBits;
+
+ SourceY = SourcePoint->y;
+ DestBits = (PULONG)(DestSurf->pvScan0 +
+ (DestRect->left << 2) +
+ DestRect->top * DestSurf->lDelta);
+ wd = ((DestRect->right - DestRect->left) << 2) - DestSurf->lDelta;
+
+ for(Y = DestRect->top; Y < DestRect->bottom; Y++)
+ {
+ SourceX = SourcePoint->x;
+ for(X = DestRect->left; X < DestRect->right; X++, DestBits++, SourceX++)
+ {
+ Source = DIB_GetOriginalSource(SourceSurf, SourceGDI, SourceX, SourceY);
+ if(Source == iTransColor)
+ {
+ /* Skip transparent pixels */
+ continue;
+ }
+
+ if(ColorTranslation)
+ *DestBits = XLATEOBJ_iXlate(ColorTranslation, Source);
+ else
+ *DestBits = Source;
+ }
+
+ SourceY++;
+ DestBits = (PULONG)((ULONG_PTR)DestBits - wd);
+ }
+
+ return TRUE;
+}
+
/* EOF */
reactos/subsys/win32k/dib
diff -u -r1.24 -r1.25
--- dib4bpp.c 5 Apr 2004 21:26:24 -0000 1.24
+++ dib4bpp.c 6 Apr 2004 17:54:32 -0000 1.25
@@ -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.24 2004/04/05 21:26:24 navaraf Exp $ */
+/* $Id: dib4bpp.c,v 1.25 2004/04/06 17:54:32 weiden Exp $ */
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
@@ -413,4 +413,13 @@
return FALSE;
}
+BOOLEAN
+DIB_4BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
+ PSURFGDI DestGDI, PSURFGDI SourceGDI,
+ RECTL* DestRect, POINTL *SourcePoint,
+ XLATEOBJ *ColorTranslation, ULONG iTransColor)
+{
+ return FALSE;
+}
+
/* EOF */
reactos/subsys/win32k/dib
diff -u -r1.17 -r1.18
--- dib8bpp.c 5 Apr 2004 21:26:24 -0000 1.17
+++ dib8bpp.c 6 Apr 2004 17:54:32 -0000 1.18
@@ -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: dib8bpp.c,v 1.17 2004/04/05 21:26:24 navaraf Exp $ */
+/* $Id: dib8bpp.c,v 1.18 2004/04/06 17:54:32 weiden Exp $ */
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
@@ -562,4 +562,13 @@
return TRUE;
}
+BOOLEAN
+DIB_8BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
+ PSURFGDI DestGDI, PSURFGDI SourceGDI,
+ RECTL* DestRect, POINTL *SourcePoint,
+ XLATEOBJ *ColorTranslation, ULONG iTransColor)
+{
+ return FALSE;
+}
+
/* EOF */
reactos/subsys/win32k/eng
diff -u -r1.28 -r1.29
--- objects.h 8 Feb 2004 21:37:52 -0000 1.28
+++ objects.h 6 Apr 2004 17:54:32 -0000 1.29
@@ -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: objects.h,v 1.28 2004/02/08 21:37:52 weiden Exp $
+/* $Id: objects.h,v 1.29 2004/04/06 17:54:32 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -150,20 +150,23 @@
/* Forward declare (circular reference) */
typedef struct _SURFGDI *PSURFGDI;
-typedef VOID (*PFN_DIB_PutPixel)(SURFOBJ *, LONG, LONG, ULONG);
-typedef ULONG (*PFN_DIB_GetPixel)(SURFOBJ *, LONG, LONG);
-typedef VOID (*PFN_DIB_HLine) (SURFOBJ *, LONG, LONG, LONG, ULONG);
-typedef VOID (*PFN_DIB_VLine) (SURFOBJ *, LONG, LONG, LONG, ULONG);
-typedef BOOLEAN (*PFN_DIB_BitBlt) (SURFOBJ * DestSurf, SURFOBJ * SourceSurf,
- PSURFGDI DestGDI, PSURFGDI SourceGDI,
- RECTL * DestRect, POINTL * SourcePoint,
- BRUSHOBJ *BrushObj, POINTL * BrushOrigin,
- XLATEOBJ *ColorTranslation, ULONG Rop4);
-typedef BOOLEAN (*PFN_DIB_StretchBlt) (SURFOBJ * DestSurf, SURFOBJ * SourceSurf,
- PSURFGDI DestGDI, PSURFGDI SourceGDI,
- RECTL * DestRect, RECTL * SourceRect,
- POINTL *MaskOrigin, POINTL * BrushOrigin,
- XLATEOBJ *ColorTranslation, ULONG Mode);
+typedef VOID (*PFN_DIB_PutPixel) (SURFOBJ *, LONG, LONG, ULONG);
+typedef ULONG (*PFN_DIB_GetPixel) (SURFOBJ *, LONG, LONG);
+typedef VOID (*PFN_DIB_HLine) (SURFOBJ *, LONG, LONG, LONG, ULONG);
+typedef VOID (*PFN_DIB_VLine) (SURFOBJ *, LONG, LONG, LONG, ULONG);
+typedef BOOLEAN (*PFN_DIB_BitBlt) (SURFOBJ * DestSurf, SURFOBJ * SourceSurf,
+ PSURFGDI DestGDI, PSURFGDI SourceGDI,
+ RECTL * DestRect, POINTL * SourcePoint,
+ BRUSHOBJ *BrushObj, POINTL * BrushOrigin,
+ XLATEOBJ *ColorTranslation, ULONG Rop4);
+typedef BOOLEAN (*PFN_DIB_StretchBlt) (SURFOBJ * DestSurf, SURFOBJ * SourceSurf,
+ PSURFGDI DestGDI, PSURFGDI SourceGDI,
+ RECTL * DestRect, RECTL * SourceRect,
+ POINTL *MaskOrigin, POINTL * BrushOrigin,
+ XLATEOBJ *ColorTranslation, ULONG Mode);
+typedef BOOLEAN (*PFN_DIB_TransparentBlt) (SURFOBJ *, SURFOBJ *, PSURFGDI, PSURFGDI,
+ RECTL* , POINTL *, XLATEOBJ *,ULONG);
+
typedef struct _SURFGDI {
ENGOBJ Header;
@@ -191,12 +194,13 @@
PFN_GradientFill GradientFill;
/* DIB functions */
- PFN_DIB_PutPixel DIB_PutPixel;
- PFN_DIB_GetPixel DIB_GetPixel;
- PFN_DIB_HLine DIB_HLine;
- PFN_DIB_VLine DIB_VLine;
- PFN_DIB_BitBlt DIB_BitBlt;
- PFN_DIB_StretchBlt DIB_StretchBlt;
+ PFN_DIB_PutPixel DIB_PutPixel;
+ PFN_DIB_GetPixel DIB_GetPixel;
+ PFN_DIB_HLine DIB_HLine;
+ PFN_DIB_VLine DIB_VLine;
+ PFN_DIB_BitBlt DIB_BitBlt;
+ PFN_DIB_StretchBlt DIB_StretchBlt;
+ PFN_DIB_TransparentBlt DIB_TransparentBlt;
/* misc */
ULONG PointerStatus;
reactos/subsys/win32k/eng
diff -u -r1.35 -r1.36
--- surface.c 20 Mar 2004 17:33:10 -0000 1.35
+++ surface.c 6 Apr 2004 17:54:32 -0000 1.36
@@ -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: surface.c,v 1.35 2004/03/20 17:33:10 navaraf Exp $
+/* $Id: surface.c,v 1.36 2004/04/06 17:54:32 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -126,6 +126,14 @@
return FALSE;
}
+static BOOLEAN Dummy_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
+ PSURFGDI DestGDI, PSURFGDI SourceGDI,
+ RECTL* DestRect, POINTL *SourcePoint,
+ XLATEOBJ *ColorTranslation, ULONG iTransColor)
+{
+ return FALSE;
+}
+
#define SURF_METHOD(c,n) DIB_##c##_##n
#define SET_SURFGDI(c)\
@@ -134,7 +142,8 @@
SurfGDI->DIB_HLine=SURF_METHOD(c,HLine);\
SurfGDI->DIB_VLine=SURF_METHOD(c,VLine);\
SurfGDI->DIB_BitBlt=SURF_METHOD(c,BitBlt);\
- SurfGDI->DIB_StretchBlt=SURF_METHOD(c,StretchBlt);
+ SurfGDI->DIB_StretchBlt=SURF_METHOD(c,StretchBlt);\
+ SurfGDI->DIB_TransparentBlt=SURF_METHOD(c,TransparentBlt);
VOID FASTCALL InitializeFuncs(SURFGDI *SurfGDI, ULONG BitmapFormat)
{
@@ -160,12 +169,13 @@
DPRINT1("InitializeFuncs: unsupported DIB format %d\n",
BitmapFormat);
- SurfGDI->DIB_PutPixel = Dummy_PutPixel;
- SurfGDI->DIB_GetPixel = Dummy_GetPixel;
- SurfGDI->DIB_HLine = Dummy_HLine;
- SurfGDI->DIB_VLine = Dummy_VLine;
- SurfGDI->DIB_BitBlt = Dummy_BitBlt;
- SurfGDI->DIB_StretchBlt = Dummy_StretchBlt;
+ SurfGDI->DIB_PutPixel = Dummy_PutPixel;
+ SurfGDI->DIB_GetPixel = Dummy_GetPixel;
+ SurfGDI->DIB_HLine = Dummy_HLine;
+ SurfGDI->DIB_VLine = Dummy_VLine;
+ SurfGDI->DIB_BitBlt = Dummy_BitBlt;
+ SurfGDI->DIB_StretchBlt = Dummy_StretchBlt;
+ SurfGDI->DIB_TransparentBlt = Dummy_TransparentBlt;
break;
}
}
reactos/subsys/win32k/eng
diff -u -r1.13 -r1.14
--- transblt.c 3 Apr 2004 21:25:20 -0000 1.13
+++ transblt.c 6 Apr 2004 17:54:32 -0000 1.14
@@ -16,15 +16,15 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: transblt.c,v 1.13 2004/04/03 21:25:20 weiden Exp $
+/* $Id: transblt.c,v 1.14 2004/04/06 17:54:32 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: GDI TransparentBlt Function
* FILE: subsys/win32k/eng/transblt.c
- * PROGRAMER: Jason Filby
+ * PROGRAMER: Thomas Weidenmueller (w3seek@users.sourceforge.net)
* REVISION HISTORY:
- * 4/6/2001: Created
+ * 4/6/2004: Created
*/
#include <ddk/winddi.h>
@@ -53,22 +53,178 @@
PXLATEOBJ ColorTranslation,
PRECTL DestRect,
PRECTL SourceRect,
- ULONG TransparentColor,
+ ULONG iTransColor,
ULONG Reserved)
{
- DPRINT1("EngTransparentBlt() unimplemented!\n");
- return FALSE;
+ BOOL Ret;
+ BYTE ClippingType;
+ INTENG_ENTER_LEAVE EnterLeaveSource, EnterLeaveDest;
+ SURFOBJ *InputObj, *OutputObj;
+ SURFGDI *InputGDI, *OutputGDI;
+ RECTL OutputRect, InputRect;
+ POINTL Translate, InputPoint;
+
+ InputRect.left = 0;
+ InputRect.right = DestRect->right - DestRect->left;
+ InputRect.top = 0;
+ InputRect.bottom = DestRect->bottom - DestRect->top;
+
+ if(!IntEngEnter(&EnterLeaveSource, Source, &InputRect, TRUE, &Translate, &InputObj))
+ {
+ return FALSE;
+ }
+
+ InputPoint.x = SourceRect->left + Translate.x;
+ InputPoint.y = SourceRect->top + Translate.y;
+
+ InputGDI = (InputObj ? (SURFGDI*)AccessInternalObjectFromUserObject(InputObj) : NULL);
+ ASSERT(InputGDI);
+
+ OutputRect = *DestRect;
+ 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)
+ {
+ InputRect.right -= OutputRect.right - Clip->rclBounds.right;
+ OutputRect.right = Clip->rclBounds.right;
+ }
+ 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)
+ {
+ InputRect.bottom -= OutputRect.bottom - Clip->rclBounds.bottom;
+ OutputRect.bottom = Clip->rclBounds.bottom;
+ }
+ }
+
+ /* Check for degenerate case: if height or width of OutputRect is 0 pixels there's
+ nothing to do */
+ if(OutputRect.right <= OutputRect.left || OutputRect.bottom <= OutputRect.top)
+ {
+ IntEngLeave(&EnterLeaveSource);
+ return TRUE;
+ }
+
+ if(!IntEngEnter(&EnterLeaveDest, Dest, &OutputRect, FALSE, &Translate, &OutputObj))
+ {
+ IntEngLeave(&EnterLeaveSource);
+ return FALSE;
+ }
+
+ OutputRect.left = DestRect->left + Translate.x;
+ OutputRect.right = DestRect->right + Translate.x;
+ OutputRect.top = DestRect->top + Translate.y;
+ OutputRect.bottom = DestRect->bottom + Translate.y;
+
+ OutputGDI = (OutputObj ? (SURFGDI*)AccessInternalObjectFromUserObject(OutputObj) : NULL);
+ ASSERT(OutputGDI);
+
+ ClippingType = (Clip ? Clip->iDComplexity : DC_TRIVIAL);
+
+ switch(ClippingType)
+ {
+ case DC_TRIVIAL:
+ {
+ Ret = OutputGDI->DIB_TransparentBlt(OutputObj, InputObj, OutputGDI, InputGDI, &OutputRect,
+ &InputPoint, ColorTranslation, iTransColor);
+ break;
+ }
+ case DC_RECT:
+ {
+ RECTL ClipRect, CombinedRect;
+ POINTL Pt;
+
+ 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 = OutputGDI->DIB_TransparentBlt(OutputObj, InputObj, OutputGDI, InputGDI, &CombinedRect,
+ &Pt, ColorTranslation, iTransColor);
+ break;
+ }
+ case DC_COMPLEX:
+ {
+ ULONG Direction, i;
+ RECT_ENUM RectEnum;
+ BOOL EnumMore;
+ POINTL Pt;
+
+ if(OutputObj == InputObj)
+ {
+ if(OutputRect.top < InputPoint.y)
+ {
+ Direction = OutputRect.left < (InputPoint.x ? CD_RIGHTDOWN : CD_LEFTDOWN);
+ }
+ else
+ {
+ Direction = OutputRect.left < (InputPoint.x ? CD_RIGHTUP : CD_LEFTUP);
+ }
+ }
+ else
+ {
+ Direction = CD_ANY;
+ }
+
+ CLIPOBJ_cEnumStart(Clip, FALSE, CT_RECTANGLES, Direction, 0);
+ do
+ {
+ EnumMore = CLIPOBJ_bEnum(Clip, sizeof(RectEnum), (PVOID)&RectEnum);
+ for (i = 0; i < RectEnum.c; i++)
+ {
+ RECTL ClipRect, CombinedRect;
+
+ 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 = OutputGDI->DIB_TransparentBlt(OutputObj, InputObj, OutputGDI, InputGDI, &CombinedRect,
+ &Pt, ColorTranslation, iTransColor);
+ if(!Ret)
+ {
+ break;
+ }
+ }
+ } while(EnumMore && Ret);
+ break;
+ }
+ default:
+ {
+ Ret = FALSE;
+ break;
+ }
+ }
+
+ IntEngLeave(&EnterLeaveDest);
+ IntEngLeave(&EnterLeaveSource);
+
+ return Ret;
}
BOOL FASTCALL
-IntTransparentBlt(PSURFOBJ Dest,
- PSURFOBJ Source,
- PCLIPOBJ Clip,
- PXLATEOBJ ColorTranslation,
- PRECTL DestRect,
- PRECTL SourceRect,
- ULONG TransparentColor,
- ULONG Reserved)
+IntEngTransparentBlt(PSURFOBJ Dest,
+ PSURFOBJ Source,
+ PCLIPOBJ Clip,
+ PXLATEOBJ ColorTranslation,
+ PRECTL DestRect,
+ PRECTL SourceRect,
+ ULONG iTransColor,
+ ULONG Reserved)
{
BOOL Ret;
RECTL OutputRect, InputClippedRect;
@@ -115,8 +271,10 @@
if(SurfGDIDest->TransparentBlt)
{
+ IntLockGDIDriver(SurfGDIDest);
Ret = SurfGDIDest->TransparentBlt(Dest, Source, Clip, ColorTranslation, &OutputRect,
- SourceRect, TransparentColor, Reserved);
+ SourceRect, iTransColor, Reserved);
+ IntUnLockGDIDriver(SurfGDIDest);
}
else
Ret = FALSE;
@@ -124,7 +282,7 @@
if(!Ret)
{
Ret = EngTransparentBlt(Dest, Source, Clip, ColorTranslation, &OutputRect,
- SourceRect, TransparentColor, Reserved);
+ SourceRect, iTransColor, Reserved);
}
MouseSafetyOnDrawEnd(Dest, SurfGDIDest);
reactos/subsys/win32k/include
diff -u -r1.10 -r1.11
--- inteng.h 8 Feb 2004 21:37:52 -0000 1.10
+++ inteng.h 6 Apr 2004 17:54:32 -0000 1.11
@@ -67,4 +67,14 @@
CLIPOBJ* STDCALL IntEngCreateClipRegion(ULONG count,
PRECTL pRect,
RECTL rcBounds);
+
+BOOL FASTCALL
+IntEngTransparentBlt(PSURFOBJ Dest,
+ PSURFOBJ Source,
+ PCLIPOBJ Clip,
+ PXLATEOBJ ColorTranslation,
+ PRECTL DestRect,
+ PRECTL SourceRect,
+ ULONG iTransColor,
+ ULONG Reserved);
#endif /* _WIN32K_INTENG_H */
reactos/subsys/win32k/include
diff -u -r1.8 -r1.9
--- intgdi.h 3 Apr 2004 21:25:20 -0000 1.8
+++ intgdi.h 6 Apr 2004 17:54:32 -0000 1.9
@@ -121,17 +121,5 @@
LPXFORM xform1,
LPXFORM xform2);
-/* Bitmap functions */
-
-BOOL FASTCALL
-IntTransparentBlt(PSURFOBJ Dest,
- PSURFOBJ Source,
- PCLIPOBJ Clip,
- PXLATEOBJ ColorTranslation,
- PRECTL DestRect,
- PRECTL SourceRect,
- ULONG TransparentColor,
- ULONG Reserved);
-
#endif /* _WIN32K_INTGDI_H */
reactos/subsys/win32k/objects
diff -u -r1.67 -r1.68
--- bitmaps.c 5 Apr 2004 21:26:25 -0000 1.67
+++ bitmaps.c 6 Apr 2004 17:54:32 -0000 1.68
@@ -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: bitmaps.c,v 1.67 2004/04/05 21:26:25 navaraf Exp $ */
+/* $Id: bitmaps.c,v 1.68 2004/04/06 17:54:32 weiden Exp $ */
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
@@ -307,6 +307,12 @@
DCSrc = DCDest;
}
+ /* Offset positions */
+ xDst += DCDest->w.DCOrgX;
+ yDst += DCDest->w.DCOrgY;
+ xSrc += DCSrc->w.DCOrgX;
+ ySrc += DCSrc->w.DCOrgY;
+
if(DCDest->w.hPalette)
DestPalette = DCDest->w.hPalette;
else
@@ -344,16 +350,15 @@
}
PALETTE_UnlockPalette(SourcePalette);
- if((XlateObj = (PXLATEOBJ)IntEngCreateXlate(PalDestMode, PalSrcMode, DestPalette, SourcePalette)))
+ /* Translate Transparent (RGB) Color to the source palette */
+ if((XlateObj = (PXLATEOBJ)IntEngCreateXlate(PalSrcMode, PAL_RGB, SourcePalette, NULL)))
{
- /* FIXME - is color translation right? */
TransparentColor = XLATEOBJ_iXlate(XlateObj, (ULONG)TransColor);
+ EngDeleteXlate(XlateObj);
}
- else
- {
- /* FIXME - what should be done here? */
- TransparentColor = (ULONG)TransColor;
- }
+
+ /* Create the XLATE object to convert colors between source and destination */
+ XlateObj = (PXLATEOBJ)IntEngCreateXlate(PalDestMode, PalSrcMode, DestPalette, SourcePalette);
SurfDest = (PSURFOBJ)AccessUserObject((ULONG)DCDest->Surface);
ASSERT(SurfDest);
@@ -371,13 +376,12 @@
if((cxDst != cxSrc) || (cyDst != cySrc))
{
- /* FIXME - Create a temporary bitmap and stretchblt it */
- DPRINT1("TransparentBlt() does not support stretching!\n");
+ DPRINT1("TransparentBlt() does not support stretching at the moment!\n");
goto done;
}
- Ret = IntTransparentBlt(SurfDest, SurfSrc, DCDest->CombinedClip, XlateObj, &rcDest, &rcSrc,
- TransparentColor, 0);
+ Ret = IntEngTransparentBlt(SurfDest, SurfSrc, DCDest->CombinedClip, XlateObj, &rcDest, &rcSrc,
+ TransparentColor, 0);
done:
DC_UnlockDc(hdcSrc);
CVSspam 0.2.8