Skip to content

Commit

Permalink
fix mask on 16-bit fast blends
Browse files Browse the repository at this point in the history
  • Loading branch information
phoddie authored and mkellner committed Feb 27, 2019
1 parent f715e88 commit f4fac09
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions modules/commodetto/commodettoPocoBlit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ void doFillRectangle(Poco poco, PocoCommand pc, PocoPixel *dst, PocoDimension h)
PocoPixel color = ((ColorDraw)pc)->color;

#if 16 == kPocoPixelSize
uint32_t colors = (color << 16) | color;
uint32_t colors = ((uint32_t)color << 16) | color;

while (h--) {
PocoCoordinate tw = w;
Expand Down Expand Up @@ -1178,7 +1178,7 @@ void doBlendRectangle(Poco poco, PocoCommand pc, PocoPixel *d, PocoDimension h)
src = src32 - dst;
dst = blend * src + (dst << 5) - dst;
dst += 0x02008010;
dst += (dst >> 5) & 0x03E0F81F;
dst += (dst >> 5) & 0x07E0F81F;
dst >>= 5;
dst &= 0x07E0F81F;
dst |= dst >> 16;
Expand Down Expand Up @@ -1538,7 +1538,7 @@ void doDrawGray16BitmapPart(Poco poco, PocoCommand pc, PocoPixel *d, PocoDimensi
#endif
PocoColor color = srcBits->color;
#if kPocoPixelFormat == kCommodettoBitmapRGB565LE
uint32_t src32 = (color | (color << 16)) & 0x07E0F81F;
uint32_t src32 = (color | ((uint32_t)color << 16)) & 0x07E0F81F;
#elif kPocoPixelFormat == kCommodettoBitmapRGB332
uint32_t src32 = (color | (color << 16)) & 0x001C00E3;
#elif kPocoPixelFormat == kCommodettoBitmapCLUT16
Expand Down Expand Up @@ -1593,7 +1593,7 @@ void doDrawGray16BitmapPart(Poco poco, PocoCommand pc, PocoPixel *d, PocoDimensi
dst &= 0x07E0F81F;
dst = blend * (src32 - dst) + (dst << 5) - dst;
dst += 0x02008010;
dst += (dst >> 5) & 0x03E0F81F;
dst += (dst >> 5) & 0x07E0F81F;
dst >>= 5;
dst &= 0x07E0F81F;
dst |= dst >> 16;
Expand Down Expand Up @@ -1683,7 +1683,7 @@ void doDrawGray16RLEBitmapPart(Poco poco, PocoCommand pc, PocoPixel *d, PocoDime
#endif
PocoColor color = srcBits->color;
#if kPocoPixelFormat == kCommodettoBitmapRGB565LE
uint32_t src32 = (color | (color << 16)) & 0x07E0F81F;
uint32_t src32 = (color | ((uint32_t)color << 16)) & 0x07E0F81F;
#elif kPocoPixelFormat == kCommodettoBitmapRGB332
uint32_t src32 = (color | (color << 16)) & 0x001C00E3;
#elif kPocoPixelFormat == kCommodettoBitmapCLUT16
Expand Down Expand Up @@ -1841,7 +1841,7 @@ void doDrawGray16RLEBitmapPart(Poco poco, PocoCommand pc, PocoPixel *d, PocoDime
dst &= 0x07E0F81F;
dst = blend * (src32 - dst) + (dst << 5) - dst;
dst += 0x02008010;
dst += (dst >> 5) & 0x03E0F81F;
dst += (dst >> 5) & 0x07E0F81F;
dst >>= 5;
dst &= 0x07E0F81F;
dst |= dst >> 16;
Expand Down Expand Up @@ -2145,7 +2145,7 @@ void doDrawGray16RLEBlendBitmapPart(Poco poco, PocoCommand pc, PocoPixel *d, Poc
dst &= 0x07E0F81F;
dst = blend * (src32 - dst) + (dst << 5) - dst;
dst += 0x02008010;
dst += (dst >> 5) & 0x03E0F81F;
dst += (dst >> 5) & 0x07E0F81F;
dst >>= 5;
dst &= 0x07E0F81F;
dst |= dst >> 16;
Expand Down Expand Up @@ -2330,7 +2330,7 @@ void doDrawMaskedBitmap(Poco poco, PocoCommand pc, PocoPixel *d, PocoDimension h
dst &= 0x07E0F81F;
dst = blend * (src32 - dst) + (dst << 5) - dst;
dst += 0x02008010u;
dst += (dst >> 5) & 0x03E0F81F;
dst += (dst >> 5) & 0x07E0F81F;
dst >>= 5;
dst &= 0x07E0F81F;
dst |= dst >> 16;
Expand Down

0 comments on commit f4fac09

Please sign in to comment.