- fixed: Add light diminishing to true-color stencil drawers

- fixed: Non-SSE AddClampShadedBgra (stencil) drawer did not handle overflows
This commit is contained in:
Rachael Alexanderson 2017-06-04 12:46:39 -04:00
parent 62374cf3bc
commit 5185ebbc28
2 changed files with 6 additions and 6 deletions

View file

@ -194,7 +194,7 @@ namespace swrenderer
uint32_t srcalpha = args.SrcAlpha() >> (FRACBITS - 8); uint32_t srcalpha = args.SrcAlpha() >> (FRACBITS - 8);
uint32_t destalpha = args.DestAlpha() >> (FRACBITS - 8); uint32_t destalpha = args.DestAlpha() >> (FRACBITS - 8);
uint32_t srccolor = args.SrcColorBgra(); uint32_t srccolor = args.SrcColorBgra();
uint32_t color = LightBgra::shade_bgra_simple(args.SolidColorBgra() && 0xffffff, uint32_t color = LightBgra::shade_bgra_simple(args.SolidColorBgra(),
LightBgra::calc_light_multiplier(light)); LightBgra::calc_light_multiplier(light));
for (int index = 0; index < count; index++) for (int index = 0; index < count; index++)
@ -291,7 +291,7 @@ namespace swrenderer
{ {
using namespace DrawSprite32TModes; using namespace DrawSprite32TModes;
if (BlendT::Mode == (int)SpriteBlendModes::Copy || BlendT::Mode == (int)SpriteBlendModes::Shaded) if (BlendT::Mode == (int)SpriteBlendModes::Copy)
return fgcolor; return fgcolor;
if (ShadeModeT::Mode == (int)ShadeMode::Simple) if (ShadeModeT::Mode == (int)ShadeMode::Simple)
@ -341,9 +341,9 @@ namespace swrenderer
{ {
uint32_t alpha = ifgshade; uint32_t alpha = ifgshade;
BgraColor outcolor; BgraColor outcolor;
outcolor.r = ((fgcolor.r * alpha) >> 8) + bgcolor.r; outcolor.r = MIN<uint32_t>(((fgcolor.r * alpha) >> 8) + bgcolor.r, 255);
outcolor.g = ((fgcolor.g * alpha) >> 8) + bgcolor.g; outcolor.g = MIN<uint32_t>(((fgcolor.g * alpha) >> 8) + bgcolor.g, 255);
outcolor.b = ((fgcolor.b * alpha) >> 8) + bgcolor.b; outcolor.b = MIN<uint32_t>(((fgcolor.b * alpha) >> 8) + bgcolor.b, 255);
outcolor.a = 255; outcolor.a = 255;
return outcolor; return outcolor;
} }

View file

@ -326,7 +326,7 @@ namespace swrenderer
{ {
using namespace DrawSprite32TModes; using namespace DrawSprite32TModes;
if (BlendT::Mode == (int)SpriteBlendModes::Copy || BlendT::Mode == (int)SpriteBlendModes::Shaded) if (BlendT::Mode == (int)SpriteBlendModes::Copy)
return fgcolor; return fgcolor;
if (ShadeModeT::Mode == (int)ShadeMode::Simple) if (ShadeModeT::Mode == (int)ShadeMode::Simple)