X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fsubsystems%2Fwin32%2Fwin32k%2Fdib%2Fdib8bpp.c;h=e13331c80428d8aedeb9d505465c4240f2351aa5;hp=3fac604f5c4ef054d8fc8093497a9c6e6956f3ca;hb=684c3d3791b92777e7de259fbc6691161f6808c7;hpb=f5258132f4eef483cce5491037d4383f958ce1a2 diff --git a/reactos/subsystems/win32/win32k/dib/dib8bpp.c b/reactos/subsystems/win32/win32k/dib/dib8bpp.c index 3fac604f5c4..e13331c8042 100644 --- a/reactos/subsystems/win32/win32k/dib/dib8bpp.c +++ b/reactos/subsystems/win32/win32k/dib/dib8bpp.c @@ -43,7 +43,7 @@ DIB_8BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c) LONG lDelta = SurfObj->lDelta; byteaddr = addr; - while(y1++ < y2) + while(y1++ < y2) { *addr = c; @@ -74,8 +74,8 @@ DIB_8BPP_BitBltSrcCopy(PBLTINFO BltInfo) 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)); } @@ -362,130 +362,4 @@ DIB_8BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, 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 */