Framebuffer: Set unused color bits to 1 instead of 0

This makes rendering to effectively have an alpha channel.
This commit is contained in:
Ilari Liusvaara 2013-12-24 02:18:16 +02:00
parent 43952138a3
commit 68a360ee6a
3 changed files with 7 additions and 3 deletions

View file

@ -1239,7 +1239,7 @@ Load a bitmap from PNG file <file> (resolved relative to <base>) or BASE64
\end_layout
\begin_layout Itemize
If the PNG is of color type 3 (PALETTE), returns two value.
If the PNG is of color type 3 (PALETTE), returns two values.
First is BITMAP containing the image data from the PNG and second is PALETTE
containg the palette data from the PNG.
\end_layout

BIN
lua.pdf

Binary file not shown.

View file

@ -869,7 +869,9 @@ void color::set_palette(unsigned rshift, unsigned gshift, unsigned bshift, bool
uint64_t r = ((orig >> 16) & 0xFF) * 257;
uint64_t g = ((orig >> 8) & 0xFF) * 257;
uint64_t b = (orig & 0xFF) * 257;
uint64_t color = (r << rshift) | (g << gshift) | (b << bshift);
uint64_t a = 65535;
uint64_t fullc = ~0ULL & ~((a << rshift) | (a << gshift) | (a << bshift));
uint64_t color = (r << rshift) | (g << gshift) | (b << bshift) | fullc;
hiHI = color & 0xFFFF0000FFFFULL;
loHI = (color & 0xFFFF0000FFFF0000ULL) >> 16;
hiHI *= (static_cast<uint32_t>(origa) * 256);
@ -878,7 +880,9 @@ void color::set_palette(unsigned rshift, unsigned gshift, unsigned bshift, bool
uint32_t r = (orig >> 16) & 0xFF;
uint32_t g = (orig >> 8) & 0xFF;
uint32_t b = orig & 0xFF;
uint32_t color = (r << rshift) | (g << gshift) | (b << bshift);
uint32_t a = 255;
uint64_t fullc = ~0UL & ~((a << rshift) | (a << gshift) | (a << bshift));
uint32_t color = (r << rshift) | (g << gshift) | (b << bshift) | fullc;
hi = color & 0xFF00FF;
lo = (color & 0xFF00FF00) >> 8;
hi *= origa;