mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-10 13:29:56 +00:00
Fix for when VideoMode = {Text_Optimized | TV} in 50% scanline mode:
. RGB arithmetic could underflow . Now clamp to zero (ToDo: consider using SIMD)
This commit is contained in:
parent
99219a71ec
commit
ad55b0f136
@ -573,7 +573,16 @@ inline void updateFramebufferColorTVSingleScanline( uint16_t signal, bgra_t *pTa
|
||||
|
||||
const uint32_t color0 = getScanlineColor( signal, pTable );
|
||||
const uint32_t color2 = *pLine2Address;
|
||||
const uint32_t color1 = color0 - ((color2 & 0x00fcfcfc) >> 2); // BUG? color0 - color0? not color0-color2?
|
||||
// const uint32_t color1 = color0 - ((color2 & 0x00fcfcfc) >> 2); // BUG? color0 - color0? not color0-color2?
|
||||
// TC: The above operation "color0 - ((color2 & 0x00fcfcfc) >> 2)" causes underflow, so I've recoded to clamp on underflow:
|
||||
{
|
||||
int r=(color0>>16)&0xff, g=(color0>>8)&0xff, b=color0&0xff;
|
||||
uint32_t color2_prime = (color2 & 0x00fcfcfc) >> 2;
|
||||
r -= (color2_prime>>16)&0xff; if (r<0) r=0; // clamp to 0 on underflow
|
||||
g -= (color2_prime>>8)&0xff; if (g<0) g=0; // clamp to 0 on underflow
|
||||
b -= (color2_prime)&0xff; if (b<0) b=0; // clamp to 0 on underflow
|
||||
const uint32_t color1 = (r<<16)|(g<<8)|(b);
|
||||
}
|
||||
|
||||
/* */ *pLine1Address = color1 | ALPHA32_MASK;
|
||||
/* */ *pLine0Address = color0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user