mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 15:32:57 +00:00
- No matter how many drawers you have, you have more drawers to do.
This commit is contained in:
parent
179c7dba83
commit
6235b12cfc
7 changed files with 53 additions and 138 deletions
|
@ -303,6 +303,8 @@ namespace swrenderer
|
|||
const uint32_t *_srcblend;
|
||||
const uint32_t *_destblend;
|
||||
const uint8_t *_translation;
|
||||
fixed_t _srcalpha;
|
||||
fixed_t _destalpha;
|
||||
int _color;
|
||||
};
|
||||
|
||||
|
|
|
@ -173,6 +173,8 @@ namespace swrenderer
|
|||
_colormap = dc_colormap;
|
||||
_srcblend = dc_srcblend;
|
||||
_destblend = dc_destblend;
|
||||
_srcalpha = dc_srcalpha;
|
||||
_destalpha = dc_destalpha;
|
||||
_translation = dc_translation;
|
||||
_color = dc_color;
|
||||
}
|
||||
|
@ -440,8 +442,6 @@ namespace swrenderer
|
|||
if (count <= 0)
|
||||
return;
|
||||
|
||||
const uint32_t *fg2rgb = _srcblend;
|
||||
const uint32_t *bg2rgb = _destblend;
|
||||
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;
|
||||
|
@ -451,10 +451,10 @@ namespace swrenderer
|
|||
uint32_t fg = colormap[*source];
|
||||
uint32_t bg = *dest;
|
||||
|
||||
fg = fg2rgb[fg];
|
||||
bg = bg2rgb[bg];
|
||||
fg = (fg+bg) | 0x1f07c1f;
|
||||
*dest = RGB32k.All[fg & (fg>>15)];
|
||||
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);
|
||||
*dest = RGB256k.RGB[r][g][b];
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
|
@ -472,42 +472,21 @@ namespace swrenderer
|
|||
if (count <= 0)
|
||||
return;
|
||||
|
||||
const uint32_t *fg2rgb = _srcblend;
|
||||
const uint32_t *bg2rgb = _destblend;
|
||||
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;
|
||||
colormap = _colormap;
|
||||
|
||||
do {
|
||||
uint32_t fg = colormap[source[0]];
|
||||
uint32_t bg = dest[0];
|
||||
fg = fg2rgb[fg];
|
||||
bg = bg2rgb[bg];
|
||||
fg = (fg+bg) | 0x1f07c1f;
|
||||
dest[0] = RGB32k.All[fg & (fg>>15)];
|
||||
|
||||
fg = colormap[source[1]];
|
||||
bg = dest[1];
|
||||
fg = fg2rgb[fg];
|
||||
bg = bg2rgb[bg];
|
||||
fg = (fg+bg) | 0x1f07c1f;
|
||||
dest[1] = RGB32k.All[fg & (fg>>15)];
|
||||
|
||||
|
||||
fg = colormap[source[2]];
|
||||
bg = dest[2];
|
||||
fg = fg2rgb[fg];
|
||||
bg = bg2rgb[bg];
|
||||
fg = (fg+bg) | 0x1f07c1f;
|
||||
dest[2] = RGB32k.All[fg & (fg>>15)];
|
||||
|
||||
fg = colormap[source[3]];
|
||||
bg = dest[3];
|
||||
fg = fg2rgb[fg];
|
||||
bg = bg2rgb[bg];
|
||||
fg = (fg+bg) | 0x1f07c1f;
|
||||
dest[3] = RGB32k.All[fg & (fg>>15)];
|
||||
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);
|
||||
dest[ks] = RGB256k.RGB[r][g][b];
|
||||
}
|
||||
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
|
@ -534,10 +513,11 @@ namespace swrenderer
|
|||
pitch = _pitch * thread->num_cores;
|
||||
|
||||
do {
|
||||
uint32_t val = colormap[*source];
|
||||
uint32_t fg = fgstart[val<<8];
|
||||
val = (Col2RGB8[64-val][*dest] + fg) | 0x1f07c1f;
|
||||
*dest = RGB32k.All[val & (val>>15)];
|
||||
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)];
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
|
@ -564,22 +544,15 @@ namespace swrenderer
|
|||
|
||||
do {
|
||||
uint32_t val;
|
||||
|
||||
val = colormap[source[0]];
|
||||
val = (Col2RGB8[64-val][dest[0]] + fgstart[val<<8]) | 0x1f07c1f;
|
||||
dest[0] = RGB32k.All[val & (val>>15)];
|
||||
|
||||
val = colormap[source[1]];
|
||||
val = (Col2RGB8[64-val][dest[1]] + fgstart[val<<8]) | 0x1f07c1f;
|
||||
dest[1] = RGB32k.All[val & (val>>15)];
|
||||
|
||||
val = colormap[source[2]];
|
||||
val = (Col2RGB8[64-val][dest[2]] + fgstart[val<<8]) | 0x1f07c1f;
|
||||
dest[2] = RGB32k.All[val & (val>>15)];
|
||||
|
||||
val = colormap[source[3]];
|
||||
val = (Col2RGB8[64-val][dest[3]] + fgstart[val<<8]) | 0x1f07c1f;
|
||||
dest[3] = RGB32k.All[val & (val>>15)];
|
||||
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)];
|
||||
}
|
||||
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
|
@ -598,23 +571,18 @@ namespace swrenderer
|
|||
if (count <= 0)
|
||||
return;
|
||||
|
||||
const uint32_t *fg2rgb = _srcblend;
|
||||
const uint32_t *bg2rgb = _destblend;
|
||||
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;
|
||||
colormap = _colormap;
|
||||
|
||||
do {
|
||||
uint32_t a = fg2rgb[colormap[*source]] + bg2rgb[*dest];
|
||||
uint32_t b = a;
|
||||
|
||||
a |= 0x01f07c1f;
|
||||
b &= 0x40100400;
|
||||
a &= 0x3fffffff;
|
||||
b = b - (b >> 5);
|
||||
a |= b;
|
||||
*dest = RGB32k.All[(a>>15) & a];
|
||||
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);
|
||||
*dest = RGB256k.RGB[r][g][b];
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
|
@ -637,46 +605,16 @@ namespace swrenderer
|
|||
pitch = _pitch * thread->num_cores;
|
||||
colormap = _colormap;
|
||||
|
||||
const uint32_t *fg2rgb = _srcblend;
|
||||
const uint32_t *bg2rgb = _destblend;
|
||||
|
||||
do {
|
||||
uint32_t a = fg2rgb[colormap[source[0]]] + bg2rgb[dest[0]];
|
||||
uint32_t b = a;
|
||||
|
||||
a |= 0x01f07c1f;
|
||||
b &= 0x40100400;
|
||||
a &= 0x3fffffff;
|
||||
b = b - (b >> 5);
|
||||
a |= b;
|
||||
dest[0] = RGB32k.All[(a>>15) & a];
|
||||
|
||||
a = fg2rgb[colormap[source[1]]] + bg2rgb[dest[1]];
|
||||
b = a;
|
||||
a |= 0x01f07c1f;
|
||||
b &= 0x40100400;
|
||||
a &= 0x3fffffff;
|
||||
b = b - (b >> 5);
|
||||
a |= b;
|
||||
dest[1] = RGB32k.All[(a>>15) & a];
|
||||
|
||||
a = fg2rgb[colormap[source[2]]] + bg2rgb[dest[2]];
|
||||
b = a;
|
||||
a |= 0x01f07c1f;
|
||||
b &= 0x40100400;
|
||||
a &= 0x3fffffff;
|
||||
b = b - (b >> 5);
|
||||
a |= b;
|
||||
dest[2] = RGB32k.All[(a>>15) & a];
|
||||
|
||||
a = fg2rgb[colormap[source[3]]] + bg2rgb[dest[3]];
|
||||
b = a;
|
||||
a |= 0x01f07c1f;
|
||||
b &= 0x40100400;
|
||||
a &= 0x3fffffff;
|
||||
b = b - (b >> 5);
|
||||
a |= b;
|
||||
dest[3] = RGB32k.All[(a>>15) & a];
|
||||
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);
|
||||
dest[ks] = RGB256k.RGB[r][g][b];
|
||||
}
|
||||
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
|
|
|
@ -551,7 +551,7 @@ void FDDSTexture::ReadRGB (FWadLump &lump, BYTE *tcbuf)
|
|||
DWORD r = (c & RMask) << RShiftL; r |= r >> RShiftR;
|
||||
DWORD g = (c & GMask) << GShiftL; g |= g >> GShiftR;
|
||||
DWORD b = (c & BMask) << BShiftL; b |= b >> BShiftR;
|
||||
*pixelp = RGB32k.RGB[r >> 27][g >> 27][b >> 27];
|
||||
*pixelp = RGB256k.RGB[r >> 26][g >> 26][b >> 26];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -637,7 +637,7 @@ void FDDSTexture::DecompressDXT1 (FWadLump &lump, BYTE *tcbuf)
|
|||
// Pick colors from the palette for each of the four colors.
|
||||
/*if (!tcbuf)*/ for (i = 3; i >= 0; --i)
|
||||
{
|
||||
palcol[i] = color[i].a ? RGB32k.RGB[color[i].r >> 3][color[i].g >> 3][color[i].b >> 3] : 0;
|
||||
palcol[i] = color[i].a ? RGB256k.RGB[color[i].r >> 2][color[i].g >> 2][color[i].b >> 2] : 0;
|
||||
}
|
||||
// Now decode this 4x4 block to the pixel buffer.
|
||||
for (y = 0; y < 4; ++y)
|
||||
|
@ -717,7 +717,7 @@ void FDDSTexture::DecompressDXT3 (FWadLump &lump, bool premultiplied, BYTE *tcbu
|
|||
// Pick colors from the palette for each of the four colors.
|
||||
if (!tcbuf) for (i = 3; i >= 0; --i)
|
||||
{
|
||||
palcol[i] = RGB32k.RGB[color[i].r >> 3][color[i].g >> 3][color[i].b >> 3];
|
||||
palcol[i] = RGB256k.RGB[color[i].r >> 2][color[i].g >> 2][color[i].b >> 2];
|
||||
}
|
||||
// Now decode this 4x4 block to the pixel buffer.
|
||||
for (y = 0; y < 4; ++y)
|
||||
|
@ -822,7 +822,7 @@ void FDDSTexture::DecompressDXT5 (FWadLump &lump, bool premultiplied, BYTE *tcbu
|
|||
// Pick colors from the palette for each of the four colors.
|
||||
if (!tcbuf) for (i = 3; i >= 0; --i)
|
||||
{
|
||||
palcol[i] = RGB32k.RGB[color[i].r >> 3][color[i].g >> 3][color[i].b >> 3];
|
||||
palcol[i] = RGB256k.RGB[color[i].r >> 2][color[i].g >> 2][color[i].b >> 2];
|
||||
}
|
||||
// Now decode this 4x4 block to the pixel buffer.
|
||||
for (y = 0; y < 4; ++y)
|
||||
|
|
|
@ -406,7 +406,7 @@ void FJPEGTexture::MakeTexture ()
|
|||
case JCS_RGB:
|
||||
for (int x = Width; x > 0; --x)
|
||||
{
|
||||
*out = RGB32k.RGB[in[0]>>3][in[1]>>3][in[2]>>3];
|
||||
*out = RGB256k.RGB[in[0]>>2][in[1]>>2][in[2]>>2];
|
||||
out += Height;
|
||||
in += 3;
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ void FJPEGTexture::MakeTexture ()
|
|||
int r = in[3] - (((256-in[0])*in[3]) >> 8);
|
||||
int g = in[3] - (((256-in[1])*in[3]) >> 8);
|
||||
int b = in[3] - (((256-in[2])*in[3]) >> 8);
|
||||
*out = RGB32k.RGB[r >> 3][g >> 3][b >> 3];
|
||||
*out = RGB256k.RGB[r >> 2][g >> 2][b >> 2];
|
||||
out += Height;
|
||||
in += 4;
|
||||
}
|
||||
|
|
|
@ -531,7 +531,7 @@ void FMultiPatchTexture::MakeTexture ()
|
|||
{
|
||||
if (*out == 0 && in[3] != 0)
|
||||
{
|
||||
*out = RGB32k.RGB[in[2]>>3][in[1]>>3][in[0]>>3];
|
||||
*out = RGB256k.RGB[in[2]>>2][in[1]>>2][in[0]>>2];
|
||||
}
|
||||
out += Height;
|
||||
in += 4;
|
||||
|
|
|
@ -536,12 +536,7 @@ void FPNGTexture::MakeTexture ()
|
|||
{
|
||||
if (!HaveTrans)
|
||||
{
|
||||
#ifdef NO_RGB666
|
||||
*out++ = RGB32k.RGB[in[0]>>3][in[1]>>3][in[2]>>3];
|
||||
#else
|
||||
*out++ = RGB256k.RGB[in[0]>>2][in[1]>>2][in[2]>>2];
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -553,11 +548,7 @@ void FPNGTexture::MakeTexture ()
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef NO_RGB666
|
||||
*out++ = RGB32k.RGB[in[0]>>3][in[1]>>3][in[2]>>3];
|
||||
#else
|
||||
*out++ = RGB256k.RGB[in[0]>>2][in[1]>>2][in[2]>>2];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
in += pitch;
|
||||
|
@ -602,11 +593,7 @@ void FPNGTexture::MakeTexture ()
|
|||
{
|
||||
for (y = Height; y > 0; --y)
|
||||
{
|
||||
#ifdef NO_RGB666
|
||||
*out++ = in[3] < 128 ? 0 : RGB32k.RGB[in[0]>>3][in[1]>>3][in[2]>>3];
|
||||
#else
|
||||
*out++ = in[3] < 128 ? 0 : RGB256k.RGB[in[0]>>2][in[1]>>2][in[2]>>2];
|
||||
#endif
|
||||
in += pitch;
|
||||
}
|
||||
in -= backstep;
|
||||
|
|
|
@ -393,7 +393,7 @@ void FTGATexture::MakeTexture ()
|
|||
for(int x=0;x<Width;x++)
|
||||
{
|
||||
int v = LittleLong(*p);
|
||||
Pixels[x*Height+y] = RGB32k.RGB[(v>>10) & 0x1f][(v>>5) & 0x1f][v & 0x1f];
|
||||
Pixels[x*Height+y] = RGB256k.RGB[((v>>10) & 0x1f)*2][((v>>5) & 0x1f)*2][(v & 0x1f)*2];
|
||||
p+=step_x;
|
||||
}
|
||||
}
|
||||
|
@ -405,11 +405,7 @@ void FTGATexture::MakeTexture ()
|
|||
BYTE * p = ptr + y * Pitch;
|
||||
for(int x=0;x<Width;x++)
|
||||
{
|
||||
#ifdef NO_RGB666
|
||||
Pixels[x*Height+y] = RGB32k.RGB[p[2]>>3][p[1]>>3][p[0]>>3];
|
||||
#else
|
||||
Pixels[x*Height+y] = RGB256k.RGB[p[2]>>2][p[1]>>2][p[0]>>2];
|
||||
#endif
|
||||
p+=step_x;
|
||||
}
|
||||
}
|
||||
|
@ -423,11 +419,7 @@ void FTGATexture::MakeTexture ()
|
|||
BYTE * p = ptr + y * Pitch;
|
||||
for(int x=0;x<Width;x++)
|
||||
{
|
||||
#ifdef NO_RGB666
|
||||
Pixels[x*Height+y] = RGB32k.RGB[p[2]>>3][p[1]>>3][p[0]>>3];
|
||||
#else
|
||||
Pixels[x*Height+y] = RGB256k.RGB[p[2]>>2][p[1]>>2][p[0]>>2];
|
||||
#endif
|
||||
p+=step_x;
|
||||
}
|
||||
}
|
||||
|
@ -439,11 +431,7 @@ void FTGATexture::MakeTexture ()
|
|||
BYTE * p = ptr + y * Pitch;
|
||||
for(int x=0;x<Width;x++)
|
||||
{
|
||||
#ifdef NO_RGB666
|
||||
Pixels[x*Height+y] = p[3] >= 128? RGB32k.RGB[p[2]>>3][p[1]>>3][p[0]>>3] : 0;
|
||||
#else
|
||||
Pixels[x*Height+y] = p[3] >= 128? RGB256k.RGB[p[2]>>2][p[1]>>2][p[0]>>2] : 0;
|
||||
#endif
|
||||
p+=step_x;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue