- fixed: Sometimes it helps to stay positive. Especially when deciding whether to add or subtract the background in the span drawers.

This commit is contained in:
Rachael Alexanderson 2016-12-19 03:51:54 -05:00
parent b7629fcf0e
commit c7d4d7cd1d

View file

@ -1994,9 +1994,9 @@ namespace swrenderer
spot = ((xfrac >> (32 - 6 - 6))&(63 * 64)) + (yfrac >> (32 - 6)); spot = ((xfrac >> (32 - 6 - 6))&(63 * 64)) + (yfrac >> (32 - 6));
uint32_t fg = colormap[source[spot]]; uint32_t fg = colormap[source[spot]];
uint32_t bg = *dest; uint32_t bg = *dest;
int r = MAX((palette[fg].r * _srcalpha - palette[bg].r * _destalpha)>>18, 0); int r = MAX((palette[fg].r * _srcalpha + palette[bg].r * _destalpha)>>18, 0);
int g = MAX((palette[fg].g * _srcalpha - palette[bg].g * _destalpha)>>18, 0); int g = MAX((palette[fg].g * _srcalpha + palette[bg].g * _destalpha)>>18, 0);
int b = MAX((palette[fg].b * _srcalpha - palette[bg].b * _destalpha)>>18, 0); int b = MAX((palette[fg].b * _srcalpha + palette[bg].b * _destalpha)>>18, 0);
*dest++ = RGB256k.RGB[r][g][b]; *dest++ = RGB256k.RGB[r][g][b];
xfrac += xstep; xfrac += xstep;
@ -2013,9 +2013,9 @@ namespace swrenderer
spot = ((xfrac >> xshift) & xmask) + (yfrac >> yshift); spot = ((xfrac >> xshift) & xmask) + (yfrac >> yshift);
uint32_t fg = colormap[source[spot]]; uint32_t fg = colormap[source[spot]];
uint32_t bg = *dest; uint32_t bg = *dest;
int r = MAX((palette[fg].r * _srcalpha - palette[bg].r * _destalpha)>>18, 0); int r = MAX((palette[fg].r * _srcalpha + palette[bg].r * _destalpha)>>18, 0);
int g = MAX((palette[fg].g * _srcalpha - palette[bg].g * _destalpha)>>18, 0); int g = MAX((palette[fg].g * _srcalpha + palette[bg].g * _destalpha)>>18, 0);
int b = MAX((palette[fg].b * _srcalpha - palette[bg].b * _destalpha)>>18, 0); int b = MAX((palette[fg].b * _srcalpha + palette[bg].b * _destalpha)>>18, 0);
*dest++ = RGB256k.RGB[r][g][b]; *dest++ = RGB256k.RGB[r][g][b];
xfrac += xstep; xfrac += xstep;
@ -2064,9 +2064,9 @@ namespace swrenderer
{ {
uint32_t fg = colormap[texdata]; uint32_t fg = colormap[texdata];
uint32_t bg = *dest; uint32_t bg = *dest;
int r = MAX((palette[fg].r * _srcalpha - palette[bg].r * _destalpha)>>18, 0); int r = MAX((palette[fg].r * _srcalpha + palette[bg].r * _destalpha)>>18, 0);
int g = MAX((palette[fg].g * _srcalpha - palette[bg].g * _destalpha)>>18, 0); int g = MAX((palette[fg].g * _srcalpha + palette[bg].g * _destalpha)>>18, 0);
int b = MAX((palette[fg].b * _srcalpha - palette[bg].b * _destalpha)>>18, 0); int b = MAX((palette[fg].b * _srcalpha + palette[bg].b * _destalpha)>>18, 0);
*dest = RGB256k.RGB[r][g][b]; *dest = RGB256k.RGB[r][g][b];
} }
dest++; dest++;
@ -2089,9 +2089,9 @@ namespace swrenderer
{ {
uint32_t fg = colormap[texdata]; uint32_t fg = colormap[texdata];
uint32_t bg = *dest; uint32_t bg = *dest;
int r = MAX((palette[fg].r * _srcalpha - palette[bg].r * _destalpha)>>18, 0); int r = MAX((palette[fg].r * _srcalpha + palette[bg].r * _destalpha)>>18, 0);
int g = MAX((palette[fg].g * _srcalpha - palette[bg].g * _destalpha)>>18, 0); int g = MAX((palette[fg].g * _srcalpha + palette[bg].g * _destalpha)>>18, 0);
int b = MAX((palette[fg].b * _srcalpha - palette[bg].b * _destalpha)>>18, 0); int b = MAX((palette[fg].b * _srcalpha + palette[bg].b * _destalpha)>>18, 0);
*dest = RGB256k.RGB[r][g][b]; *dest = RGB256k.RGB[r][g][b];
} }
dest++; dest++;
@ -2135,9 +2135,9 @@ namespace swrenderer
spot = ((xfrac >> (32 - 6 - 6))&(63 * 64)) + (yfrac >> (32 - 6)); spot = ((xfrac >> (32 - 6 - 6))&(63 * 64)) + (yfrac >> (32 - 6));
uint32_t fg = colormap[source[spot]]; uint32_t fg = colormap[source[spot]];
uint32_t bg = *dest; uint32_t bg = *dest;
int r = MAX((palette[fg].r * _srcalpha - palette[bg].r * _destalpha)>>18, 0); int r = MAX((palette[fg].r * _srcalpha + palette[bg].r * _destalpha)>>18, 0);
int g = MAX((palette[fg].g * _srcalpha - palette[bg].g * _destalpha)>>18, 0); int g = MAX((palette[fg].g * _srcalpha + palette[bg].g * _destalpha)>>18, 0);
int b = MAX((palette[fg].b * _srcalpha - palette[bg].b * _destalpha)>>18, 0); int b = MAX((palette[fg].b * _srcalpha + palette[bg].b * _destalpha)>>18, 0);
*dest++ = RGB256k.RGB[r][g][b]; *dest++ = RGB256k.RGB[r][g][b];
xfrac += xstep; xfrac += xstep;
@ -2154,9 +2154,9 @@ namespace swrenderer
spot = ((xfrac >> xshift) & xmask) + (yfrac >> yshift); spot = ((xfrac >> xshift) & xmask) + (yfrac >> yshift);
uint32_t fg = colormap[source[spot]]; uint32_t fg = colormap[source[spot]];
uint32_t bg = *dest; uint32_t bg = *dest;
int r = MAX((palette[fg].r * _srcalpha - palette[bg].r * _destalpha)>>18, 0); int r = MAX((palette[fg].r * _srcalpha + palette[bg].r * _destalpha)>>18, 0);
int g = MAX((palette[fg].g * _srcalpha - palette[bg].g * _destalpha)>>18, 0); int g = MAX((palette[fg].g * _srcalpha + palette[bg].g * _destalpha)>>18, 0);
int b = MAX((palette[fg].b * _srcalpha - palette[bg].b * _destalpha)>>18, 0); int b = MAX((palette[fg].b * _srcalpha + palette[bg].b * _destalpha)>>18, 0);
*dest++ = RGB256k.RGB[r][g][b]; *dest++ = RGB256k.RGB[r][g][b];
xfrac += xstep; xfrac += xstep;
@ -2204,9 +2204,9 @@ namespace swrenderer
{ {
uint32_t fg = colormap[texdata]; uint32_t fg = colormap[texdata];
uint32_t bg = *dest; uint32_t bg = *dest;
int r = MAX((palette[fg].r * _srcalpha - palette[bg].r * _destalpha)>>18, 0); int r = MAX((palette[fg].r * _srcalpha + palette[bg].r * _destalpha)>>18, 0);
int g = MAX((palette[fg].g * _srcalpha - palette[bg].g * _destalpha)>>18, 0); int g = MAX((palette[fg].g * _srcalpha + palette[bg].g * _destalpha)>>18, 0);
int b = MAX((palette[fg].b * _srcalpha - palette[bg].b * _destalpha)>>18, 0); int b = MAX((palette[fg].b * _srcalpha + palette[bg].b * _destalpha)>>18, 0);
*dest = RGB256k.RGB[r][g][b]; *dest = RGB256k.RGB[r][g][b];
} }
dest++; dest++;
@ -2229,9 +2229,9 @@ namespace swrenderer
{ {
uint32_t fg = colormap[texdata]; uint32_t fg = colormap[texdata];
uint32_t bg = *dest; uint32_t bg = *dest;
int r = MAX((palette[fg].r * _srcalpha - palette[bg].r * _destalpha)>>18, 0); int r = MAX((palette[fg].r * _srcalpha + palette[bg].r * _destalpha)>>18, 0);
int g = MAX((palette[fg].g * _srcalpha - palette[bg].g * _destalpha)>>18, 0); int g = MAX((palette[fg].g * _srcalpha + palette[bg].g * _destalpha)>>18, 0);
int b = MAX((palette[fg].b * _srcalpha - palette[bg].b * _destalpha)>>18, 0); int b = MAX((palette[fg].b * _srcalpha + palette[bg].b * _destalpha)>>18, 0);
*dest = RGB256k.RGB[r][g][b]; *dest = RGB256k.RGB[r][g][b];
} }
dest++; dest++;