diff --git a/reactos/subsys/win32k/dib/dib16bpp.c b/reactos/subsys/win32k/dib/dib16bpp.c index 60849250f4c..c5503d55de0 100644 --- a/reactos/subsys/win32k/dib/dib16bpp.c +++ b/reactos/subsys/win32k/dib/dib16bpp.c @@ -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.24 2004/04/06 21:53:48 weiden Exp $ */ +/* $Id: dib16bpp.c,v 1.25 2004/04/06 23:05:36 weiden Exp $ */ #undef WIN32_LEAN_AND_MEAN #include #include @@ -607,8 +607,7 @@ DIB_16BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, RECTL* DestRect, POINTL *SourcePoint, XLATEOBJ *ColorTranslation, ULONG iTransColor) { - ULONG X, Y, SourceX, SourceY, Source, wd, Dest; - LONG RoundedRight; + ULONG RoundedRight, X, Y, SourceX, SourceY, Source, wd, Dest; ULONG *DestBits; RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x1); @@ -616,7 +615,7 @@ DIB_16BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, DestBits = (ULONG*)(DestSurf->pvScan0 + (DestRect->left << 1) + DestRect->top * DestSurf->lDelta); - wd = ((DestRect->right - DestRect->left) << 1) - DestSurf->lDelta; + wd = DestSurf->lDelta - ((DestRect->right - DestRect->left) << 1); for(Y = DestRect->top; Y < DestRect->bottom; Y++) { @@ -653,7 +652,7 @@ DIB_16BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, DestBits = (PULONG)((ULONG_PTR)DestBits + 2); } SourceY++; - DestBits = (ULONG*)((ULONG_PTR)DestBits - wd); + DestBits = (ULONG*)((ULONG_PTR)DestBits + wd); } return TRUE; diff --git a/reactos/subsys/win32k/dib/dib24bpp.c b/reactos/subsys/win32k/dib/dib24bpp.c index e696ad73ed8..8bcc084ee60 100644 --- a/reactos/subsys/win32k/dib/dib24bpp.c +++ b/reactos/subsys/win32k/dib/dib24bpp.c @@ -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.20 2004/04/06 21:53:48 weiden Exp $ */ +/* $Id: dib24bpp.c,v 1.21 2004/04/06 23:05:36 weiden Exp $ */ #undef WIN32_LEAN_AND_MEAN #include #include @@ -374,7 +374,7 @@ DIB_24BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, DestBits = (BYTE*)(DestSurf->pvScan0 + (DestRect->left << 2) + DestRect->top * DestSurf->lDelta); - wd = ((DestRect->right - DestRect->left) << 2) - DestSurf->lDelta; + wd = DestSurf->lDelta - ((DestRect->right - DestRect->left) << 2); for(Y = DestRect->top; Y < DestRect->bottom; Y++) { @@ -391,7 +391,7 @@ DIB_24BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, } SourceY++; - DestBits = (BYTE*)((ULONG_PTR)DestBits - wd); + DestBits = (BYTE*)((ULONG_PTR)DestBits + wd); } return TRUE; diff --git a/reactos/subsys/win32k/dib/dib32bpp.c b/reactos/subsys/win32k/dib/dib32bpp.c index 4206bed8df8..fa9fbbc79c1 100644 --- a/reactos/subsys/win32k/dib/dib32bpp.c +++ b/reactos/subsys/win32k/dib/dib32bpp.c @@ -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.20 2004/04/06 21:53:48 weiden Exp $ */ +/* $Id: dib32bpp.c,v 1.21 2004/04/06 23:05:36 weiden Exp $ */ #undef WIN32_LEAN_AND_MEAN #include #include @@ -579,7 +579,7 @@ DIB_32BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, DestBits = (ULONG*)(DestSurf->pvScan0 + (DestRect->left << 2) + DestRect->top * DestSurf->lDelta); - wd = ((DestRect->right - DestRect->left) << 2) - DestSurf->lDelta; + wd = DestSurf->lDelta - ((DestRect->right - DestRect->left) << 2); for(Y = DestRect->top; Y < DestRect->bottom; Y++) { @@ -594,7 +594,7 @@ DIB_32BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, } SourceY++; - DestBits = (ULONG*)((ULONG_PTR)DestBits - wd); + DestBits = (ULONG*)((ULONG_PTR)DestBits + wd); } return TRUE; diff --git a/reactos/subsys/win32k/dib/dib8bpp.c b/reactos/subsys/win32k/dib/dib8bpp.c index 93d73aa5321..d498c6c22c2 100644 --- a/reactos/subsys/win32k/dib/dib8bpp.c +++ b/reactos/subsys/win32k/dib/dib8bpp.c @@ -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.18 2004/04/06 17:54:32 weiden Exp $ */ +/* $Id: dib8bpp.c,v 1.19 2004/04/06 23:05:36 weiden Exp $ */ #undef WIN32_LEAN_AND_MEAN #include #include @@ -568,7 +568,71 @@ DIB_8BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, RECTL* DestRect, POINTL *SourcePoint, XLATEOBJ *ColorTranslation, ULONG iTransColor) { - return FALSE; + ULONG RoundedRight, X, Y, SourceX, SourceY, Source, wd, Dest; + ULONG *DestBits; + + RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x3); + SourceY = SourcePoint->y; + DestBits = (ULONG*)(DestSurf->pvScan0 + DestRect->left + + (DestRect->top * DestSurf->lDelta)); + wd = DestSurf->lDelta - (DestRect->right - DestRect->left); + + for(Y = DestRect->top; Y < DestRect->bottom; Y++) + { + DestBits = (ULONG*)(DestSurf->pvScan0 + DestRect->left + + (Y * DestSurf->lDelta)); + SourceX = SourcePoint->x; + for (X = DestRect->left; X < RoundedRight; X += 4, DestBits++) + { + Dest = *DestBits; + + Source = DIB_GetSourceIndex(SourceSurf, SourceGDI, SourceX++, SourceY); + if(Source != iTransColor) + { + Dest &= 0xFFFFFF00; + Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFF); + } + + Source = DIB_GetSourceIndex(SourceSurf, SourceGDI, SourceX++, SourceY); + if(Source != iTransColor) + { + Dest &= 0xFFFF00FF; + Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 8) & 0xFF00); + } + + Source = DIB_GetSourceIndex(SourceSurf, SourceGDI, SourceX++, SourceY); + if(Source != iTransColor) + { + Dest &= 0xFF00FFFF; + Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 16) & 0xFF0000); + } + + Source = DIB_GetSourceIndex(SourceSurf, SourceGDI, SourceX++, SourceY); + if(Source != iTransColor) + { + Dest &= 0x00FFFFFF; + Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 24) & 0xFF000000); + } + + *DestBits = Dest; + } + + if(X < DestRect->right) + { + for (; X < DestRect->right; X++) + { + Source = DIB_GetSourceIndex(SourceSurf, SourceGDI, SourceX++, SourceY); + if(Source != iTransColor) + { + *((BYTE*)DestBits) = (BYTE)(XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFF); + } + DestBits = (PULONG)((ULONG_PTR)DestBits + 1); + } + } + SourceY++; + } + + return TRUE; } /* EOF */