mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-03-06 18:09:53 +00:00
Added support for blitting SDL_PIXELFORMAT_INDEX1LSB
Fixes https://github.com/libsdl-org/SDL/issues/7844
This commit is contained in:
parent
d97423ebab
commit
a3d4fd71c3
|
@ -45,38 +45,76 @@ static void BlitBto1(SDL_BlitInfo *info)
|
||||||
srcskip += width - (width + 7) / 8;
|
srcskip += width - (width + 7) / 8;
|
||||||
|
|
||||||
if (map) {
|
if (map) {
|
||||||
while (height--) {
|
if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) {
|
||||||
Uint8 byte = 0, bit;
|
while (height--) {
|
||||||
for (c = 0; c < width; ++c) {
|
Uint8 byte = 0, bit;
|
||||||
if (!(c & 7)) {
|
for (c = 0; c < width; ++c) {
|
||||||
byte = *src++;
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x01);
|
||||||
|
if (1) {
|
||||||
|
*dst = map[bit];
|
||||||
|
}
|
||||||
|
dst++;
|
||||||
|
byte >>= 1;
|
||||||
}
|
}
|
||||||
bit = (byte & 0x80) >> 7;
|
src += srcskip;
|
||||||
if (1) {
|
dst += dstskip;
|
||||||
*dst = map[bit];
|
}
|
||||||
}
|
} else {
|
||||||
dst++;
|
while (height--) {
|
||||||
byte <<= 1;
|
Uint8 byte = 0, bit;
|
||||||
|
for (c = 0; c < width; ++c) {
|
||||||
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x80) >> 7;
|
||||||
|
if (1) {
|
||||||
|
*dst = map[bit];
|
||||||
|
}
|
||||||
|
dst++;
|
||||||
|
byte <<= 1;
|
||||||
|
}
|
||||||
|
src += srcskip;
|
||||||
|
dst += dstskip;
|
||||||
}
|
}
|
||||||
src += srcskip;
|
|
||||||
dst += dstskip;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (height--) {
|
if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) {
|
||||||
Uint8 byte = 0, bit;
|
while (height--) {
|
||||||
for (c = 0; c < width; ++c) {
|
Uint8 byte = 0, bit;
|
||||||
if (!(c & 7)) {
|
for (c = 0; c < width; ++c) {
|
||||||
byte = *src++;
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x01);
|
||||||
|
if (1) {
|
||||||
|
*dst = bit;
|
||||||
|
}
|
||||||
|
dst++;
|
||||||
|
byte >>= 1;
|
||||||
}
|
}
|
||||||
bit = (byte & 0x80) >> 7;
|
src += srcskip;
|
||||||
if (1) {
|
dst += dstskip;
|
||||||
*dst = bit;
|
}
|
||||||
}
|
} else {
|
||||||
dst++;
|
while (height--) {
|
||||||
byte <<= 1;
|
Uint8 byte = 0, bit;
|
||||||
|
for (c = 0; c < width; ++c) {
|
||||||
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x80) >> 7;
|
||||||
|
if (1) {
|
||||||
|
*dst = bit;
|
||||||
|
}
|
||||||
|
dst++;
|
||||||
|
byte <<= 1;
|
||||||
|
}
|
||||||
|
src += srcskip;
|
||||||
|
dst += dstskip;
|
||||||
}
|
}
|
||||||
src += srcskip;
|
|
||||||
dst += dstskip;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,21 +137,40 @@ static void BlitBto2(SDL_BlitInfo *info)
|
||||||
map = (Uint16 *)info->table;
|
map = (Uint16 *)info->table;
|
||||||
srcskip += width - (width + 7) / 8;
|
srcskip += width - (width + 7) / 8;
|
||||||
|
|
||||||
while (height--) {
|
if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) {
|
||||||
Uint8 byte = 0, bit;
|
while (height--) {
|
||||||
for (c = 0; c < width; ++c) {
|
Uint8 byte = 0, bit;
|
||||||
if (!(c & 7)) {
|
for (c = 0; c < width; ++c) {
|
||||||
byte = *src++;
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x01);
|
||||||
|
if (1) {
|
||||||
|
*dst = map[bit];
|
||||||
|
}
|
||||||
|
byte >>= 1;
|
||||||
|
dst++;
|
||||||
}
|
}
|
||||||
bit = (byte & 0x80) >> 7;
|
src += srcskip;
|
||||||
if (1) {
|
dst += dstskip;
|
||||||
*dst = map[bit];
|
}
|
||||||
}
|
} else {
|
||||||
byte <<= 1;
|
while (height--) {
|
||||||
dst++;
|
Uint8 byte = 0, bit;
|
||||||
|
for (c = 0; c < width; ++c) {
|
||||||
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x80) >> 7;
|
||||||
|
if (1) {
|
||||||
|
*dst = map[bit];
|
||||||
|
}
|
||||||
|
byte <<= 1;
|
||||||
|
dst++;
|
||||||
|
}
|
||||||
|
src += srcskip;
|
||||||
|
dst += dstskip;
|
||||||
}
|
}
|
||||||
src += srcskip;
|
|
||||||
dst += dstskip;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,24 +191,46 @@ static void BlitBto3(SDL_BlitInfo *info)
|
||||||
map = info->table;
|
map = info->table;
|
||||||
srcskip += width - (width + 7) / 8;
|
srcskip += width - (width + 7) / 8;
|
||||||
|
|
||||||
while (height--) {
|
if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) {
|
||||||
Uint8 byte = 0, bit;
|
while (height--) {
|
||||||
for (c = 0; c < width; ++c) {
|
Uint8 byte = 0, bit;
|
||||||
if (!(c & 7)) {
|
for (c = 0; c < width; ++c) {
|
||||||
byte = *src++;
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x01);
|
||||||
|
if (1) {
|
||||||
|
o = bit * 4;
|
||||||
|
dst[0] = map[o++];
|
||||||
|
dst[1] = map[o++];
|
||||||
|
dst[2] = map[o++];
|
||||||
|
}
|
||||||
|
byte >>= 1;
|
||||||
|
dst += 3;
|
||||||
}
|
}
|
||||||
bit = (byte & 0x80) >> 7;
|
src += srcskip;
|
||||||
if (1) {
|
dst += dstskip;
|
||||||
o = bit * 4;
|
}
|
||||||
dst[0] = map[o++];
|
} else {
|
||||||
dst[1] = map[o++];
|
while (height--) {
|
||||||
dst[2] = map[o++];
|
Uint8 byte = 0, bit;
|
||||||
}
|
for (c = 0; c < width; ++c) {
|
||||||
byte <<= 1;
|
if (!(c & 7)) {
|
||||||
dst += 3;
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x80) >> 7;
|
||||||
|
if (1) {
|
||||||
|
o = bit * 4;
|
||||||
|
dst[0] = map[o++];
|
||||||
|
dst[1] = map[o++];
|
||||||
|
dst[2] = map[o++];
|
||||||
|
}
|
||||||
|
byte <<= 1;
|
||||||
|
dst += 3;
|
||||||
|
}
|
||||||
|
src += srcskip;
|
||||||
|
dst += dstskip;
|
||||||
}
|
}
|
||||||
src += srcskip;
|
|
||||||
dst += dstskip;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,21 +252,40 @@ static void BlitBto4(SDL_BlitInfo *info)
|
||||||
map = (Uint32 *)info->table;
|
map = (Uint32 *)info->table;
|
||||||
srcskip += width - (width + 7) / 8;
|
srcskip += width - (width + 7) / 8;
|
||||||
|
|
||||||
while (height--) {
|
if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) {
|
||||||
Uint8 byte = 0, bit;
|
while (height--) {
|
||||||
for (c = 0; c < width; ++c) {
|
Uint8 byte = 0, bit;
|
||||||
if (!(c & 7)) {
|
for (c = 0; c < width; ++c) {
|
||||||
byte = *src++;
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x01);
|
||||||
|
if (1) {
|
||||||
|
*dst = map[bit];
|
||||||
|
}
|
||||||
|
byte >>= 1;
|
||||||
|
dst++;
|
||||||
}
|
}
|
||||||
bit = (byte & 0x80) >> 7;
|
src += srcskip;
|
||||||
if (1) {
|
dst += dstskip;
|
||||||
*dst = map[bit];
|
}
|
||||||
}
|
} else {
|
||||||
byte <<= 1;
|
while (height--) {
|
||||||
dst++;
|
Uint8 byte = 0, bit;
|
||||||
|
for (c = 0; c < width; ++c) {
|
||||||
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x80) >> 7;
|
||||||
|
if (1) {
|
||||||
|
*dst = map[bit];
|
||||||
|
}
|
||||||
|
byte <<= 1;
|
||||||
|
dst++;
|
||||||
|
}
|
||||||
|
src += srcskip;
|
||||||
|
dst += dstskip;
|
||||||
}
|
}
|
||||||
src += srcskip;
|
|
||||||
dst += dstskip;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,38 +305,76 @@ static void BlitBto1Key(SDL_BlitInfo *info)
|
||||||
srcskip += width - (width + 7) / 8;
|
srcskip += width - (width + 7) / 8;
|
||||||
|
|
||||||
if (palmap) {
|
if (palmap) {
|
||||||
while (height--) {
|
if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) {
|
||||||
Uint8 byte = 0, bit;
|
while (height--) {
|
||||||
for (c = 0; c < width; ++c) {
|
Uint8 byte = 0, bit;
|
||||||
if (!(c & 7)) {
|
for (c = 0; c < width; ++c) {
|
||||||
byte = *src++;
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x01);
|
||||||
|
if (bit != ckey) {
|
||||||
|
*dst = palmap[bit];
|
||||||
|
}
|
||||||
|
dst++;
|
||||||
|
byte >>= 1;
|
||||||
}
|
}
|
||||||
bit = (byte & 0x80) >> 7;
|
src += srcskip;
|
||||||
if (bit != ckey) {
|
dst += dstskip;
|
||||||
*dst = palmap[bit];
|
}
|
||||||
}
|
} else {
|
||||||
dst++;
|
while (height--) {
|
||||||
byte <<= 1;
|
Uint8 byte = 0, bit;
|
||||||
|
for (c = 0; c < width; ++c) {
|
||||||
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x80) >> 7;
|
||||||
|
if (bit != ckey) {
|
||||||
|
*dst = palmap[bit];
|
||||||
|
}
|
||||||
|
dst++;
|
||||||
|
byte <<= 1;
|
||||||
|
}
|
||||||
|
src += srcskip;
|
||||||
|
dst += dstskip;
|
||||||
}
|
}
|
||||||
src += srcskip;
|
|
||||||
dst += dstskip;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (height--) {
|
if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) {
|
||||||
Uint8 byte = 0, bit;
|
while (height--) {
|
||||||
for (c = 0; c < width; ++c) {
|
Uint8 byte = 0, bit;
|
||||||
if (!(c & 7)) {
|
for (c = 0; c < width; ++c) {
|
||||||
byte = *src++;
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x01);
|
||||||
|
if (bit != ckey) {
|
||||||
|
*dst = bit;
|
||||||
|
}
|
||||||
|
dst++;
|
||||||
|
byte >>= 1;
|
||||||
}
|
}
|
||||||
bit = (byte & 0x80) >> 7;
|
src += srcskip;
|
||||||
if (bit != ckey) {
|
dst += dstskip;
|
||||||
*dst = bit;
|
}
|
||||||
}
|
} else {
|
||||||
dst++;
|
while (height--) {
|
||||||
byte <<= 1;
|
Uint8 byte = 0, bit;
|
||||||
|
for (c = 0; c < width; ++c) {
|
||||||
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x80) >> 7;
|
||||||
|
if (bit != ckey) {
|
||||||
|
*dst = bit;
|
||||||
|
}
|
||||||
|
dst++;
|
||||||
|
byte <<= 1;
|
||||||
|
}
|
||||||
|
src += srcskip;
|
||||||
|
dst += dstskip;
|
||||||
}
|
}
|
||||||
src += srcskip;
|
|
||||||
dst += dstskip;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,21 +395,40 @@ static void BlitBto2Key(SDL_BlitInfo *info)
|
||||||
srcskip += width - (width + 7) / 8;
|
srcskip += width - (width + 7) / 8;
|
||||||
dstskip /= 2;
|
dstskip /= 2;
|
||||||
|
|
||||||
while (height--) {
|
if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) {
|
||||||
Uint8 byte = 0, bit;
|
while (height--) {
|
||||||
for (c = 0; c < width; ++c) {
|
Uint8 byte = 0, bit;
|
||||||
if (!(c & 7)) {
|
for (c = 0; c < width; ++c) {
|
||||||
byte = *src++;
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x01);
|
||||||
|
if (bit != ckey) {
|
||||||
|
*dstp = ((Uint16 *)palmap)[bit];
|
||||||
|
}
|
||||||
|
byte >>= 1;
|
||||||
|
dstp++;
|
||||||
}
|
}
|
||||||
bit = (byte & 0x80) >> 7;
|
src += srcskip;
|
||||||
if (bit != ckey) {
|
dstp += dstskip;
|
||||||
*dstp = ((Uint16 *)palmap)[bit];
|
}
|
||||||
}
|
} else {
|
||||||
byte <<= 1;
|
while (height--) {
|
||||||
dstp++;
|
Uint8 byte = 0, bit;
|
||||||
|
for (c = 0; c < width; ++c) {
|
||||||
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x80) >> 7;
|
||||||
|
if (bit != ckey) {
|
||||||
|
*dstp = ((Uint16 *)palmap)[bit];
|
||||||
|
}
|
||||||
|
byte <<= 1;
|
||||||
|
dstp++;
|
||||||
|
}
|
||||||
|
src += srcskip;
|
||||||
|
dstp += dstskip;
|
||||||
}
|
}
|
||||||
src += srcskip;
|
|
||||||
dstp += dstskip;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,21 +447,40 @@ static void BlitBto3Key(SDL_BlitInfo *info)
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
srcskip += width - (width + 7) / 8;
|
srcskip += width - (width + 7) / 8;
|
||||||
|
|
||||||
while (height--) {
|
if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) {
|
||||||
Uint8 byte = 0, bit;
|
while (height--) {
|
||||||
for (c = 0; c < width; ++c) {
|
Uint8 byte = 0, bit;
|
||||||
if (!(c & 7)) {
|
for (c = 0; c < width; ++c) {
|
||||||
byte = *src++;
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x01);
|
||||||
|
if (bit != ckey) {
|
||||||
|
SDL_memcpy(dst, &palmap[bit * 4], 3);
|
||||||
|
}
|
||||||
|
byte >>= 1;
|
||||||
|
dst += 3;
|
||||||
}
|
}
|
||||||
bit = (byte & 0x80) >> 7;
|
src += srcskip;
|
||||||
if (bit != ckey) {
|
dst += dstskip;
|
||||||
SDL_memcpy(dst, &palmap[bit * 4], 3);
|
}
|
||||||
}
|
} else {
|
||||||
byte <<= 1;
|
while (height--) {
|
||||||
dst += 3;
|
Uint8 byte = 0, bit;
|
||||||
|
for (c = 0; c < width; ++c) {
|
||||||
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x80) >> 7;
|
||||||
|
if (bit != ckey) {
|
||||||
|
SDL_memcpy(dst, &palmap[bit * 4], 3);
|
||||||
|
}
|
||||||
|
byte <<= 1;
|
||||||
|
dst += 3;
|
||||||
|
}
|
||||||
|
src += srcskip;
|
||||||
|
dst += dstskip;
|
||||||
}
|
}
|
||||||
src += srcskip;
|
|
||||||
dst += dstskip;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,21 +500,40 @@ static void BlitBto4Key(SDL_BlitInfo *info)
|
||||||
srcskip += width - (width + 7) / 8;
|
srcskip += width - (width + 7) / 8;
|
||||||
dstskip /= 4;
|
dstskip /= 4;
|
||||||
|
|
||||||
while (height--) {
|
if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) {
|
||||||
Uint8 byte = 0, bit;
|
while (height--) {
|
||||||
for (c = 0; c < width; ++c) {
|
Uint8 byte = 0, bit;
|
||||||
if (!(c & 7)) {
|
for (c = 0; c < width; ++c) {
|
||||||
byte = *src++;
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x01);
|
||||||
|
if (bit != ckey) {
|
||||||
|
*dstp = ((Uint32 *)palmap)[bit];
|
||||||
|
}
|
||||||
|
byte >>= 1;
|
||||||
|
dstp++;
|
||||||
}
|
}
|
||||||
bit = (byte & 0x80) >> 7;
|
src += srcskip;
|
||||||
if (bit != ckey) {
|
dstp += dstskip;
|
||||||
*dstp = ((Uint32 *)palmap)[bit];
|
}
|
||||||
}
|
} else {
|
||||||
byte <<= 1;
|
while (height--) {
|
||||||
dstp++;
|
Uint8 byte = 0, bit;
|
||||||
|
for (c = 0; c < width; ++c) {
|
||||||
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x80) >> 7;
|
||||||
|
if (bit != ckey) {
|
||||||
|
*dstp = ((Uint32 *)palmap)[bit];
|
||||||
|
}
|
||||||
|
byte <<= 1;
|
||||||
|
dstp++;
|
||||||
|
}
|
||||||
|
src += srcskip;
|
||||||
|
dstp += dstskip;
|
||||||
}
|
}
|
||||||
src += srcskip;
|
|
||||||
dstp += dstskip;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,26 +558,50 @@ static void BlitBtoNAlpha(SDL_BlitInfo *info)
|
||||||
dstbpp = dstfmt->BytesPerPixel;
|
dstbpp = dstfmt->BytesPerPixel;
|
||||||
srcskip += width - (width + 7) / 8;
|
srcskip += width - (width + 7) / 8;
|
||||||
|
|
||||||
while (height--) {
|
if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) {
|
||||||
Uint8 byte = 0, bit;
|
while (height--) {
|
||||||
for (c = 0; c < width; ++c) {
|
Uint8 byte = 0, bit;
|
||||||
if (!(c & 7)) {
|
for (c = 0; c < width; ++c) {
|
||||||
byte = *src++;
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x01);
|
||||||
|
if (1) {
|
||||||
|
sR = srcpal[bit].r;
|
||||||
|
sG = srcpal[bit].g;
|
||||||
|
sB = srcpal[bit].b;
|
||||||
|
DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
|
||||||
|
ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
|
||||||
|
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
|
||||||
|
}
|
||||||
|
byte >>= 1;
|
||||||
|
dst += dstbpp;
|
||||||
}
|
}
|
||||||
bit = (byte & 0x80) >> 7;
|
src += srcskip;
|
||||||
if (1) {
|
dst += dstskip;
|
||||||
sR = srcpal[bit].r;
|
}
|
||||||
sG = srcpal[bit].g;
|
} else {
|
||||||
sB = srcpal[bit].b;
|
while (height--) {
|
||||||
DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
|
Uint8 byte = 0, bit;
|
||||||
ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
|
for (c = 0; c < width; ++c) {
|
||||||
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
|
if (!(c & 7)) {
|
||||||
}
|
byte = *src++;
|
||||||
byte <<= 1;
|
}
|
||||||
dst += dstbpp;
|
bit = (byte & 0x80) >> 7;
|
||||||
|
if (1) {
|
||||||
|
sR = srcpal[bit].r;
|
||||||
|
sG = srcpal[bit].g;
|
||||||
|
sB = srcpal[bit].b;
|
||||||
|
DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
|
||||||
|
ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
|
||||||
|
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
|
||||||
|
}
|
||||||
|
byte <<= 1;
|
||||||
|
dst += dstbpp;
|
||||||
|
}
|
||||||
|
src += srcskip;
|
||||||
|
dst += dstskip;
|
||||||
}
|
}
|
||||||
src += srcskip;
|
|
||||||
dst += dstskip;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,26 +628,50 @@ static void BlitBtoNAlphaKey(SDL_BlitInfo *info)
|
||||||
dstbpp = dstfmt->BytesPerPixel;
|
dstbpp = dstfmt->BytesPerPixel;
|
||||||
srcskip += width - (width + 7) / 8;
|
srcskip += width - (width + 7) / 8;
|
||||||
|
|
||||||
while (height--) {
|
if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) {
|
||||||
Uint8 byte = 0, bit;
|
while (height--) {
|
||||||
for (c = 0; c < width; ++c) {
|
Uint8 byte = 0, bit;
|
||||||
if (!(c & 7)) {
|
for (c = 0; c < width; ++c) {
|
||||||
byte = *src++;
|
if (!(c & 7)) {
|
||||||
|
byte = *src++;
|
||||||
|
}
|
||||||
|
bit = (byte & 0x01);
|
||||||
|
if (bit != ckey) {
|
||||||
|
sR = srcpal[bit].r;
|
||||||
|
sG = srcpal[bit].g;
|
||||||
|
sB = srcpal[bit].b;
|
||||||
|
DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
|
||||||
|
ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
|
||||||
|
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
|
||||||
|
}
|
||||||
|
byte >>= 1;
|
||||||
|
dst += dstbpp;
|
||||||
}
|
}
|
||||||
bit = (byte & 0x80) >> 7;
|
src += srcskip;
|
||||||
if (bit != ckey) {
|
dst += dstskip;
|
||||||
sR = srcpal[bit].r;
|
}
|
||||||
sG = srcpal[bit].g;
|
} else {
|
||||||
sB = srcpal[bit].b;
|
while (height--) {
|
||||||
DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
|
Uint8 byte = 0, bit;
|
||||||
ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
|
for (c = 0; c < width; ++c) {
|
||||||
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
|
if (!(c & 7)) {
|
||||||
}
|
byte = *src++;
|
||||||
byte <<= 1;
|
}
|
||||||
dst += dstbpp;
|
bit = (byte & 0x80) >> 7;
|
||||||
|
if (bit != ckey) {
|
||||||
|
sR = srcpal[bit].r;
|
||||||
|
sG = srcpal[bit].g;
|
||||||
|
sB = srcpal[bit].b;
|
||||||
|
DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
|
||||||
|
ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
|
||||||
|
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
|
||||||
|
}
|
||||||
|
byte <<= 1;
|
||||||
|
dst += dstbpp;
|
||||||
|
}
|
||||||
|
src += srcskip;
|
||||||
|
dst += dstskip;
|
||||||
}
|
}
|
||||||
src += srcskip;
|
|
||||||
dst += dstskip;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue