- fixed a crash

- tried to make MAKETRANSDOT algorithm more consistent with original
This commit is contained in:
Rachael Alexanderson 2016-12-24 19:22:31 -05:00
parent 564bfe482c
commit 8231032f89
2 changed files with 21 additions and 9 deletions

View File

@ -70,6 +70,7 @@ CUSTOM_CVAR(Int, uiscale, 2, CVAR_ARCHIVE | CVAR_NOINITCALL)
StatusBar->ScreenSizeChanged();
}
}
EXTERN_CVAR(Bool, r_blendmethod)
// [RH] Stretch values to make a 320x200 image best fit the screen
// without using fractional steppings
@ -1009,17 +1010,17 @@ void DCanvas::PUTTRANSDOT (int xx, int yy, int basecolor, int level)
uint32_t *spot = (uint32_t*)GetBuffer() + oldyyshifted + xx;
uint32_t fg = swrenderer::LightBgra::shade_pal_index_simple(basecolor, swrenderer::LightBgra::calc_light_multiplier(0));
uint32_t fg_red = (fg >> 16) & 0xff;
uint32_t fg_green = (fg >> 8) & 0xff;
uint32_t fg_blue = fg & 0xff;
uint32_t fg_red = (((fg >> 16) & 0xff) * (63 - level)) >> 6;
uint32_t fg_green = (((fg >> 8) & 0xff) * (63 - level)) >> 6;
uint32_t fg_blue = ((fg & 0xff) * (63 - level)) >> 6;
uint32_t bg_red = (*spot >> 16) & 0xff;
uint32_t bg_green = (*spot >> 8) & 0xff;
uint32_t bg_blue = (*spot) & 0xff;
uint32_t bg_red = (((*spot >> 16) & 0xff) * level) >> 6;
uint32_t bg_green = (((*spot >> 8) & 0xff) * level) >> 6;
uint32_t bg_blue = (((*spot) & 0xff) * level) >> 6;
uint32_t red = (fg_red + bg_red + 1) / 2;
uint32_t green = (fg_green + bg_green + 1) / 2;
uint32_t blue = (fg_blue + bg_blue + 1) / 2;
uint32_t red = fg_red + bg_red;
uint32_t green = fg_green + bg_green;
uint32_t blue = fg_blue + bg_blue;
*spot = 0xff000000 | (red << 16) | (green << 8) | blue;
}

View File

@ -424,6 +424,17 @@ void DCanvas::Dim (PalEntry color, float damount, int x1, int y1, int w, int h)
if (!r_blendmethod)
{
{
int amount;
amount = (int)(damount * 64);
bg2rgb = Col2RGB8[64 - amount];
fg = (((color.r * amount) >> 4) << 20) |
((color.g * amount) >> 4) |
(((color.b * amount) >> 4) << 10);
}
for (y = h; y != 0; y--)
{
for (x = w; x != 0; x--)