Author: jgardou Date: Sun Aug 8 00:08:39 2010 New Revision: 48483
URL: http://svn.reactos.org/svn/reactos?rev=48483&view=rev Log: [WIN32K] - work directly with bitmap bits when alpha blending icons. This is permitted, those are API bitmaps. - Do not create a stretched copy of source surface in EngAlphaBlend, handle stretching in DIB functions. - Do so. - Simplify DIB alpha blending for 24 and 32 bpp, implement generic alpha blend support for other depth.
Added: branches/reactos-yarotows/subsystems/win32/win32k/dib/alphablend.c (with props) Modified: branches/reactos-yarotows/subsystems/win32/win32k/dib/dib.c branches/reactos-yarotows/subsystems/win32/win32k/dib/dib.h branches/reactos-yarotows/subsystems/win32/win32k/dib/dib16bpp.c branches/reactos-yarotows/subsystems/win32/win32k/dib/dib1bpp.c branches/reactos-yarotows/subsystems/win32/win32k/dib/dib24bpp.c branches/reactos-yarotows/subsystems/win32/win32k/dib/dib32bpp.c branches/reactos-yarotows/subsystems/win32/win32k/dib/dib4bpp.c branches/reactos-yarotows/subsystems/win32/win32k/dib/dib8bpp.c branches/reactos-yarotows/subsystems/win32/win32k/eng/alphablend.c branches/reactos-yarotows/subsystems/win32/win32k/ntuser/cursoricon.c branches/reactos-yarotows/subsystems/win32/win32k/win32k.rbuild
Added: branches/reactos-yarotows/subsystems/win32/win32k/dib/alphablend.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/dib/alphablend.c (added) +++ branches/reactos-yarotows/subsystems/win32/win32k/dib/alphablend.c [iso-8859-1] Sun Aug 8 00:08:39 2010 @@ -1,0 +1,126 @@ +/* + * PROJECT: Win32 subsystem + * LICENSE: See COPYING in the top level directory + * FILE: subsystems/win32/win32k/dib/stretchblt.c + * PURPOSE: AlphaBlend implementation suitable for all bit depths + * PROGRAMMERS: Jérôme Gardou + */ + +#include <win32k.h> + +#define NDEBUG +#include <debug.h> + +typedef union +{ + ULONG ul; + struct + { + UCHAR red; + UCHAR green; + UCHAR blue; + UCHAR alpha; + } col; +} NICEPIXEL32; + +static __inline UCHAR +Clamp8(ULONG val) +{ + return (val > 255) ? 255 : val; +} + +BOOLEAN +DIB_XXBPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect, + RECTL* SourceRect, CLIPOBJ* ClipRegion, + XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj) +{ + INT DstX, DstY, SrcX, SrcY; + BLENDFUNCTION BlendFunc; + register NICEPIXEL32 DstPixel32; + register NICEPIXEL32 SrcPixel32; + UCHAR Alpha, SrcBpp = BitsPerFormat(Source->iBitmapFormat); + EXLATEOBJ* pexlo; + EXLATEOBJ exloSrcRGB, exloDstRGB, exloRGBSrc; + PFN_DIB_PutPixel pfnDibPutPixel = DibFunctionsForBitmapFormat[Dest->iBitmapFormat].DIB_PutPixel; + + DPRINT("DIB_16BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n", + SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom, + DestRect->left, DestRect->top, DestRect->right, DestRect->bottom); + + BlendFunc = BlendObj->BlendFunction; + if (BlendFunc.BlendOp != AC_SRC_OVER) + { + DPRINT1("BlendOp != AC_SRC_OVER\n"); + return FALSE; + } + if (BlendFunc.BlendFlags != 0) + { + DPRINT1("BlendFlags != 0\n"); + return FALSE; + } + if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0) + { + DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat); + return FALSE; + } + if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 && + SrcBpp != 32) + { + DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n"); + return FALSE; + } + + if (!ColorTranslation) + { + DPRINT1("ColorTranslation must not be NULL!\n"); + return FALSE; + } + + pexlo = CONTAINING_RECORD(ColorTranslation, EXLATEOBJ, xlo); + EXLATEOBJ_vInitialize(&exloSrcRGB, pexlo->ppalSrc, &gpalRGB, 0, 0, 0); + EXLATEOBJ_vInitialize(&exloDstRGB, pexlo->ppalDst, &gpalRGB, 0, 0, 0); + EXLATEOBJ_vInitialize(&exloRGBSrc, &gpalRGB, pexlo->ppalSrc, 0, 0, 0); + + SrcY = SourceRect->top; + DstY = DestRect->top; + while ( DstY < DestRect->bottom ) + { + SrcX = SourceRect->left; + DstX = DestRect->left; + while(DstX < DestRect->right) + { + SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo); + SrcPixel32.col.red *= BlendFunc.SourceConstantAlpha / 255; + SrcPixel32.col.green *= BlendFunc.SourceConstantAlpha / 255; + SrcPixel32.col.blue *= BlendFunc.SourceConstantAlpha / 255; + SrcPixel32.col.alpha = (32 == SrcBpp) ? + SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha / 255 : + BlendFunc.SourceConstantAlpha ; + + Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ? + SrcPixel32.col.alpha : BlendFunc.SourceConstantAlpha ; + + DstPixel32.ul = DIB_GetSource(Dest, DstX, DstY, &exloDstRGB.xlo); + DstPixel32.col.red = Clamp8(DstPixel32.col.red * (255 - Alpha) / 255 + SrcPixel32.col.red) ; + DstPixel32.col.green = Clamp8(DstPixel32.col.green * (255 - Alpha) / 255 + SrcPixel32.col.green) ; + DstPixel32.col.blue = Clamp8(DstPixel32.col.blue * (255 - Alpha) / 255 + SrcPixel32.col.blue) ; + DstPixel32.col.alpha = Clamp8(DstPixel32.col.alpha * (255 - Alpha) / 255 + SrcPixel32.col.alpha) ; + DstPixel32.ul = XLATEOBJ_iXlate(&exloRGBSrc.xlo, DstPixel32.ul); + pfnDibPutPixel(Dest, DstX, DstY, XLATEOBJ_iXlate(ColorTranslation, DstPixel32.ul)); + + DstX++; + SrcX = SourceRect->left + ((DstX-DestRect->left)*(SourceRect->right - SourceRect->left)) + /(DestRect->right-DestRect->left); + } + DstY++; + SrcY = SourceRect->top + ((DstY-DestRect->top)*(SourceRect->bottom - SourceRect->top)) + /(DestRect->bottom-DestRect->top); + } + + EXLATEOBJ_vCleanup(&exloDstRGB); + EXLATEOBJ_vCleanup(&exloRGBSrc); + EXLATEOBJ_vCleanup(&exloSrcRGB); + + return TRUE; +} +
Propchange: branches/reactos-yarotows/subsystems/win32/win32k/dib/alphablend.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: branches/reactos-yarotows/subsystems/win32/win32k/dib/dib.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/dib/dib.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/dib/dib.c [iso-8859-1] Sun Aug 8 00:08:39 2010 @@ -29,25 +29,25 @@ { DIB_1BPP_PutPixel, DIB_1BPP_GetPixel, DIB_1BPP_HLine, DIB_1BPP_VLine, DIB_1BPP_BitBlt, DIB_1BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt, - DIB_1BPP_TransparentBlt, DIB_1BPP_ColorFill, DIB_1BPP_AlphaBlend + DIB_1BPP_TransparentBlt, DIB_1BPP_ColorFill, DIB_XXBPP_AlphaBlend }, /* BMF_4BPP */ { DIB_4BPP_PutPixel, DIB_4BPP_GetPixel, DIB_4BPP_HLine, DIB_4BPP_VLine, DIB_4BPP_BitBlt, DIB_4BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt, - DIB_4BPP_TransparentBlt, DIB_4BPP_ColorFill, DIB_4BPP_AlphaBlend + DIB_4BPP_TransparentBlt, DIB_4BPP_ColorFill, DIB_XXBPP_AlphaBlend }, /* BMF_8BPP */ { DIB_8BPP_PutPixel, DIB_8BPP_GetPixel, DIB_8BPP_HLine, DIB_8BPP_VLine, DIB_8BPP_BitBlt, DIB_8BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt, - DIB_8BPP_TransparentBlt, DIB_8BPP_ColorFill, DIB_8BPP_AlphaBlend + DIB_8BPP_TransparentBlt, DIB_8BPP_ColorFill, DIB_XXBPP_AlphaBlend }, /* BMF_16BPP */ { DIB_16BPP_PutPixel, DIB_16BPP_GetPixel, DIB_16BPP_HLine, DIB_16BPP_VLine, DIB_16BPP_BitBlt, DIB_16BPP_BitBltSrcCopy, DIB_XXBPP_StretchBlt, - DIB_16BPP_TransparentBlt, DIB_16BPP_ColorFill, DIB_16BPP_AlphaBlend + DIB_16BPP_TransparentBlt, DIB_16BPP_ColorFill, DIB_XXBPP_AlphaBlend }, /* BMF_24BPP */ {
Modified: branches/reactos-yarotows/subsystems/win32/win32k/dib/dib.h URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/dib/dib.h [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/dib/dib.h [iso-8859-1] Sun Aug 8 00:08:39 2010 @@ -78,7 +78,6 @@ BOOLEAN DIB_1BPP_BitBltSrcCopy(PBLTINFO); 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*);
VOID DIB_4BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG); ULONG DIB_4BPP_GetPixel(SURFOBJ*,LONG,LONG); @@ -88,7 +87,6 @@ BOOLEAN DIB_4BPP_BitBltSrcCopy(PBLTINFO); 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*);
VOID DIB_8BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG); ULONG DIB_8BPP_GetPixel(SURFOBJ*,LONG,LONG); @@ -98,7 +96,6 @@ BOOLEAN DIB_8BPP_BitBltSrcCopy(PBLTINFO); 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*);
VOID DIB_16BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG); ULONG DIB_16BPP_GetPixel(SURFOBJ*,LONG,LONG); @@ -108,7 +105,6 @@ BOOLEAN DIB_16BPP_BitBltSrcCopy(PBLTINFO); 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*);
VOID DIB_24BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG); ULONG DIB_24BPP_GetPixel(SURFOBJ*,LONG,LONG); @@ -132,6 +128,7 @@
BOOLEAN DIB_XXBPP_StretchBlt(SURFOBJ*,SURFOBJ*,SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,BRUSHOBJ*,POINTL*,XLATEOBJ*,ROP4); BOOLEAN DIB_XXBPP_FloodFillSolid(SURFOBJ*, BRUSHOBJ*, RECTL*, POINTL*, ULONG, UINT); +BOOLEAN DIB_XXBPP_AlphaBlend(SURFOBJ*, SURFOBJ*, RECTL*, RECTL*, CLIPOBJ*, XLATEOBJ*, BLENDOBJ*);
extern unsigned char notmask[2]; extern unsigned char altnotmask[2];
Modified: branches/reactos-yarotows/subsystems/win32/win32k/dib/dib16bpp.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/dib/dib16bpp.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/dib/dib16bpp.c [iso-8859-1] Sun Aug 8 00:08:39 2010 @@ -525,174 +525,4 @@ return TRUE; }
-typedef union -{ - ULONG ul; - struct - { - UCHAR red; - UCHAR green; - UCHAR blue; - UCHAR alpha; - } col; -} NICEPIXEL32; - -typedef union -{ - USHORT us; - struct - { - USHORT red:5, - green:6, - blue:5; - } col; -} NICEPIXEL16; - -static __inline UCHAR -Clamp5(ULONG val) -{ - return (val > 31) ? 31 : val; -} - -static __inline UCHAR -Clamp8(ULONG val) -{ - return (val > 255) ? 255 : val; -} - -static __inline UCHAR -Clamp6(ULONG val) -{ - return (val > 63) ? 63 : val; -} - -BOOLEAN -DIB_16BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect, - RECTL* SourceRect, CLIPOBJ* ClipRegion, - XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj) -{ - INT Rows, Cols, SrcX, SrcY; - register PUSHORT Dst; - ULONG DstDelta; - BLENDFUNCTION BlendFunc; - register NICEPIXEL16 SrcPixel16; - register NICEPIXEL16 DstPixel16; - register NICEPIXEL32 SrcPixel32; - register NICEPIXEL32 DstPixel32; - UCHAR Alpha, SrcBpp; - EXLATEOBJ *pexlo; - EXLATEOBJ exloDst2Src; - - DPRINT("DIB_16BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n", - SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom, - DestRect->left, DestRect->top, DestRect->right, DestRect->bottom); - - ASSERT(DestRect->bottom - DestRect->top == SourceRect->bottom - SourceRect->top && - DestRect->right - DestRect->left == SourceRect->right - SourceRect->left); - - BlendFunc = BlendObj->BlendFunction; - if (BlendFunc.BlendOp != AC_SRC_OVER) - { - DPRINT1("BlendOp != AC_SRC_OVER\n"); - return FALSE; - } - if (BlendFunc.BlendFlags != 0) - { - DPRINT1("BlendFlags != 0\n"); - return FALSE; - } - if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0) - { - DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat); - return FALSE; - } - if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 && - BitsPerFormat(Source->iBitmapFormat) != 32) - { - DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n"); - return FALSE; - } - - if (!ColorTranslation) - { - DPRINT1("ColorTranslation must not be NULL!\n"); - return FALSE; - } - - pexlo = CONTAINING_RECORD(ColorTranslation, EXLATEOBJ, xlo); - EXLATEOBJ_vInitialize(&exloDst2Src, pexlo->ppalDst, pexlo->ppalSrc, 0, 0, 0); - - Dst = (PUSHORT)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) + - (DestRect->left << 1)); - DstDelta = Dest->lDelta - ((DestRect->right - DestRect->left) << 1); - SrcBpp = BitsPerFormat(Source->iBitmapFormat); - - Rows = DestRect->bottom - DestRect->top; - SrcY = SourceRect->top; - while (--Rows >= 0) - { - Cols = DestRect->right - DestRect->left; - SrcX = SourceRect->left; - while (--Cols >= 0) - { - if (SrcBpp <= 16) - { - SrcPixel16.us = DIB_GetSource(Source, SrcX++, SrcY, ColorTranslation); - SrcPixel32.col.red = (SrcPixel16.col.red << 3); - SrcPixel32.col.green = (SrcPixel16.col.green << 2); - SrcPixel32.col.blue = (SrcPixel16.col.blue << 3); - - SrcPixel32.col.red = SrcPixel32.col.red * BlendFunc.SourceConstantAlpha / 255; - SrcPixel32.col.green = SrcPixel32.col.green * BlendFunc.SourceConstantAlpha / 255; - SrcPixel32.col.blue = SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha / 255; - SrcPixel32.col.alpha = (SrcBpp == 32) ? - (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha / 255) : - BlendFunc.SourceConstantAlpha; - - Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ? - SrcPixel32.col.alpha : BlendFunc.SourceConstantAlpha; - - DstPixel16.us = *Dst; - DstPixel16.col.red = Clamp5(DstPixel16.col.red * (255 - Alpha) / 255 + - (SrcPixel32.col.red >> 3)); - - DstPixel16.col.green = Clamp6(DstPixel16.col.green * (255 - Alpha) / 255 + - (SrcPixel32.col.green >> 2)); - - DstPixel16.col.blue = Clamp5(DstPixel16.col.blue * (255 - Alpha) / 255 + - (SrcPixel32.col.blue >> 3)); - - *Dst++ = DstPixel16.us; - } - else - { - SrcPixel32.ul = DIB_GetSourceIndex(Source, SrcX++, SrcY); - - SrcPixel32.col.red = SrcPixel32.col.red * BlendFunc.SourceConstantAlpha / 255; - SrcPixel32.col.green = SrcPixel32.col.green * BlendFunc.SourceConstantAlpha / 255; - SrcPixel32.col.blue = SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha / 255; - SrcPixel32.col.alpha = (SrcBpp == 32) ? - (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha / 255) : - BlendFunc.SourceConstantAlpha; - - Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ? - SrcPixel32.col.alpha : BlendFunc.SourceConstantAlpha; - - DstPixel32.ul = XLATEOBJ_iXlate(&exloDst2Src.xlo, *Dst); - SrcPixel32.col.red = Clamp8(DstPixel32.col.red * (255 - Alpha) / 255 + SrcPixel32.col.red); - SrcPixel32.col.green = Clamp8(DstPixel32.col.green * (255 - Alpha) / 255 + SrcPixel32.col.green); - SrcPixel32.col.blue = Clamp8(DstPixel32.col.blue * (255 - Alpha) / 255 + SrcPixel32.col.blue); - *Dst++ = XLATEOBJ_iXlate(ColorTranslation, SrcPixel32.ul); - } - } - - Dst = (PUSHORT)((ULONG_PTR)Dst + DstDelta); - SrcY++; - } - - EXLATEOBJ_vCleanup(&exloDst2Src); - - return TRUE; -} - /* EOF */
Modified: branches/reactos-yarotows/subsystems/win32/win32k/dib/dib1bpp.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/dib/dib1bpp.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/dib/dib1bpp.c [iso-8859-1] Sun Aug 8 00:08:39 2010 @@ -33,7 +33,7 @@ VOID DIB_1BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c) { - while(x1 < x2) + while(x1 < x2) { DIB_1BPP_PutPixel(SurfObj, x1, y, c); x1++; @@ -43,7 +43,7 @@ VOID DIB_1BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c) { - while(y1 < y2) + while(y1 < y2) { DIB_1BPP_PutPixel(SurfObj, x, y1, c); y1++; @@ -477,13 +477,4 @@ return FALSE; }
-BOOLEAN -DIB_1BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect, - RECTL* SourceRect, CLIPOBJ* ClipRegion, - XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj) -{ - UNIMPLEMENTED; - return FALSE; -} - /* EOF */
Modified: branches/reactos-yarotows/subsystems/win32/win32k/dib/dib24bpp.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/dib/dib24bpp.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/dib/dib24bpp.c [iso-8859-1] Sun Aug 8 00:08:39 2010 @@ -37,7 +37,7 @@ LONG lDelta = SurfObj->lDelta;
c &= 0xFFFFFF; - while(y1++ < y2) + while(y1++ < y2) { *(PUSHORT)(addr) = c & 0xFFFF; *(addr + 2) = c >> 16; @@ -466,7 +466,6 @@ { INT Rows, Cols, SrcX, SrcY; register PUCHAR Dst; - ULONG DstDelta; BLENDFUNCTION BlendFunc; register NICEPIXEL32 DstPixel, SrcPixel; UCHAR Alpha, SrcBpp; @@ -474,9 +473,6 @@ DPRINT("DIB_24BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n", SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom, DestRect->left, DestRect->top, DestRect->right, DestRect->bottom); - - ASSERT(DestRect->bottom - DestRect->top == SourceRect->bottom - SourceRect->top && - DestRect->right - DestRect->left == SourceRect->right - SourceRect->left);
BlendFunc = BlendObj->BlendFunction; if (BlendFunc.BlendOp != AC_SRC_OVER) @@ -503,39 +499,47 @@
Dst = (PUCHAR)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) + (DestRect->left * 3)); - DstDelta = Dest->lDelta - ((DestRect->right - DestRect->left) * 3); SrcBpp = BitsPerFormat(Source->iBitmapFormat);
- Rows = DestRect->bottom - DestRect->top; + Rows = 0; SrcY = SourceRect->top; - while (--Rows >= 0) - { - Cols = DestRect->right - DestRect->left; - SrcX = SourceRect->left; - while (--Cols >= 0) - { - SrcPixel.ul = DIB_GetSource(Source, SrcX++, SrcY, ColorTranslation); - SrcPixel.col.red = SrcPixel.col.red * BlendFunc.SourceConstantAlpha / 255; - SrcPixel.col.green = SrcPixel.col.green * BlendFunc.SourceConstantAlpha / 255; - SrcPixel.col.blue = SrcPixel.col.blue * BlendFunc.SourceConstantAlpha / 255; - SrcPixel.col.alpha = (SrcBpp == 32) ? (SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha / 255) : BlendFunc.SourceConstantAlpha; - - Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ? - SrcPixel.col.alpha : BlendFunc.SourceConstantAlpha; - - /* copy only 24bits of dst */ - DstPixel.ul = *(PUSHORT)(Dst) + (*(Dst+2) << 16); - DstPixel.col.red = Clamp8(DstPixel.col.red * (255 - Alpha) / 255 + SrcPixel.col.red); - DstPixel.col.green = Clamp8(DstPixel.col.green * (255 - Alpha) / 255 + SrcPixel.col.green); - DstPixel.col.blue = Clamp8(DstPixel.col.blue * (255 - Alpha) / 255 + SrcPixel.col.blue); - /* copy back 24bits of result */ - *(PUSHORT)(Dst) = (USHORT)(DstPixel.ul & 0xFFFF); - *(Dst + 2) = (UCHAR)((DstPixel.ul >> 16) & 0xFF); - Dst = (PUCHAR)((ULONG_PTR)Dst + 3); - } - Dst = (PUCHAR)((ULONG_PTR)Dst + DstDelta); - SrcY++; - } + while (++Rows <= DestRect->bottom - DestRect->top) + { + Cols = 0; + SrcX = SourceRect->left; + while (++Cols <= DestRect->right - DestRect->left) + { + if (!(BlendFunc.AlphaFormat & AC_SRC_ALPHA)) + { + SrcPixel.ul = DIB_GetSource(Source, SrcX, SrcY, ColorTranslation); + SrcPixel.col.red *= BlendFunc.SourceConstantAlpha / 255; + SrcPixel.col.green *= BlendFunc.SourceConstantAlpha / 255; + SrcPixel.col.blue *= BlendFunc.SourceConstantAlpha / 255; + Alpha = BlendFunc.SourceConstantAlpha ; + } + else + { + SrcPixel.ul = DIB_GetSourceIndex(Source, SrcX, SrcY); + SrcPixel.col.red *= BlendFunc.SourceConstantAlpha / 255; + SrcPixel.col.green *= BlendFunc.SourceConstantAlpha / 255; + SrcPixel.col.blue *= BlendFunc.SourceConstantAlpha / 255; + SrcPixel.col.alpha *= BlendFunc.SourceConstantAlpha / 255; + + Alpha = SrcPixel.col.alpha; + } + + DstPixel.col.red = (*Dst) * (255 - Alpha) / 255 + SrcPixel.col.red ; + DstPixel.col.green = *(Dst+1) * (255 - Alpha) / 255 + SrcPixel.col.green ; + DstPixel.col.blue = *(Dst+2) * (255 - Alpha) / 255 + SrcPixel.col.blue ; + *Dst++ = DstPixel.col.red; + *Dst++ = DstPixel.col.green; + *Dst++ = DstPixel.col.blue; + SrcX = SourceRect->left + (Cols*(SourceRect->right - SourceRect->left))/(DestRect->right - DestRect->left); + } + Dst = (PUCHAR)((ULONG_PTR)Dest->pvScan0 + ((DestRect->top + Rows) * Dest->lDelta) + + (DestRect->left*3)); + SrcY = SourceRect->top + (Rows*(SourceRect->bottom - SourceRect->top))/(DestRect->bottom - DestRect->top); + }
return TRUE; }
Modified: branches/reactos-yarotows/subsystems/win32/win32k/dib/dib32bpp.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/dib/dib32bpp.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/dib/dib32bpp.c [iso-8859-1] Sun Aug 8 00:08:39 2010 @@ -54,8 +54,8 @@ PBYTE SourceBits_4BPP, SourceLine_4BPP; PDWORD Source32, Dest32;
- DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 - + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + 4 * BltInfo->DestRect.left;
switch (BltInfo->SourceSurface->iBitmapFormat) @@ -83,8 +83,8 @@ break;
case BMF_4BPP: - SourceBits_4BPP = (PBYTE)BltInfo->SourceSurface->pvScan0 - + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + SourceBits_4BPP = (PBYTE)BltInfo->SourceSurface->pvScan0 + + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + (BltInfo->SourcePoint.x >> 1);
for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++) @@ -156,8 +156,8 @@ break;
case BMF_24BPP: - SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 - + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x; DestLine = DestBits;
@@ -182,7 +182,7 @@ break;
case BMF_32BPP: - if (NULL == BltInfo->XlateSourceToDest || + if (NULL == BltInfo->XlateSourceToDest || 0 != (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL)) { if (BltInfo->DestRect.top < BltInfo->SourcePoint.y) @@ -197,10 +197,10 @@ } else { - SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 - + ((BltInfo->SourcePoint.y - + BltInfo->DestRect.bottom - - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + + ((BltInfo->SourcePoint.y + + BltInfo->DestRect.bottom + - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x; DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + 4 * BltInfo->DestRect.left; for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--) @@ -348,7 +348,6 @@ { INT Rows, Cols, SrcX, SrcY; register PULONG Dst; - ULONG DstDelta; BLENDFUNCTION BlendFunc; register NICEPIXEL32 DstPixel, SrcPixel; UCHAR Alpha, SrcBpp; @@ -357,9 +356,6 @@ SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom, DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
- ASSERT(DestRect->bottom - DestRect->top == SourceRect->bottom - SourceRect->top && - DestRect->right - DestRect->left == SourceRect->right - SourceRect->left); - BlendFunc = BlendObj->BlendFunction; if (BlendFunc.BlendOp != AC_SRC_OVER) { @@ -385,35 +381,38 @@
Dst = (PULONG)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) + (DestRect->left << 2)); - DstDelta = Dest->lDelta - ((DestRect->right - DestRect->left) << 2); SrcBpp = BitsPerFormat(Source->iBitmapFormat);
- Rows = DestRect->bottom - DestRect->top; - SrcY = SourceRect->top; - while (--Rows >= 0) - { - Cols = DestRect->right - DestRect->left; + Rows = 0; + SrcY = SourceRect->top; + while (++Rows <= DestRect->bottom - DestRect->top) + { + Cols = 0; SrcX = SourceRect->left; - while (--Cols >= 0) - { - SrcPixel.ul = DIB_GetSource(Source, SrcX++, SrcY, ColorTranslation); - SrcPixel.col.red = SrcPixel.col.red * BlendFunc.SourceConstantAlpha / 255; - SrcPixel.col.green = SrcPixel.col.green * BlendFunc.SourceConstantAlpha / 255; - SrcPixel.col.blue = SrcPixel.col.blue * BlendFunc.SourceConstantAlpha / 255; - SrcPixel.col.alpha = (SrcBpp == 32) ? (SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha / 255) : BlendFunc.SourceConstantAlpha; + while (++Cols <= DestRect->right - DestRect->left) + { + SrcPixel.ul = DIB_GetSource(Source, SrcX, SrcY, ColorTranslation); + SrcPixel.col.red *= BlendFunc.SourceConstantAlpha / 255; + SrcPixel.col.green *= BlendFunc.SourceConstantAlpha / 255; + SrcPixel.col.blue *= BlendFunc.SourceConstantAlpha / 255; + SrcPixel.col.alpha = (32 == SrcBpp) ? + SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha / 255 : + BlendFunc.SourceConstantAlpha ;
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ? - SrcPixel.col.alpha : BlendFunc.SourceConstantAlpha; + SrcPixel.col.alpha : BlendFunc.SourceConstantAlpha ;
DstPixel.ul = *Dst; - DstPixel.col.red = Clamp8(DstPixel.col.red * (255 - Alpha) / 255 + SrcPixel.col.red); - DstPixel.col.green = Clamp8(DstPixel.col.green * (255 - Alpha) / 255 + SrcPixel.col.green); - DstPixel.col.blue = Clamp8(DstPixel.col.blue * (255 - Alpha) / 255 + SrcPixel.col.blue); - DstPixel.col.alpha = Clamp8(DstPixel.col.alpha * (255 - Alpha) / 255 + SrcPixel.col.alpha); + DstPixel.col.red = Clamp8(DstPixel.col.red * (255 - Alpha) / 255 + SrcPixel.col.red) ; + DstPixel.col.green = Clamp8(DstPixel.col.green * (255 - Alpha) / 255 + SrcPixel.col.green) ; + DstPixel.col.blue = Clamp8(DstPixel.col.blue * (255 - Alpha) / 255 + SrcPixel.col.blue) ; + DstPixel.col.alpha = Clamp8(DstPixel.col.alpha * (255 - Alpha) / 255 + SrcPixel.col.alpha) ; *Dst++ = DstPixel.ul; - } - Dst = (PULONG)((ULONG_PTR)Dst + DstDelta); - SrcY++; + SrcX = SourceRect->left + (Cols*(SourceRect->right - SourceRect->left))/(DestRect->right - DestRect->left); + } + Dst = (PULONG)((ULONG_PTR)Dest->pvScan0 + ((DestRect->top + Rows) * Dest->lDelta) + + (DestRect->left << 2)); + SrcY = SourceRect->top + (Rows*(SourceRect->bottom - SourceRect->top))/(DestRect->bottom - DestRect->top); }
return TRUE;
Modified: branches/reactos-yarotows/subsystems/win32/win32k/dib/dib4bpp.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/dib/dib4bpp.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/dib/dib4bpp.c [iso-8859-1] Sun Aug 8 00:08:39 2010 @@ -32,7 +32,7 @@ PBYTE addr = (PBYTE)SurfObj->pvScan0 + (x1>>1) + y * SurfObj->lDelta; LONG cx = x1;
- while(cx < x2) + while(cx < x2) { *addr = (*addr & notmask[x1&1]) | (c << ((1-(x1&1))<<2)); if((++x1 & 1) == 0) @@ -48,7 +48,7 @@ int lDelta = SurfObj->lDelta;
addr += (x>>1) + y1 * lDelta; - while(y1++ < y2) + while(y1++ < y2) { *addr = (*addr & notmask[x&1]) | (c << ((1-(x&1))<<2)); addr += lDelta; @@ -81,8 +81,8 @@ if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0) { DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0)); - } - else + } + else { DIB_4BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1)); } @@ -375,13 +375,4 @@ return FALSE; }
-BOOLEAN -DIB_4BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect, - RECTL* SourceRect, CLIPOBJ* ClipRegion, - XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj) -{ - UNIMPLEMENTED; - return FALSE; -} - /* EOF */
Modified: branches/reactos-yarotows/subsystems/win32/win32k/dib/dib8bpp.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/dib/dib8bpp.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/dib/dib8bpp.c [iso-8859-1] Sun Aug 8 00:08:39 2010 @@ -43,7 +43,7 @@ LONG lDelta = SurfObj->lDelta;
byteaddr = addr; - while(y1++ < y2) + while(y1++ < y2) { *addr = c;
@@ -74,8 +74,8 @@ if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0) { DIB_8BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 0)); - } - else + } + else { DIB_8BPP_PutPixel(BltInfo->DestSurface, i, j, XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, 1)); } @@ -363,130 +363,4 @@ return TRUE; }
-typedef union { - ULONG ul; - struct { - UCHAR red; - UCHAR green; - UCHAR blue; - UCHAR alpha; - } col; -} NICEPIXEL32; - -typedef union { - USHORT us; - struct { - USHORT red:5, - green:6, - blue:5; - } col; -} NICEPIXEL16; - -static __inline UCHAR -Clamp8(ULONG val) -{ - return (val > 255) ? 255 : val; -} - -BOOLEAN -DIB_8BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect, - RECTL* SourceRect, CLIPOBJ* ClipRegion, - XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj) -{ - INT Rows, Cols, SrcX, SrcY; - register PUCHAR Dst; - ULONG DstDelta; - BLENDFUNCTION BlendFunc; - register NICEPIXEL32 DstPixel32; - register NICEPIXEL32 SrcPixel32; - register NICEPIXEL16 SrcPixel16; - UCHAR Alpha, SrcBpp; - EXLATEOBJ exloDst2Src; - EXLATEOBJ* pexlo; - - DPRINT("DIB_8BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n", - SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom, - DestRect->left, DestRect->top, DestRect->right, DestRect->bottom); - - ASSERT(DestRect->bottom - DestRect->top == SourceRect->bottom - SourceRect->top && - DestRect->right - DestRect->left == SourceRect->right - SourceRect->left); - - BlendFunc = BlendObj->BlendFunction; - if (BlendFunc.BlendOp != AC_SRC_OVER) - { - DPRINT1("BlendOp != AC_SRC_OVER\n"); - return FALSE; - } - if (BlendFunc.BlendFlags != 0) - { - DPRINT1("BlendFlags != 0\n"); - return FALSE; - } - if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0) - { - DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat); - return FALSE; - } - if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 && - BitsPerFormat(Source->iBitmapFormat) != 32) - { - DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n"); - return FALSE; - } - if (!ColorTranslation) - { - DPRINT1("ColorTranslation must not be NULL!\n"); - return FALSE; - } - - pexlo = CONTAINING_RECORD(ColorTranslation, EXLATEOBJ, xlo); - EXLATEOBJ_vInitialize(&exloDst2Src, pexlo->ppalDst, pexlo->ppalSrc, 0, 0, 0); - - Dst = (PUCHAR)((ULONG_PTR)Dest->pvScan0 + (DestRect->top * Dest->lDelta) + - DestRect->left); - DstDelta = Dest->lDelta - (DestRect->right - DestRect->left); - SrcBpp = BitsPerFormat(Source->iBitmapFormat); - - Rows = DestRect->bottom - DestRect->top; - SrcY = SourceRect->top; - while (--Rows >= 0) - { - Cols = DestRect->right - DestRect->left; - SrcX = SourceRect->left; - while (--Cols >= 0) - { - if (SrcBpp <= 16) - { - SrcPixel16.us = DIB_GetSource(Source, SrcX++, SrcY, ColorTranslation); - SrcPixel32.col.red = (SrcPixel16.col.red << 3) | (SrcPixel16.col.red >> 2); - SrcPixel32.col.green = (SrcPixel16.col.green << 2) | (SrcPixel16.col.green >> 4); - SrcPixel32.col.blue = (SrcPixel16.col.blue << 3) | (SrcPixel16.col.blue >> 2); - } - else - { - SrcPixel32.ul = DIB_GetSourceIndex(Source, SrcX++, SrcY); - } - SrcPixel32.col.red = SrcPixel32.col.red * BlendFunc.SourceConstantAlpha / 255; - SrcPixel32.col.green = SrcPixel32.col.green * BlendFunc.SourceConstantAlpha / 255; - SrcPixel32.col.blue = SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha / 255; - SrcPixel32.col.alpha = (SrcBpp == 32) ? (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha / 255) : BlendFunc.SourceConstantAlpha; - - Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ? - SrcPixel32.col.alpha : BlendFunc.SourceConstantAlpha; - - DstPixel32.ul = XLATEOBJ_iXlate(&exloDst2Src.xlo, *Dst); - SrcPixel32.col.red = Clamp8(DstPixel32.col.red * (255 - Alpha) / 255 + SrcPixel32.col.red); - SrcPixel32.col.green = Clamp8(DstPixel32.col.green * (255 - Alpha) / 255 + SrcPixel32.col.green); - SrcPixel32.col.blue = Clamp8(DstPixel32.col.blue * (255 - Alpha) / 255 + SrcPixel32.col.blue); - *Dst++ = XLATEOBJ_iXlate(ColorTranslation, SrcPixel32.ul); - } - Dst = (PUCHAR)((ULONG_PTR)Dst + DstDelta); - SrcY++; - } - - EXLATEOBJ_vCleanup(&exloDst2Src); - - return TRUE; -} - /* EOF */
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/alphablend.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/eng/alphablend.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/eng/alphablend.c [iso-8859-1] Sun Aug 8 00:08:39 2010 @@ -25,10 +25,6 @@ IN PRECTL SourceRect, IN BLENDOBJ *BlendObj) { - RECTL SourceStretchedRect; - SIZEL SourceStretchedSize; - HBITMAP SourceStretchedBitmap = 0; - SURFOBJ* SourceStretchedObj = NULL; RECTL InputRect; RECTL OutputRect; RECTL ClipRect; @@ -39,7 +35,6 @@ INTENG_ENTER_LEAVE EnterLeaveDest; SURFOBJ* InputObj; SURFOBJ* OutputObj; - LONG Width; LONG ClippingType; RECT_ENUM RectEnum; BOOL EnumMore; @@ -111,61 +106,9 @@ return TRUE; }
- /* Stretch source if needed */ - if (OutputRect.right - OutputRect.left != InputRect.right - InputRect.left || - OutputRect.bottom - OutputRect.top != InputRect.bottom - InputRect.top) - { - SourceStretchedSize.cx = OutputRect.right - OutputRect.left; - SourceStretchedSize.cy = OutputRect.bottom - OutputRect.top; - Width = DIB_GetDIBWidthBytes(SourceStretchedSize.cx, BitsPerFormat(psoSource->iBitmapFormat)); - /* FIXME: Maybe it is a good idea to use EngCreateDeviceBitmap and IntEngStretchBlt - if possible to get a HW accelerated stretch. */ - SourceStretchedBitmap = EngCreateBitmap(SourceStretchedSize, Width, psoSource->iBitmapFormat, - BMF_TOPDOWN | BMF_NOZEROINIT, NULL); - if (SourceStretchedBitmap == 0) - { - DPRINT1("EngCreateBitmap failed!\n"); - return FALSE; - } - SourceStretchedObj = EngLockSurface((HSURF)SourceStretchedBitmap); - if (SourceStretchedObj == NULL) - { - DPRINT1("EngLockSurface failed!\n"); - EngDeleteSurface((HSURF)SourceStretchedBitmap); - return FALSE; - } - - SourceStretchedRect.left = 0; - SourceStretchedRect.right = SourceStretchedSize.cx; - SourceStretchedRect.top = 0; - SourceStretchedRect.bottom = SourceStretchedSize.cy; - if (!IntEngStretchBlt(SourceStretchedObj, psoSource, NULL, NULL, NULL, - &SourceStretchedRect, SourceRect, - NULL, NULL, NULL, ROP3_TO_ROP4(SRCCOPY))) - { - DPRINT1("EngStretchBlt failed!\n"); - EngUnlockSurface(SourceStretchedObj); - EngDeleteSurface((HSURF)SourceStretchedBitmap); - return FALSE; - } - InputRect.top = SourceStretchedRect.top; - InputRect.bottom = SourceStretchedRect.bottom; - InputRect.left = SourceStretchedRect.left; - InputRect.right = SourceStretchedRect.right; - psoSource = SourceStretchedObj; - } - /* Now call the DIB function */ if (!IntEngEnter(&EnterLeaveSource, psoSource, &InputRect, TRUE, &Translate, &InputObj)) { - if (SourceStretchedObj != NULL) - { - EngUnlockSurface(SourceStretchedObj); - } - if (SourceStretchedBitmap != 0) - { - EngDeleteSurface((HSURF)SourceStretchedBitmap); - } return FALSE; } InputRect.left += Translate.x; @@ -175,15 +118,6 @@
if (!IntEngEnter(&EnterLeaveDest, psoDest, &OutputRect, FALSE, &Translate, &OutputObj)) { - IntEngLeave(&EnterLeaveSource); - if (SourceStretchedObj != NULL) - { - EngUnlockSurface(SourceStretchedObj); - } - if (SourceStretchedBitmap != 0) - { - EngDeleteSurface((HSURF)SourceStretchedBitmap); - } return FALSE; } OutputRect.left += Translate.x; @@ -253,15 +187,6 @@ IntEngLeave(&EnterLeaveDest); IntEngLeave(&EnterLeaveSource);
- if (SourceStretchedObj != NULL) - { - EngUnlockSurface(SourceStretchedObj); - } - if (SourceStretchedBitmap != 0) - { - EngDeleteSurface((HSURF)SourceStretchedBitmap); - } - return Ret; }
Modified: branches/reactos-yarotows/subsystems/win32/win32k/ntuser/cursoricon.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] Sun Aug 8 00:08:39 2010 @@ -1328,17 +1328,8 @@ BYTE Alpha; INT i, j; PSURFACE psurf; - PBYTE pBits, ptr ; + PBYTE ptr ; HBITMAP hMemBmp = NULL; - - pBits = ExAllocatePoolWithTag(PagedPool, - bmpColor.bmWidthBytes * abs(bmpColor.bmHeight), - TAG_BITMAP); - if (pBits == NULL) - { - Ret = FALSE; - goto CleanupAlpha; - }
hMemBmp = BITMAP_CopyBitmap(hbmColor); if(!hMemBmp) @@ -1353,16 +1344,12 @@ DPRINT1("SURFACE_LockSurface failed!\n"); goto CleanupAlpha; } - /* get color bits */ - IntGetBitmapBits(psurf, - bmpColor.bmWidthBytes * abs(bmpColor.bmHeight), - pBits);
/* premultiply with the alpha channel value */ - for (i = 0; i < abs(bmpColor.bmHeight); i++) - { - ptr = pBits + i*bmpColor.bmWidthBytes; - for (j = 0; j < bmpColor.bmWidth; j++) + for (i = 0; i < psurf->SurfObj.sizlBitmap.cy; i++) + { + ptr = (PBYTE)psurf->SurfObj.pvScan0 + i*psurf->SurfObj.lDelta; + for (j = 0; j < psurf->SurfObj.sizlBitmap.cx; j++) { Alpha = ptr[3]; ptr[0] *= Alpha / 0xff; @@ -1373,10 +1360,6 @@ } }
- /* set mem bits */ - IntSetBitmapBits(psurf, - bmpColor.bmWidthBytes * abs(bmpColor.bmHeight), - pBits); SURFACE_UnlockSurface(psurf);
hTmpBmp = NtGdiSelectBitmap(hMemDC, hMemBmp); @@ -1395,11 +1378,9 @@ NULL); NtGdiSelectBitmap(hMemDC, hTmpBmp); CleanupAlpha: - if(pBits) ExFreePoolWithTag(pBits, TAG_BITMAP); if(hMemBmp) NtGdiDeleteObjectApp(hMemBmp); if(Ret) goto done; } -
if (diFlags & DI_MASK) {
Modified: branches/reactos-yarotows/subsystems/win32/win32k/win32k.rbuild URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] Sun Aug 8 00:08:39 2010 @@ -38,6 +38,7 @@ <file>dib.c</file> <file>floodfill.c</file> <file>stretchblt.c</file> + <file>alphablend.c</file>
<if property="ARCH" value="i386"> <directory name="i386">