mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-12-02 08:22:25 +00:00
- more work on rgb666
This commit is contained in:
parent
6235b12cfc
commit
9fbd9985c8
3 changed files with 72 additions and 172 deletions
|
@ -314,17 +314,10 @@ namespace swrenderer
|
|||
uint8_t pix = source[frac >> bits];
|
||||
if (pix != 0)
|
||||
{
|
||||
#ifdef NO_RGB666
|
||||
uint32_t fg = fg2rgb[colormap[pix]];
|
||||
uint32_t bg = bg2rgb[*dest];
|
||||
fg = (fg + bg) | 0x1f07c1f;
|
||||
*dest = RGB32k.All[fg & (fg >> 15)];
|
||||
#else
|
||||
uint32_t r = MIN(GPalette.BaseColors[colormap[pix]].r + GPalette.BaseColors[*dest].r, 255);
|
||||
uint32_t g = MIN(GPalette.BaseColors[colormap[pix]].g + GPalette.BaseColors[*dest].g, 255);
|
||||
uint32_t b = MIN(GPalette.BaseColors[colormap[pix]].b + GPalette.BaseColors[*dest].b, 255);
|
||||
*dest = RGB256k.RGB[r>>2][g>>2][b>>2];
|
||||
#endif
|
||||
}
|
||||
frac += fracstep;
|
||||
dest += pitch;
|
||||
|
@ -364,17 +357,10 @@ namespace swrenderer
|
|||
uint8_t pix = _bufplce[i][vplce[i] >> bits];
|
||||
if (pix != 0)
|
||||
{
|
||||
#ifdef NO_RGB666
|
||||
uint32_t fg = fg2rgb[_palookupoffse[i][pix]];
|
||||
uint32_t bg = bg2rgb[dest[i]];
|
||||
fg = (fg + bg) | 0x1f07c1f;
|
||||
dest[i] = RGB32k.All[fg & (fg >> 15)];
|
||||
#else
|
||||
uint32_t r = MIN(GPalette.BaseColors[_palookupoffse[i][pix]].r + GPalette.BaseColors[dest[i]].r, 255);
|
||||
uint32_t g = MIN(GPalette.BaseColors[_palookupoffse[i][pix]].g + GPalette.BaseColors[dest[i]].g, 255);
|
||||
uint32_t b = MIN(GPalette.BaseColors[_palookupoffse[i][pix]].b + GPalette.BaseColors[dest[i]].b, 255);
|
||||
dest[i] = RGB256k.RGB[r>>2][g>>2][b>>2];
|
||||
#endif
|
||||
}
|
||||
vplce[i] += vince[i];
|
||||
}
|
||||
|
@ -617,21 +603,10 @@ namespace swrenderer
|
|||
uint8_t pix = _bufplce[i][vplce[i] >> bits];
|
||||
if (pix != 0)
|
||||
{
|
||||
#ifdef NO_RGB666
|
||||
uint32_t a = (bg2rgb[dest[i]] | 0x40100400) - fg2rgb[_palookupoffse[i][pix]];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
dest[i] = RGB32k.All[a & (a >> 15)];
|
||||
#else
|
||||
uint32_t r = clamp(GPalette.BaseColors[_palookupoffse[i][pix]].r - GPalette.BaseColors[dest[i]].r, 0, 255);
|
||||
uint32_t g = clamp(GPalette.BaseColors[_palookupoffse[i][pix]].g - GPalette.BaseColors[dest[i]].g, 0, 255);
|
||||
uint32_t b = clamp(GPalette.BaseColors[_palookupoffse[i][pix]].b - GPalette.BaseColors[dest[i]].b, 0, 255);
|
||||
dest[i] = RGB256k.RGB[r>>2][g>>2][b>>2];
|
||||
#endif
|
||||
}
|
||||
vplce[i] += vince[i];
|
||||
}
|
||||
|
@ -715,11 +690,7 @@ namespace swrenderer
|
|||
c_red = (c_red * alpha_bottom + solid_bottom_r * inv_alpha_bottom) >> 8;
|
||||
c_green = (c_green * alpha_bottom + solid_bottom_g * inv_alpha_bottom) >> 8;
|
||||
c_blue = (c_blue * alpha_bottom + solid_bottom_b * inv_alpha_bottom) >> 8;
|
||||
#ifdef NO_RGB666
|
||||
*dest = RGB32k.RGB[(c_red >> 3)][(c_green >> 3)][(c_blue >> 3)];
|
||||
#else
|
||||
*dest = RGB256k.RGB[(c_red >> 2)][(c_green >> 2)][(c_blue >> 2)];
|
||||
#endif
|
||||
}
|
||||
|
||||
frac += fracstep;
|
||||
|
@ -747,13 +718,8 @@ namespace swrenderer
|
|||
int solid_bottom_r = RPART(solid_bottom);
|
||||
int solid_bottom_g = GPART(solid_bottom);
|
||||
int solid_bottom_b = BPART(solid_bottom);
|
||||
#ifdef NO_RGB666
|
||||
uint32_t solid_top_fill = RGB32k.RGB[(solid_top_r >> 3)][(solid_top_g >> 3)][(solid_top_b >> 3)];
|
||||
uint32_t solid_bottom_fill = RGB32k.RGB[(solid_bottom_r >> 3)][(solid_bottom_g >> 3)][(solid_bottom_b >> 3)];
|
||||
#else
|
||||
uint32_t solid_top_fill = RGB256k.RGB[(solid_top_r >> 2)][(solid_top_g >> 2)][(solid_top_b >> 2)];
|
||||
uint32_t solid_bottom_fill = RGB256k.RGB[(solid_bottom_r >> 2)][(solid_bottom_g >> 2)][(solid_bottom_b >> 2)];
|
||||
#endif
|
||||
solid_top_fill = (solid_top_fill << 24) | (solid_top_fill << 16) | (solid_top_fill << 8) | solid_top_fill;
|
||||
solid_bottom_fill = (solid_bottom_fill << 24) | (solid_bottom_fill << 16) | (solid_bottom_fill << 8) | solid_bottom_fill;
|
||||
|
||||
|
@ -813,11 +779,7 @@ namespace swrenderer
|
|||
c_red = (c_red * alpha_top + solid_top_r * inv_alpha_top) >> 8;
|
||||
c_green = (c_green * alpha_top + solid_top_g * inv_alpha_top) >> 8;
|
||||
c_blue = (c_blue * alpha_top + solid_top_b * inv_alpha_top) >> 8;
|
||||
#ifdef NO_RGB666
|
||||
output[col] = RGB32k.RGB[(c_red >> 3)][(c_green >> 3)][(c_blue >> 3)];
|
||||
#else
|
||||
output[col] = RGB256k.RGB[(c_red >> 2)][(c_green >> 2)][(c_blue >> 2)];
|
||||
#endif
|
||||
frac[col] += fracstep[col];
|
||||
}
|
||||
*((uint32_t*)dest) = *((uint32_t*)output);
|
||||
|
@ -858,11 +820,7 @@ namespace swrenderer
|
|||
c_red = (c_red * alpha_bottom + solid_bottom_r * inv_alpha_bottom) >> 8;
|
||||
c_green = (c_green * alpha_bottom + solid_bottom_g * inv_alpha_bottom) >> 8;
|
||||
c_blue = (c_blue * alpha_bottom + solid_bottom_b * inv_alpha_bottom) >> 8;
|
||||
#ifdef NO_RGB666
|
||||
output[col] = RGB32k.RGB[(c_red >> 3)][(c_green >> 3)][(c_blue >> 3)];
|
||||
#else
|
||||
output[col] = RGB256k.RGB[(c_red >> 2)][(c_green >> 2)][(c_blue >> 2)];
|
||||
#endif
|
||||
|
||||
frac[col] += fracstep[col];
|
||||
}
|
||||
|
@ -944,11 +902,7 @@ namespace swrenderer
|
|||
c_red = (c_red * alpha_bottom + solid_bottom_r * inv_alpha_bottom) >> 8;
|
||||
c_green = (c_green * alpha_bottom + solid_bottom_g * inv_alpha_bottom) >> 8;
|
||||
c_blue = (c_blue * alpha_bottom + solid_bottom_b * inv_alpha_bottom) >> 8;
|
||||
#ifdef NO_RGB666
|
||||
*dest = RGB32k.RGB[(c_red >> 3)][(c_green >> 3)][(c_blue >> 3)];
|
||||
#else
|
||||
*dest = RGB256k.RGB[(c_red >> 2)][(c_green >> 2)][(c_blue >> 2)];
|
||||
#endif
|
||||
}
|
||||
|
||||
frac += fracstep;
|
||||
|
@ -978,13 +932,8 @@ namespace swrenderer
|
|||
int solid_bottom_r = RPART(solid_bottom);
|
||||
int solid_bottom_g = GPART(solid_bottom);
|
||||
int solid_bottom_b = BPART(solid_bottom);
|
||||
#ifdef NO_RGB666
|
||||
uint32_t solid_top_fill = RGB32k.RGB[(solid_top_r >> 3)][(solid_top_g >> 3)][(solid_top_b >> 3)];
|
||||
uint32_t solid_bottom_fill = RGB32k.RGB[(solid_bottom_r >> 3)][(solid_bottom_g >> 3)][(solid_bottom_b >> 3)];
|
||||
#else
|
||||
uint32_t solid_top_fill = RGB256k.RGB[(solid_top_r >> 2)][(solid_top_g >> 2)][(solid_top_b >> 2)];
|
||||
uint32_t solid_bottom_fill = RGB256k.RGB[(solid_bottom_r >> 2)][(solid_bottom_g >> 2)][(solid_bottom_b >> 2)];
|
||||
#endif
|
||||
solid_top_fill = (solid_top_fill << 24) | (solid_top_fill << 16) | (solid_top_fill << 8) | solid_top_fill;
|
||||
solid_bottom_fill = (solid_bottom_fill << 24) | (solid_bottom_fill << 16) | (solid_bottom_fill << 8) | solid_bottom_fill;
|
||||
|
||||
|
@ -1050,11 +999,7 @@ namespace swrenderer
|
|||
c_red = (c_red * alpha_top + solid_top_r * inv_alpha_top) >> 8;
|
||||
c_green = (c_green * alpha_top + solid_top_g * inv_alpha_top) >> 8;
|
||||
c_blue = (c_blue * alpha_top + solid_top_b * inv_alpha_top) >> 8;
|
||||
#ifdef NO_RGB666
|
||||
output[col] = RGB32k.RGB[(c_red >> 3)][(c_green >> 3)][(c_blue >> 3)];
|
||||
#else
|
||||
output[col] = RGB256k.RGB[(c_red >> 2)][(c_green >> 2)][(c_blue >> 2)];
|
||||
#endif
|
||||
|
||||
frac[col] += fracstep[col];
|
||||
}
|
||||
|
@ -1108,11 +1053,7 @@ namespace swrenderer
|
|||
c_red = (c_red * alpha_bottom + solid_bottom_r * inv_alpha_bottom) >> 8;
|
||||
c_green = (c_green * alpha_bottom + solid_bottom_g * inv_alpha_bottom) >> 8;
|
||||
c_blue = (c_blue * alpha_bottom + solid_bottom_b * inv_alpha_bottom) >> 8;
|
||||
#ifdef NO_RGB666
|
||||
output[col] = RGB32k.RGB[(c_red >> 3)][(c_green >> 3)][(c_blue >> 3)];
|
||||
#else
|
||||
output[col] = RGB256k.RGB[(c_red >> 2)][(c_green >> 2)][(c_blue >> 2)];
|
||||
#endif
|
||||
|
||||
frac[col] += fracstep[col];
|
||||
}
|
||||
|
@ -1244,9 +1185,12 @@ namespace swrenderer
|
|||
|
||||
do
|
||||
{
|
||||
uint32_t bg;
|
||||
bg = (fg + bg2rgb[*dest]) | 0x1f07c1f;
|
||||
*dest = RGB32k.All[bg & (bg >> 15)];
|
||||
const PalEntry* pal = GPalette.BaseColors;
|
||||
// *** [SP] this is incomplete, not sure what to do here.
|
||||
/*int r = clamp((int)pal[_srccolor].r, 0, 255) >> 2;
|
||||
int g = clamp((int)pal[_srccolor].g, 0, 255) >> 2;
|
||||
int b = clamp((int)pal[_srccolor].b, 0, 255) >> 2;
|
||||
*dest = RGB256k.RGB[r][g][b];*/
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
|
||||
|
@ -1276,15 +1220,11 @@ namespace swrenderer
|
|||
|
||||
do
|
||||
{
|
||||
uint32_t a = fg + bg2rgb[*dest];
|
||||
uint32_t b = a;
|
||||
|
||||
a |= 0x01f07c1f;
|
||||
b &= 0x40100400;
|
||||
a &= 0x3fffffff;
|
||||
b = b - (b >> 5);
|
||||
a |= b;
|
||||
*dest = RGB32k.All[a & (a >> 15)];
|
||||
const PalEntry* pal = GPalette.BaseColors;
|
||||
int r = clamp(pal[*dest].r + pal[fg].r, 0, 255) >> 2;
|
||||
int g = clamp(pal[*dest].g + pal[fg].g, 0, 255) >> 2;
|
||||
int b = clamp(pal[*dest].b + pal[fg].b, 0, 255) >> 2;
|
||||
*dest = RGB256k.RGB[r][g][b];
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
}
|
||||
|
|
|
@ -446,14 +446,15 @@ namespace swrenderer
|
|||
source = &thread->dc_temp[thread->temp_line_for_thread(yl)*4 + hx];
|
||||
pitch = _pitch * thread->num_cores;
|
||||
colormap = _colormap;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
do {
|
||||
uint32_t fg = colormap[*source];
|
||||
uint32_t bg = *dest;
|
||||
|
||||
int r = MIN((GPalette.BaseColors[fg].r * _srcalpha + GPalette.BaseColors[bg].r * _destalpha)>>18, 63);
|
||||
int g = MIN((GPalette.BaseColors[fg].g * _srcalpha + GPalette.BaseColors[bg].g * _destalpha)>>18, 63);
|
||||
int b = MIN((GPalette.BaseColors[fg].b * _srcalpha + GPalette.BaseColors[bg].b * _destalpha)>>18, 63);
|
||||
int r = MIN((palette[fg].r * _srcalpha + palette[bg].r * _destalpha)>>18, 63);
|
||||
int g = MIN((palette[fg].g * _srcalpha + palette[bg].g * _destalpha)>>18, 63);
|
||||
int b = MIN((palette[fg].b * _srcalpha + palette[bg].b * _destalpha)>>18, 63);
|
||||
*dest = RGB256k.RGB[r][g][b];
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
|
@ -476,15 +477,16 @@ namespace swrenderer
|
|||
source = &thread->dc_temp[thread->temp_line_for_thread(yl)*4];
|
||||
pitch = _pitch * thread->num_cores;
|
||||
colormap = _colormap;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
do {
|
||||
for (int ks = 0; ks < 4; ks++)
|
||||
{ // [SP] this 4col function was a block of copy-pasted code. 4 times. I regret nothing.
|
||||
uint32_t fg = colormap[source[ks]];
|
||||
uint32_t bg = dest[ks];
|
||||
int r = MIN((GPalette.BaseColors[fg].r * _srcalpha + GPalette.BaseColors[bg].r * _destalpha)>>18, 63);
|
||||
int g = MIN((GPalette.BaseColors[fg].g * _srcalpha + GPalette.BaseColors[bg].g * _destalpha)>>18, 63);
|
||||
int b = MIN((GPalette.BaseColors[fg].b * _srcalpha + GPalette.BaseColors[bg].b * _destalpha)>>18, 63);
|
||||
int r = MIN((palette[fg].r * _srcalpha + palette[bg].r * _destalpha)>>18, 63);
|
||||
int g = MIN((palette[fg].g * _srcalpha + palette[bg].g * _destalpha)>>18, 63);
|
||||
int b = MIN((palette[fg].b * _srcalpha + palette[bg].b * _destalpha)>>18, 63);
|
||||
dest[ks] = RGB256k.RGB[r][g][b];
|
||||
}
|
||||
|
||||
|
@ -511,13 +513,14 @@ namespace swrenderer
|
|||
dest = ylookup[yl + thread->skipped_by_thread(yl)] + sx + _destorg;
|
||||
source = &thread->dc_temp[thread->temp_line_for_thread(yl)*4 + hx];
|
||||
pitch = _pitch * thread->num_cores;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
do {
|
||||
uint32_t val = *source;
|
||||
int r = (GPalette.BaseColors[*dest].r * (63-val) + GPalette.BaseColors[_color].r * val) >> 8;
|
||||
int g = (GPalette.BaseColors[*dest].g * (63-val) + GPalette.BaseColors[_color].g * val) >> 8;
|
||||
int b = (GPalette.BaseColors[*dest].b * (63-val) + GPalette.BaseColors[_color].b * val) >> 8;
|
||||
*dest = RGB256k.RGB[MIN(r,63)][MIN(g,63)][MIN(b,63)];
|
||||
int r = (palette[*dest].r * (255-val)) >> 10;
|
||||
int g = (palette[*dest].g * (255-val)) >> 10;
|
||||
int b = (palette[*dest].b * (255-val)) >> 10;
|
||||
*dest = RGB256k.RGB[clamp(r,0,63)][clamp(g,0,63)][clamp(b,0,63)];
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
|
@ -541,6 +544,7 @@ namespace swrenderer
|
|||
dest = ylookup[yl + thread->skipped_by_thread(yl)] + sx + _destorg;
|
||||
source = &thread->dc_temp[thread->temp_line_for_thread(yl)*4];
|
||||
pitch = _pitch * thread->num_cores;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
do {
|
||||
uint32_t val;
|
||||
|
@ -548,10 +552,10 @@ namespace swrenderer
|
|||
for (int ks = 0; ks < 4; ks++)
|
||||
{
|
||||
val = source[ks];
|
||||
int r = (GPalette.BaseColors[dest[ks]].r * (63-val) + GPalette.BaseColors[_color].r * val) >> 8;
|
||||
int g = (GPalette.BaseColors[dest[ks]].g * (63-val) + GPalette.BaseColors[_color].g * val) >> 8;
|
||||
int b = (GPalette.BaseColors[dest[ks]].b * (63-val) + GPalette.BaseColors[_color].b * val) >> 8;
|
||||
dest[ks] = RGB256k.RGB[MIN(r,63)][MIN(g,63)][MIN(b,63)];
|
||||
int r = (palette[dest[ks]].r * (255-val)) >> 10;
|
||||
int g = (palette[dest[ks]].g * (255-val)) >> 10;
|
||||
int b = (palette[dest[ks]].b * (255-val)) >> 10;
|
||||
dest[ks] = RGB256k.RGB[clamp(r,0,63)][clamp(g,0,63)][clamp(b,0,63)];
|
||||
}
|
||||
|
||||
source += 4;
|
||||
|
@ -575,13 +579,14 @@ namespace swrenderer
|
|||
source = &thread->dc_temp[thread->temp_line_for_thread(yl)*4 + hx];
|
||||
pitch = _pitch * thread->num_cores;
|
||||
colormap = _colormap;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
do {
|
||||
int fg = *source;
|
||||
int bg = *dest;
|
||||
int r = MIN((GPalette.BaseColors[fg].r * _srcalpha + GPalette.BaseColors[bg].r * _destalpha)>>18, 63);
|
||||
int g = MIN((GPalette.BaseColors[fg].g * _srcalpha + GPalette.BaseColors[bg].g * _destalpha)>>18, 63);
|
||||
int b = MIN((GPalette.BaseColors[fg].b * _srcalpha + GPalette.BaseColors[bg].b * _destalpha)>>18, 63);
|
||||
int r = MIN((palette[fg].r * _srcalpha + palette[bg].r * _destalpha)>>18, 63);
|
||||
int g = MIN((palette[fg].g * _srcalpha + palette[bg].g * _destalpha)>>18, 63);
|
||||
int b = MIN((palette[fg].b * _srcalpha + palette[bg].b * _destalpha)>>18, 63);
|
||||
*dest = RGB256k.RGB[r][g][b];
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
|
@ -604,15 +609,16 @@ namespace swrenderer
|
|||
source = &thread->dc_temp[thread->temp_line_for_thread(yl)*4];
|
||||
pitch = _pitch * thread->num_cores;
|
||||
colormap = _colormap;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
do {
|
||||
for (int ks = 0; ks < 4; ks++)
|
||||
{
|
||||
int fg = source[ks];
|
||||
int bg = dest[ks];
|
||||
int r = MIN((GPalette.BaseColors[fg].r * _srcalpha + GPalette.BaseColors[bg].r * _destalpha)>>18, 63);
|
||||
int g = MIN((GPalette.BaseColors[fg].g * _srcalpha + GPalette.BaseColors[bg].g * _destalpha)>>18, 63);
|
||||
int b = MIN((GPalette.BaseColors[fg].b * _srcalpha + GPalette.BaseColors[bg].b * _destalpha)>>18, 63);
|
||||
int r = MIN((palette[fg].r * _srcalpha + palette[bg].r * _destalpha)>>18, 63);
|
||||
int g = MIN((palette[fg].g * _srcalpha + palette[bg].g * _destalpha)>>18, 63);
|
||||
int b = MIN((palette[fg].b * _srcalpha + palette[bg].b * _destalpha)>>18, 63);
|
||||
dest[ks] = RGB256k.RGB[r][g][b];
|
||||
}
|
||||
|
||||
|
@ -639,16 +645,15 @@ namespace swrenderer
|
|||
source = &thread->dc_temp[thread->temp_line_for_thread(yl)*4 + hx];
|
||||
pitch = _pitch * thread->num_cores;
|
||||
colormap = _colormap;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
do {
|
||||
uint32_t a = (fg2rgb[colormap[*source]] | 0x40100400) - bg2rgb[*dest];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
*dest = RGB32k.All[(a>>15) & a];
|
||||
int fg = *source;
|
||||
int bg = *dest;
|
||||
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 b = MAX((palette[fg].b * _srcalpha - palette[bg].b * _destalpha)>>18, 0);
|
||||
*dest = RGB256k.RGB[r][g][b];
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
|
@ -672,40 +677,18 @@ namespace swrenderer
|
|||
source = &thread->dc_temp[thread->temp_line_for_thread(yl)*4];
|
||||
pitch = _pitch * thread->num_cores;
|
||||
colormap = _colormap;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
do {
|
||||
uint32_t a = (fg2rgb[colormap[source[0]]] | 0x40100400) - bg2rgb[dest[0]];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
dest[0] = RGB32k.All[(a>>15) & a];
|
||||
|
||||
a = (fg2rgb[colormap[source[1]]] | 0x40100400) - bg2rgb[dest[1]];
|
||||
b = a;
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
dest[1] = RGB32k.All[(a>>15) & a];
|
||||
|
||||
a = (fg2rgb[colormap[source[2]]] | 0x40100400) - bg2rgb[dest[2]];
|
||||
b = a;
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
dest[2] = RGB32k.All[(a>>15) & a];
|
||||
|
||||
a = (fg2rgb[colormap[source[3]]] | 0x40100400) - bg2rgb[dest[3]];
|
||||
b = a;
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
dest[3] = RGB32k.All[(a>>15) & a];
|
||||
for (int ks = 0; ks < 4; ks++)
|
||||
{
|
||||
int fg = source[ks];
|
||||
int bg = dest[ks];
|
||||
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 b = MAX((palette[fg].b * _srcalpha - palette[bg].b * _destalpha)>>18, 0);
|
||||
dest[ks] = RGB256k.RGB[r][g][b];
|
||||
}
|
||||
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
|
@ -730,16 +713,15 @@ namespace swrenderer
|
|||
source = &thread->dc_temp[thread->temp_line_for_thread(yl)*4 + hx];
|
||||
pitch = _pitch * thread->num_cores;
|
||||
colormap = _colormap;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
do {
|
||||
uint32_t a = (bg2rgb[*dest] | 0x40100400) - fg2rgb[colormap[*source]];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
*dest = RGB32k.All[(a>>15) & a];
|
||||
int fg = *source;
|
||||
int bg = *dest;
|
||||
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 b = MAX((-palette[fg].b * _srcalpha + palette[bg].b * _destalpha)>>18, 0);
|
||||
*dest = RGB256k.RGB[r][g][b];
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
|
@ -763,40 +745,18 @@ namespace swrenderer
|
|||
source = &thread->dc_temp[thread->temp_line_for_thread(yl)*4];
|
||||
pitch = _pitch * thread->num_cores;
|
||||
colormap = _colormap;
|
||||
const PalEntry *palette = GPalette.BaseColors;
|
||||
|
||||
do {
|
||||
uint32_t a = (bg2rgb[dest[0]] | 0x40100400) - fg2rgb[colormap[source[0]]];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
dest[0] = RGB32k.All[(a>>15) & a];
|
||||
|
||||
a = (bg2rgb[dest[1]] | 0x40100400) - fg2rgb[colormap[source[1]]];
|
||||
b = a;
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
dest[1] = RGB32k.All[(a>>15) & a];
|
||||
|
||||
a = (bg2rgb[dest[2]] | 0x40100400) - fg2rgb[colormap[source[2]]];
|
||||
b = a;
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
dest[2] = RGB32k.All[(a>>15) & a];
|
||||
|
||||
a = (bg2rgb[dest[3]] | 0x40100400) - fg2rgb[colormap[source[3]]];
|
||||
b = a;
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
dest[3] = RGB32k.All[(a>>15) & a];
|
||||
for (int ks = 0; ks < 4; ks++)
|
||||
{
|
||||
int fg = source[ks];
|
||||
int bg = dest[ks];
|
||||
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 b = MAX((-palette[fg].b * _srcalpha + palette[bg].b * _destalpha)>>18, 0);
|
||||
dest[ks] = RGB256k.RGB[r][g][b];
|
||||
}
|
||||
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
|
|
|
@ -528,7 +528,7 @@ void FPCXTexture::MakeTexture()
|
|||
{
|
||||
for(int x=0; x < Width; x++)
|
||||
{
|
||||
Pixels[y+Height*x] = RGB32k.RGB[row[0]>>3][row[1]>>3][row[2]>>3];
|
||||
Pixels[y+Height*x] = RGB256k.RGB[row[0]>>2][row[1]>>2][row[2]>>2];
|
||||
row+=3;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue