mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-19 20:49:11 +00:00
Codechange: Use enum class for BlitterMode.
This commit is contained in:
@@ -98,7 +98,7 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
draw:;
|
||||
|
||||
switch (mode) {
|
||||
case BM_COLOUR_REMAP:
|
||||
case BlitterMode::ColourRemap:
|
||||
if (src_px->a == 255) {
|
||||
do {
|
||||
uint m = *src_n;
|
||||
@@ -135,7 +135,7 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_CRASH_REMAP:
|
||||
case BlitterMode::CrashRemap:
|
||||
if (src_px->a == 255) {
|
||||
do {
|
||||
uint m = *src_n;
|
||||
@@ -176,7 +176,7 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
break;
|
||||
|
||||
|
||||
case BM_BLACK_REMAP:
|
||||
case BlitterMode::BlackRemap:
|
||||
do {
|
||||
*dst++ = Colour(0, 0, 0);
|
||||
*anim++ = 0;
|
||||
@@ -185,7 +185,7 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
} while (--n != 0);
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT:
|
||||
case BlitterMode::Transparent:
|
||||
/* Make the current colour a bit more black, so it looks like this image is transparent */
|
||||
src_n += n;
|
||||
if (src_px->a == 255) {
|
||||
@@ -207,7 +207,7 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT_REMAP:
|
||||
case BlitterMode::TransparentRemap:
|
||||
/* Apply custom transparency remap. */
|
||||
src_n += n;
|
||||
if (src_px->a != 0) {
|
||||
@@ -271,12 +271,12 @@ void Blitter_32bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL
|
||||
|
||||
switch (mode) {
|
||||
default: NOT_REACHED();
|
||||
case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom); return;
|
||||
case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP>(bp, zoom); return;
|
||||
case BM_TRANSPARENT: Draw<BM_TRANSPARENT> (bp, zoom); return;
|
||||
case BM_TRANSPARENT_REMAP: Draw<BM_TRANSPARENT_REMAP>(bp, zoom); return;
|
||||
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP> (bp, zoom); return;
|
||||
case BM_BLACK_REMAP: Draw<BM_BLACK_REMAP> (bp, zoom); return;
|
||||
case BlitterMode::Normal: Draw<BlitterMode::Normal>(bp, zoom); return;
|
||||
case BlitterMode::ColourRemap: Draw<BlitterMode::ColourRemap>(bp, zoom); return;
|
||||
case BlitterMode::Transparent: Draw<BlitterMode::Transparent>(bp, zoom); return;
|
||||
case BlitterMode::TransparentRemap: Draw<BlitterMode::TransparentRemap>(bp, zoom); return;
|
||||
case BlitterMode::CrashRemap: Draw<BlitterMode::CrashRemap>(bp, zoom); return;
|
||||
case BlitterMode::BlackRemap: Draw<BlitterMode::BlackRemap>(bp, zoom); return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ inline void Blitter_32bppSSE4_Anim::Draw(const BlitterParams *bp, ZoomLevel zoom
|
||||
for (int y = bp->height; y != 0; y--) {
|
||||
Colour *dst = dst_line;
|
||||
const Colour *src = src_rgba_line + META_LENGTH;
|
||||
if (mode != BM_TRANSPARENT) src_mv = src_mv_line;
|
||||
if (mode != BlitterMode::Transparent) src_mv = src_mv_line;
|
||||
uint16_t *anim = anim_line;
|
||||
|
||||
if (read_mode == RM_WITH_MARGIN) {
|
||||
@@ -67,7 +67,7 @@ inline void Blitter_32bppSSE4_Anim::Draw(const BlitterParams *bp, ZoomLevel zoom
|
||||
anim += src_rgba_line[0].data;
|
||||
src += src_rgba_line[0].data;
|
||||
dst += src_rgba_line[0].data;
|
||||
if (mode != BM_TRANSPARENT) src_mv += src_rgba_line[0].data;
|
||||
if (mode != BlitterMode::Transparent) src_mv += src_rgba_line[0].data;
|
||||
const int width_diff = si->sprite_width - bp->width;
|
||||
effective_width = bp->width - (int) src_rgba_line[0].data;
|
||||
const int delta_diff = (int) src_rgba_line[1].data - width_diff;
|
||||
@@ -178,7 +178,7 @@ bmno_full_transparency:
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_COLOUR_REMAP:
|
||||
case BlitterMode::ColourRemap:
|
||||
for (uint x = (uint) effective_width / 2; x != 0; x--) {
|
||||
uint32_t mvX2 = *((uint32_t *) const_cast<MapValue *>(src_mv));
|
||||
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
|
||||
@@ -297,7 +297,7 @@ bmcr_alpha_blend_single:
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT:
|
||||
case BlitterMode::Transparent:
|
||||
/* Make the current colour a bit more black, so it looks like this image is transparent. */
|
||||
for (uint x = (uint) bp->width / 2; x > 0; x--) {
|
||||
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
|
||||
@@ -318,7 +318,7 @@ bmcr_alpha_blend_single:
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT_REMAP:
|
||||
case BlitterMode::TransparentRemap:
|
||||
/* Apply custom transparency remap. */
|
||||
for (uint x = (uint) bp->width; x > 0; x--) {
|
||||
if (src->a != 0) {
|
||||
@@ -333,7 +333,7 @@ bmcr_alpha_blend_single:
|
||||
break;
|
||||
|
||||
|
||||
case BM_CRASH_REMAP:
|
||||
case BlitterMode::CrashRemap:
|
||||
for (uint x = (uint) bp->width; x > 0; x--) {
|
||||
if (src_mv->m == 0) {
|
||||
if (src->a != 0) {
|
||||
@@ -352,7 +352,7 @@ bmcr_alpha_blend_single:
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_BLACK_REMAP:
|
||||
case BlitterMode::BlackRemap:
|
||||
for (uint x = (uint) bp->width; x > 0; x--) {
|
||||
if (src->a != 0) {
|
||||
*dst = Colour(0, 0, 0);
|
||||
@@ -367,7 +367,7 @@ bmcr_alpha_blend_single:
|
||||
}
|
||||
|
||||
next_line:
|
||||
if (mode != BM_TRANSPARENT && mode != BM_TRANSPARENT_REMAP) src_mv_line += si->sprite_width;
|
||||
if (mode != BlitterMode::Transparent && mode != BlitterMode::TransparentRemap) src_mv_line += si->sprite_width;
|
||||
src_rgba_line = (const Colour*) ((const uint8_t*) src_rgba_line + si->sprite_line_size);
|
||||
dst_line += bp->pitch;
|
||||
anim_line += this->anim_buf_pitch;
|
||||
@@ -397,42 +397,42 @@ bm_normal:
|
||||
if (bp->skip_left != 0 || bp->width <= MARGIN_NORMAL_THRESHOLD) {
|
||||
const BlockType bt_last = (BlockType) (bp->width & 1);
|
||||
if (bt_last == BT_EVEN) {
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN, true, false>(bp, zoom);
|
||||
else Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN, true, true>(bp, zoom);
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BlitterMode::Normal, RM_WITH_SKIP, BT_EVEN, true, false>(bp, zoom);
|
||||
else Draw<BlitterMode::Normal, RM_WITH_SKIP, BT_EVEN, true, true>(bp, zoom);
|
||||
} else {
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD, true, false>(bp, zoom);
|
||||
else Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD, true, true>(bp, zoom);
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BlitterMode::Normal, RM_WITH_SKIP, BT_ODD, true, false>(bp, zoom);
|
||||
else Draw<BlitterMode::Normal, RM_WITH_SKIP, BT_ODD, true, true>(bp, zoom);
|
||||
}
|
||||
} else {
|
||||
#ifdef POINTER_IS_64BIT
|
||||
if (sprite_flags & SF_TRANSLUCENT) {
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, false>(bp, zoom);
|
||||
else Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, true>(bp, zoom);
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BlitterMode::Normal, RM_WITH_MARGIN, BT_NONE, true, false>(bp, zoom);
|
||||
else Draw<BlitterMode::Normal, RM_WITH_MARGIN, BT_NONE, true, true>(bp, zoom);
|
||||
} else {
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, false, false>(bp, zoom);
|
||||
else Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, false, true>(bp, zoom);
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BlitterMode::Normal, RM_WITH_MARGIN, BT_NONE, false, false>(bp, zoom);
|
||||
else Draw<BlitterMode::Normal, RM_WITH_MARGIN, BT_NONE, false, true>(bp, zoom);
|
||||
}
|
||||
#else
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, false>(bp, zoom);
|
||||
else Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, true>(bp, zoom);
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BlitterMode::Normal, RM_WITH_MARGIN, BT_NONE, true, false>(bp, zoom);
|
||||
else Draw<BlitterMode::Normal, RM_WITH_MARGIN, BT_NONE, true, true>(bp, zoom);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BM_COLOUR_REMAP:
|
||||
case BlitterMode::ColourRemap:
|
||||
if (sprite_flags & SF_NO_REMAP) goto bm_normal;
|
||||
if (bp->skip_left != 0 || bp->width <= MARGIN_REMAP_THRESHOLD) {
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE, true, false>(bp, zoom);
|
||||
else Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE, true, true>(bp, zoom);
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BlitterMode::ColourRemap, RM_WITH_SKIP, BT_NONE, true, false>(bp, zoom);
|
||||
else Draw<BlitterMode::ColourRemap, RM_WITH_SKIP, BT_NONE, true, true>(bp, zoom);
|
||||
} else {
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE, true, false>(bp, zoom);
|
||||
else Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE, true, true>(bp, zoom);
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BlitterMode::ColourRemap, RM_WITH_MARGIN, BT_NONE, true, false>(bp, zoom);
|
||||
else Draw<BlitterMode::ColourRemap, RM_WITH_MARGIN, BT_NONE, true, true>(bp, zoom);
|
||||
}
|
||||
break;
|
||||
case BM_TRANSPARENT: Draw<BM_TRANSPARENT, RM_NONE, BT_NONE, true, true>(bp, zoom); return;
|
||||
case BM_TRANSPARENT_REMAP: Draw<BM_TRANSPARENT_REMAP, RM_NONE, BT_NONE, true, true>(bp, zoom); return;
|
||||
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP, RM_NONE, BT_NONE, true, true>(bp, zoom); return;
|
||||
case BM_BLACK_REMAP: Draw<BM_BLACK_REMAP, RM_NONE, BT_NONE, true, true>(bp, zoom); return;
|
||||
case BlitterMode::Transparent: Draw<BlitterMode::Transparent, RM_NONE, BT_NONE, true, true>(bp, zoom); return;
|
||||
case BlitterMode::TransparentRemap: Draw<BlitterMode::TransparentRemap, RM_NONE, BT_NONE, true, true>(bp, zoom); return;
|
||||
case BlitterMode::CrashRemap: Draw<BlitterMode::CrashRemap, RM_NONE, BT_NONE, true, true>(bp, zoom); return;
|
||||
case BlitterMode::BlackRemap: Draw<BlitterMode::BlackRemap, RM_NONE, BT_NONE, true, true>(bp, zoom); return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
||||
draw:;
|
||||
|
||||
switch (mode) {
|
||||
case BM_COLOUR_REMAP:
|
||||
case BlitterMode::ColourRemap:
|
||||
if (src_px->a == 255) {
|
||||
do {
|
||||
uint m = *src_n;
|
||||
@@ -142,7 +142,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_CRASH_REMAP:
|
||||
case BlitterMode::CrashRemap:
|
||||
if (src_px->a == 255) {
|
||||
do {
|
||||
uint m = *src_n;
|
||||
@@ -176,7 +176,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_BLACK_REMAP:
|
||||
case BlitterMode::BlackRemap:
|
||||
do {
|
||||
*dst = Colour(0, 0, 0);
|
||||
dst++;
|
||||
@@ -185,7 +185,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
||||
} while (--n != 0);
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT:
|
||||
case BlitterMode::Transparent:
|
||||
/* Make the current colour a bit more black, so it looks like this image is transparent */
|
||||
src_n += n;
|
||||
if (src_px->a == 255) {
|
||||
@@ -203,7 +203,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT_REMAP:
|
||||
case BlitterMode::TransparentRemap:
|
||||
/* Apply custom transparency remap. */
|
||||
src_n += n;
|
||||
if (src_px->a != 0) {
|
||||
@@ -261,12 +261,12 @@ void Blitter_32bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode,
|
||||
{
|
||||
switch (mode) {
|
||||
default: NOT_REACHED();
|
||||
case BM_NORMAL: Draw<BM_NORMAL, Tpal_to_rgb>(bp, zoom); return;
|
||||
case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP, Tpal_to_rgb>(bp, zoom); return;
|
||||
case BM_TRANSPARENT: Draw<BM_TRANSPARENT, Tpal_to_rgb>(bp, zoom); return;
|
||||
case BM_TRANSPARENT_REMAP: Draw<BM_TRANSPARENT_REMAP, Tpal_to_rgb>(bp, zoom); return;
|
||||
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP, Tpal_to_rgb>(bp, zoom); return;
|
||||
case BM_BLACK_REMAP: Draw<BM_BLACK_REMAP, Tpal_to_rgb>(bp, zoom); return;
|
||||
case BlitterMode::Normal: Draw<BlitterMode::Normal, Tpal_to_rgb>(bp, zoom); return;
|
||||
case BlitterMode::ColourRemap: Draw<BlitterMode::ColourRemap, Tpal_to_rgb>(bp, zoom); return;
|
||||
case BlitterMode::Transparent: Draw<BlitterMode::Transparent, Tpal_to_rgb>(bp, zoom); return;
|
||||
case BlitterMode::TransparentRemap: Draw<BlitterMode::TransparentRemap, Tpal_to_rgb>(bp, zoom); return;
|
||||
case BlitterMode::CrashRemap: Draw<BlitterMode::CrashRemap, Tpal_to_rgb>(bp, zoom); return;
|
||||
case BlitterMode::BlackRemap: Draw<BlitterMode::BlackRemap, Tpal_to_rgb>(bp, zoom); return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ void Blitter_32bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoo
|
||||
|
||||
for (int x = 0; x < bp->width; x++) {
|
||||
switch (mode) {
|
||||
case BM_COLOUR_REMAP:
|
||||
case BlitterMode::ColourRemap:
|
||||
/* In case the m-channel is zero, do not remap this pixel in any way */
|
||||
if (src->m == 0) {
|
||||
if (src->a != 0) *dst = ComposeColourRGBA(src->r, src->g, src->b, src->a, *dst);
|
||||
@@ -46,7 +46,7 @@ void Blitter_32bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoo
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_CRASH_REMAP:
|
||||
case BlitterMode::CrashRemap:
|
||||
if (src->m == 0) {
|
||||
if (src->a != 0) {
|
||||
uint8_t g = MakeDark(src->r, src->g, src->b);
|
||||
@@ -57,20 +57,20 @@ void Blitter_32bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoo
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_BLACK_REMAP:
|
||||
case BlitterMode::BlackRemap:
|
||||
if (src->a != 0) {
|
||||
*dst = Colour(0, 0, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT:
|
||||
case BlitterMode::Transparent:
|
||||
/* Make the current colour a bit more black, so it looks like this image is transparent */
|
||||
if (src->a != 0) {
|
||||
*dst = MakeTransparent(*dst, 192);
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT_REMAP:
|
||||
case BlitterMode::TransparentRemap:
|
||||
/* Apply custom transparency remap. */
|
||||
if (src->a != 0) {
|
||||
*dst = this->LookupColourInPalette(bp->remap[GetNearestColourIndex(*dst)]);
|
||||
|
||||
@@ -259,13 +259,13 @@ inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
for (int y = bp->height; y != 0; y--) {
|
||||
Colour *dst = dst_line;
|
||||
const Colour *src = src_rgba_line + META_LENGTH;
|
||||
if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP) src_mv = src_mv_line;
|
||||
if (mode == BlitterMode::ColourRemap || mode == BlitterMode::CrashRemap) src_mv = src_mv_line;
|
||||
|
||||
if (read_mode == RM_WITH_MARGIN) {
|
||||
assert(bt_last == BT_NONE); // or you must ensure block type is preserved
|
||||
src += src_rgba_line[0].data;
|
||||
dst += src_rgba_line[0].data;
|
||||
if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP) src_mv += src_rgba_line[0].data;
|
||||
if (mode == BlitterMode::ColourRemap || mode == BlitterMode::CrashRemap) src_mv += src_rgba_line[0].data;
|
||||
const int width_diff = si->sprite_width - bp->width;
|
||||
effective_width = bp->width - (int) src_rgba_line[0].data;
|
||||
const int delta_diff = (int) src_rgba_line[1].data - width_diff;
|
||||
@@ -300,7 +300,7 @@ inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_COLOUR_REMAP:
|
||||
case BlitterMode::ColourRemap:
|
||||
#if (SSE_VERSION >= 3)
|
||||
for (uint x = (uint) effective_width / 2; x > 0; x--) {
|
||||
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
|
||||
@@ -382,7 +382,7 @@ bmcr_alpha_blend_single:
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT:
|
||||
case BlitterMode::Transparent:
|
||||
/* Make the current colour a bit more black, so it looks like this image is transparent. */
|
||||
for (uint x = (uint) bp->width / 2; x > 0; x--) {
|
||||
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
|
||||
@@ -399,7 +399,7 @@ bmcr_alpha_blend_single:
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT_REMAP:
|
||||
case BlitterMode::TransparentRemap:
|
||||
/* Apply custom transparency remap. */
|
||||
for (uint x = (uint) bp->width; x > 0; x--) {
|
||||
if (src->a != 0) {
|
||||
@@ -411,7 +411,7 @@ bmcr_alpha_blend_single:
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_CRASH_REMAP:
|
||||
case BlitterMode::CrashRemap:
|
||||
for (uint x = (uint) bp->width; x > 0; x--) {
|
||||
if (src_mv->m == 0) {
|
||||
if (src->a != 0) {
|
||||
@@ -428,7 +428,7 @@ bmcr_alpha_blend_single:
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_BLACK_REMAP:
|
||||
case BlitterMode::BlackRemap:
|
||||
for (uint x = (uint) bp->width; x > 0; x--) {
|
||||
if (src->a != 0) {
|
||||
*dst = Colour(0, 0, 0);
|
||||
@@ -441,7 +441,7 @@ bmcr_alpha_blend_single:
|
||||
}
|
||||
|
||||
next_line:
|
||||
if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP) src_mv_line += si->sprite_width;
|
||||
if (mode == BlitterMode::ColourRemap || mode == BlitterMode::CrashRemap) src_mv_line += si->sprite_width;
|
||||
src_rgba_line = (const Colour*) ((const uint8_t*) src_rgba_line + si->sprite_line_size);
|
||||
dst_line += bp->pitch;
|
||||
}
|
||||
@@ -469,30 +469,30 @@ void Blitter_32bppSSE4::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL
|
||||
bm_normal:
|
||||
const BlockType bt_last = (BlockType) (bp->width & 1);
|
||||
switch (bt_last) {
|
||||
default: Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN, true>(bp, zoom); return;
|
||||
case BT_ODD: Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD, true>(bp, zoom); return;
|
||||
default: Draw<BlitterMode::Normal, RM_WITH_SKIP, BT_EVEN, true>(bp, zoom); return;
|
||||
case BT_ODD: Draw<BlitterMode::Normal, RM_WITH_SKIP, BT_ODD, true>(bp, zoom); return;
|
||||
}
|
||||
} else {
|
||||
if (((const Blitter_32bppSSE_Base::SpriteData *) bp->sprite)->flags & SF_TRANSLUCENT) {
|
||||
Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true>(bp, zoom);
|
||||
Draw<BlitterMode::Normal, RM_WITH_MARGIN, BT_NONE, true>(bp, zoom);
|
||||
} else {
|
||||
Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, false>(bp, zoom);
|
||||
Draw<BlitterMode::Normal, RM_WITH_MARGIN, BT_NONE, false>(bp, zoom);
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BM_COLOUR_REMAP:
|
||||
case BlitterMode::ColourRemap:
|
||||
if (((const Blitter_32bppSSE_Base::SpriteData *) bp->sprite)->flags & SF_NO_REMAP) goto bm_normal;
|
||||
if (bp->skip_left != 0 || bp->width <= MARGIN_REMAP_THRESHOLD) {
|
||||
Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE, true>(bp, zoom); return;
|
||||
Draw<BlitterMode::ColourRemap, RM_WITH_SKIP, BT_NONE, true>(bp, zoom); return;
|
||||
} else {
|
||||
Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE, true>(bp, zoom); return;
|
||||
Draw<BlitterMode::ColourRemap, RM_WITH_MARGIN, BT_NONE, true>(bp, zoom); return;
|
||||
}
|
||||
case BM_TRANSPARENT: Draw<BM_TRANSPARENT, RM_NONE, BT_NONE, true>(bp, zoom); return;
|
||||
case BM_TRANSPARENT_REMAP: Draw<BM_TRANSPARENT_REMAP, RM_NONE, BT_NONE, true>(bp, zoom); return;
|
||||
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP, RM_NONE, BT_NONE, true>(bp, zoom); return;
|
||||
case BM_BLACK_REMAP: Draw<BM_BLACK_REMAP, RM_NONE, BT_NONE, true>(bp, zoom); return;
|
||||
case BlitterMode::Transparent: Draw<BlitterMode::Transparent, RM_NONE, BT_NONE, true>(bp, zoom); return;
|
||||
case BlitterMode::TransparentRemap: Draw<BlitterMode::TransparentRemap, RM_NONE, BT_NONE, true>(bp, zoom); return;
|
||||
case BlitterMode::CrashRemap: Draw<BlitterMode::CrashRemap, RM_NONE, BT_NONE, true>(bp, zoom); return;
|
||||
case BlitterMode::BlackRemap: Draw<BlitterMode::BlackRemap, RM_NONE, BT_NONE, true>(bp, zoom); return;
|
||||
}
|
||||
}
|
||||
#endif /* FULL_ANIMATION */
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
#endif
|
||||
|
||||
#define META_LENGTH 2 ///< Number of uint32_t inserted before each line of pixels in a sprite.
|
||||
#define MARGIN_NORMAL_THRESHOLD (zoom == ZOOM_LVL_OUT_8X ? 8 : 4) ///< Minimum width to use margins with BM_NORMAL.
|
||||
#define MARGIN_REMAP_THRESHOLD 4 ///< Minimum width to use margins with BM_COLOUR_REMAP.
|
||||
#define MARGIN_NORMAL_THRESHOLD (zoom == ZOOM_LVL_OUT_8X ? 8 : 4) ///< Minimum width to use margins with BlitterMode::Normal.
|
||||
#define MARGIN_REMAP_THRESHOLD 4 ///< Minimum width to use margins with BlitterMode::ColourRemap.
|
||||
|
||||
#undef ALIGN
|
||||
|
||||
|
||||
@@ -181,14 +181,14 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
draw:;
|
||||
|
||||
switch (mode) {
|
||||
case BM_COLOUR_REMAP:
|
||||
case BM_CRASH_REMAP:
|
||||
case BlitterMode::ColourRemap:
|
||||
case BlitterMode::CrashRemap:
|
||||
if (src_px->a == 255) {
|
||||
do {
|
||||
uint8_t m = GB(*src_n, 0, 8);
|
||||
/* In case the m-channel is zero, only apply the crash remap by darkening the RGB colour. */
|
||||
if (m == 0) {
|
||||
*dst = mode == BM_CRASH_REMAP ? this->MakeDark(*src_px) : *src_px;
|
||||
*dst = mode == BlitterMode::CrashRemap ? this->MakeDark(*src_px) : *src_px;
|
||||
*anim = 0;
|
||||
} else {
|
||||
uint r = remap[m];
|
||||
@@ -207,7 +207,7 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
uint8_t m = GB(*src_n, 0, 8);
|
||||
Colour b = this->RealizeBlendedColour(*anim, *dst);
|
||||
if (m == 0) {
|
||||
Colour c = mode == BM_CRASH_REMAP ? this->MakeDark(*src_px) : *src_px;
|
||||
Colour c = mode == BlitterMode::CrashRemap ? this->MakeDark(*src_px) : *src_px;
|
||||
*dst = this->ComposeColourRGBANoCheck(c.r, c.g, c.b, src_px->a, b);
|
||||
*anim = 0;
|
||||
} else {
|
||||
@@ -225,7 +225,7 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_BLACK_REMAP:
|
||||
case BlitterMode::BlackRemap:
|
||||
do {
|
||||
*anim++ = 0;
|
||||
*dst++ = _black_colour;
|
||||
@@ -234,7 +234,7 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
} while (--n != 0);
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT:
|
||||
case BlitterMode::Transparent:
|
||||
/* Make the current colour a bit more black, so it looks like this image is transparent */
|
||||
src_n += n;
|
||||
if (src_px->a == 255) {
|
||||
@@ -260,7 +260,7 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT_REMAP:
|
||||
case BlitterMode::TransparentRemap:
|
||||
/* Apply custom transparency remap. */
|
||||
src_n += n;
|
||||
if (src_px->a != 0) {
|
||||
@@ -339,12 +339,12 @@ void Blitter_40bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL
|
||||
|
||||
switch (mode) {
|
||||
default: NOT_REACHED();
|
||||
case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom); return;
|
||||
case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP>(bp, zoom); return;
|
||||
case BM_TRANSPARENT: Draw<BM_TRANSPARENT> (bp, zoom); return;
|
||||
case BM_TRANSPARENT_REMAP: Draw<BM_TRANSPARENT_REMAP>(bp, zoom); return;
|
||||
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP> (bp, zoom); return;
|
||||
case BM_BLACK_REMAP: Draw<BM_BLACK_REMAP> (bp, zoom); return;
|
||||
case BlitterMode::Normal: Draw<BlitterMode::Normal>(bp, zoom); return;
|
||||
case BlitterMode::ColourRemap: Draw<BlitterMode::ColourRemap>(bp, zoom); return;
|
||||
case BlitterMode::Transparent: Draw<BlitterMode::Transparent>(bp, zoom); return;
|
||||
case BlitterMode::TransparentRemap: Draw<BlitterMode::TransparentRemap>(bp, zoom); return;
|
||||
case BlitterMode::CrashRemap: Draw<BlitterMode::CrashRemap>(bp, zoom); return;
|
||||
case BlitterMode::BlackRemap: Draw<BlitterMode::BlackRemap>(bp, zoom); return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,8 @@ void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Z
|
||||
width -= pixels;
|
||||
|
||||
switch (mode) {
|
||||
case BM_COLOUR_REMAP:
|
||||
case BM_CRASH_REMAP: {
|
||||
case BlitterMode::ColourRemap:
|
||||
case BlitterMode::CrashRemap: {
|
||||
const uint8_t *remap = bp->remap;
|
||||
do {
|
||||
uint m = remap[*src];
|
||||
@@ -95,13 +95,13 @@ void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Z
|
||||
break;
|
||||
}
|
||||
|
||||
case BM_BLACK_REMAP:
|
||||
case BlitterMode::BlackRemap:
|
||||
MemSetT(dst, 0, pixels);
|
||||
dst += pixels;
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT:
|
||||
case BM_TRANSPARENT_REMAP: {
|
||||
case BlitterMode::Transparent:
|
||||
case BlitterMode::TransparentRemap: {
|
||||
const uint8_t *remap = bp->remap;
|
||||
src += pixels;
|
||||
do {
|
||||
|
||||
@@ -36,17 +36,17 @@ void Blitter_8bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoom
|
||||
uint colour = 0;
|
||||
|
||||
switch (mode) {
|
||||
case BM_COLOUR_REMAP:
|
||||
case BM_CRASH_REMAP:
|
||||
case BlitterMode::ColourRemap:
|
||||
case BlitterMode::CrashRemap:
|
||||
colour = bp->remap[*src];
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT:
|
||||
case BM_TRANSPARENT_REMAP:
|
||||
case BlitterMode::Transparent:
|
||||
case BlitterMode::TransparentRemap:
|
||||
if (*src != 0) colour = bp->remap[*dst];
|
||||
break;
|
||||
|
||||
case BM_BLACK_REMAP:
|
||||
case BlitterMode::BlackRemap:
|
||||
if (*src != 0) *dst = 0;
|
||||
break;
|
||||
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
#include "../spriteloader/spriteloader.hpp"
|
||||
|
||||
/** The modes of blitting we can do. */
|
||||
enum BlitterMode {
|
||||
BM_NORMAL, ///< Perform the simple blitting.
|
||||
BM_COLOUR_REMAP, ///< Perform a colour remapping.
|
||||
BM_TRANSPARENT, ///< Perform transparency darkening remapping.
|
||||
BM_TRANSPARENT_REMAP, ///< Perform transparency colour remapping.
|
||||
BM_CRASH_REMAP, ///< Perform a crash remapping.
|
||||
BM_BLACK_REMAP, ///< Perform remapping to a completely blackened sprite
|
||||
enum class BlitterMode : uint8_t {
|
||||
Normal, ///< Perform the simple blitting.
|
||||
ColourRemap, ///< Perform a colour remapping.
|
||||
Transparent, ///< Perform transparency darkening remapping.
|
||||
TransparentRemap, ///< Perform transparency colour remapping.
|
||||
CrashRemap, ///< Perform a crash remapping.
|
||||
BlackRemap, ///< Perform remapping to a completely blackened sprite
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user