Created standalone rgba drawing functions
This commit is contained in:
parent
6e53c1bd12
commit
8aabc26cd9
12 changed files with 2790 additions and 976 deletions
332
src/r_drawt.cpp
332
src/r_drawt.cpp
|
|
@ -114,13 +114,6 @@ void rt_copy1col_c (int hx, int sx, int yl, int yh)
|
|||
// Copies all four spans to the screen starting at sx.
|
||||
void rt_copy4cols_c (int sx, int yl, int yh)
|
||||
{
|
||||
#ifndef PALETTEOUTPUT
|
||||
// To do: we could do this with SSE using __m128i
|
||||
rt_copy1col_c(0, sx, yl, yh);
|
||||
rt_copy1col_c(1, sx + 1, yl, yh);
|
||||
rt_copy1col_c(2, sx + 2, yl, yh);
|
||||
rt_copy1col_c(3, sx + 3, yl, yh);
|
||||
#else
|
||||
int *source;
|
||||
int *dest;
|
||||
int count;
|
||||
|
|
@ -149,7 +142,6 @@ void rt_copy4cols_c (int sx, int yl, int yh)
|
|||
source += 8/sizeof(int);
|
||||
dest += pitch*2;
|
||||
} while (--count);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Maps one span at hx to the screen at sx.
|
||||
|
|
@ -166,21 +158,13 @@ void rt_map1col_c (int hx, int sx, int yl, int yh)
|
|||
return;
|
||||
count++;
|
||||
|
||||
#ifndef PALETTEOUTPUT
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
#endif
|
||||
|
||||
colormap = dc_colormap;
|
||||
dest = ylookup[yl] + sx + dc_destorg;
|
||||
source = &dc_temp[yl*4 + hx];
|
||||
pitch = dc_pitch;
|
||||
|
||||
if (count & 1) {
|
||||
#ifndef PALETTEOUTPUT
|
||||
*dest = shade_pal_index(colormap[*source], light);
|
||||
#else
|
||||
*dest = colormap[*source];
|
||||
#endif
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
}
|
||||
|
|
@ -188,13 +172,8 @@ void rt_map1col_c (int hx, int sx, int yl, int yh)
|
|||
return;
|
||||
|
||||
do {
|
||||
#ifndef PALETTEOUTPUT
|
||||
dest[0] = shade_pal_index(colormap[source[0]], light);
|
||||
dest[pitch] = shade_pal_index(colormap[source[4]], light);
|
||||
#else
|
||||
dest[0] = colormap[source[0]];
|
||||
dest[pitch] = colormap[source[4]];
|
||||
#endif
|
||||
source += 8;
|
||||
dest += pitch*2;
|
||||
} while (--count);
|
||||
|
|
@ -214,27 +193,16 @@ void rt_map4cols_c (int sx, int yl, int yh)
|
|||
return;
|
||||
count++;
|
||||
|
||||
#ifndef PALETTEOUTPUT
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
#endif
|
||||
|
||||
colormap = dc_colormap;
|
||||
dest = ylookup[yl] + sx + dc_destorg;
|
||||
source = &dc_temp[yl*4];
|
||||
pitch = dc_pitch;
|
||||
|
||||
if (count & 1) {
|
||||
#ifndef PALETTEOUTPUT
|
||||
dest[0] = shade_pal_index(colormap[source[0]], light);
|
||||
dest[1] = shade_pal_index(colormap[source[1]], light);
|
||||
dest[2] = shade_pal_index(colormap[source[2]], light);
|
||||
dest[3] = shade_pal_index(colormap[source[3]], light);
|
||||
#else
|
||||
dest[0] = colormap[source[0]];
|
||||
dest[1] = colormap[source[1]];
|
||||
dest[2] = colormap[source[2]];
|
||||
dest[3] = colormap[source[3]];
|
||||
#endif
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
}
|
||||
|
|
@ -242,16 +210,6 @@ void rt_map4cols_c (int sx, int yl, int yh)
|
|||
return;
|
||||
|
||||
do {
|
||||
#ifndef PALETTEOUTPUT
|
||||
dest[0] = shade_pal_index(colormap[source[0]], light);
|
||||
dest[1] = shade_pal_index(colormap[source[1]], light);
|
||||
dest[2] = shade_pal_index(colormap[source[2]], light);
|
||||
dest[3] = shade_pal_index(colormap[source[3]], light);
|
||||
dest[pitch] = shade_pal_index(colormap[source[4]], light);
|
||||
dest[pitch + 1] = shade_pal_index(colormap[source[5]], light);
|
||||
dest[pitch + 2] = shade_pal_index(colormap[source[6]], light);
|
||||
dest[pitch + 3] = shade_pal_index(colormap[source[7]], light);
|
||||
#else
|
||||
dest[0] = colormap[source[0]];
|
||||
dest[1] = colormap[source[1]];
|
||||
dest[2] = colormap[source[2]];
|
||||
|
|
@ -260,7 +218,6 @@ void rt_map4cols_c (int sx, int yl, int yh)
|
|||
dest[pitch+1] = colormap[source[5]];
|
||||
dest[pitch+2] = colormap[source[6]];
|
||||
dest[pitch+3] = colormap[source[7]];
|
||||
#endif
|
||||
source += 8;
|
||||
dest += pitch*2;
|
||||
} while (--count);
|
||||
|
|
@ -356,21 +313,21 @@ void rt_Translate4cols(const BYTE *translation, int yl, int yh)
|
|||
}
|
||||
|
||||
// Translates one span at hx to the screen at sx.
|
||||
void rt_tlate1col (int hx, int sx, int yl, int yh)
|
||||
void rt_tlate1col_c (int hx, int sx, int yl, int yh)
|
||||
{
|
||||
rt_Translate1col(dc_translation, hx, yl, yh);
|
||||
rt_map1col(hx, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Translates all four spans to the screen starting at sx.
|
||||
void rt_tlate4cols (int sx, int yl, int yh)
|
||||
void rt_tlate4cols_c (int sx, int yl, int yh)
|
||||
{
|
||||
rt_Translate4cols(dc_translation, yl, yh);
|
||||
rt_map4cols(sx, yl, yh);
|
||||
}
|
||||
|
||||
// Adds one span at hx to the screen at sx without clamping.
|
||||
void rt_add1col (int hx, int sx, int yl, int yh)
|
||||
void rt_add1col_c (int hx, int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
canvas_pixel_t *source;
|
||||
|
|
@ -388,29 +345,6 @@ void rt_add1col (int hx, int sx, int yl, int yh)
|
|||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
#ifndef PALETTEOUTPUT
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
|
||||
do {
|
||||
uint32_t fg = shade_pal_index(colormap[*source], light);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
||||
uint32_t bg_red = (*dest >> 16) & 0xff;
|
||||
uint32_t bg_green = (*dest >> 8) & 0xff;
|
||||
uint32_t bg_blue = (*dest) & 0xff;
|
||||
|
||||
uint32_t red = clamp<uint32_t>(fg_red + bg_red, 0, 255);
|
||||
uint32_t green = clamp<uint32_t>(fg_green + bg_green, 0, 255);
|
||||
uint32_t blue = clamp<uint32_t>(fg_blue + bg_blue, 0, 255);
|
||||
|
||||
*dest = 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#else
|
||||
DWORD *fg2rgb = dc_srcblend;
|
||||
DWORD *bg2rgb = dc_destblend;
|
||||
do {
|
||||
|
|
@ -424,7 +358,6 @@ void rt_add1col (int hx, int sx, int yl, int yh)
|
|||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Adds all four spans to the screen starting at sx without clamping.
|
||||
|
|
@ -446,32 +379,6 @@ void rt_add4cols_c (int sx, int yl, int yh)
|
|||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
#ifndef PALETTEOUTPUT
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
|
||||
do {
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
uint32_t fg = shade_pal_index(colormap[source[i]], light);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
||||
uint32_t bg_red = (dest[i] >> 16) & 0xff;
|
||||
uint32_t bg_green = (dest[i] >> 8) & 0xff;
|
||||
uint32_t bg_blue = (dest[i]) & 0xff;
|
||||
|
||||
uint32_t red = clamp<uint32_t>(fg_red + bg_red, 0, 255);
|
||||
uint32_t green = clamp<uint32_t>(fg_green + bg_green, 0, 255);
|
||||
uint32_t blue = clamp<uint32_t>(fg_blue + bg_blue, 0, 255);
|
||||
|
||||
dest[i] = 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#else
|
||||
DWORD *fg2rgb = dc_srcblend;
|
||||
DWORD *bg2rgb = dc_destblend;
|
||||
|
||||
|
|
@ -508,25 +415,24 @@ void rt_add4cols_c (int sx, int yl, int yh)
|
|||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Translates and adds one span at hx to the screen at sx without clamping.
|
||||
void rt_tlateadd1col (int hx, int sx, int yl, int yh)
|
||||
void rt_tlateadd1col_c (int hx, int sx, int yl, int yh)
|
||||
{
|
||||
rt_Translate1col(dc_translation, hx, yl, yh);
|
||||
rt_add1col(hx, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Translates and adds all four spans to the screen starting at sx without clamping.
|
||||
void rt_tlateadd4cols (int sx, int yl, int yh)
|
||||
void rt_tlateadd4cols_c (int sx, int yl, int yh)
|
||||
{
|
||||
rt_Translate4cols(dc_translation, yl, yh);
|
||||
rt_add4cols(sx, yl, yh);
|
||||
}
|
||||
|
||||
// Shades one span at hx to the screen at sx.
|
||||
void rt_shaded1col (int hx, int sx, int yl, int yh)
|
||||
void rt_shaded1col_c (int hx, int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
canvas_pixel_t *source;
|
||||
|
|
@ -544,29 +450,6 @@ void rt_shaded1col (int hx, int sx, int yl, int yh)
|
|||
source = &dc_temp[yl*4 + hx];
|
||||
pitch = dc_pitch;
|
||||
|
||||
#ifndef PALETTEOUTPUT
|
||||
uint32_t fg = shade_pal_index(dc_color, calc_light_multiplier(0));
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
||||
do {
|
||||
uint32_t alpha = colormap[*source];
|
||||
uint32_t inv_alpha = 64 - alpha;
|
||||
|
||||
uint32_t bg_red = (*dest >> 16) & 0xff;
|
||||
uint32_t bg_green = (*dest >> 8) & 0xff;
|
||||
uint32_t bg_blue = (*dest) & 0xff;
|
||||
|
||||
uint32_t red = (fg_red * alpha + bg_red * inv_alpha) / 64;
|
||||
uint32_t green = (fg_green * alpha + bg_green * inv_alpha) / 64;
|
||||
uint32_t blue = (fg_blue * alpha + bg_blue * inv_alpha) / 64;
|
||||
|
||||
*dest = 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#else
|
||||
DWORD *fgstart;
|
||||
fgstart = &Col2RGB8[0][dc_color];
|
||||
|
||||
|
|
@ -578,7 +461,6 @@ void rt_shaded1col (int hx, int sx, int yl, int yh)
|
|||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Shades all four spans to the screen starting at sx.
|
||||
|
|
@ -600,32 +482,6 @@ void rt_shaded4cols_c (int sx, int yl, int yh)
|
|||
source = &dc_temp[yl*4];
|
||||
pitch = dc_pitch;
|
||||
|
||||
#ifndef PALETTEOUTPUT
|
||||
uint32_t fg = shade_pal_index(dc_color, calc_light_multiplier(0));
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
||||
do {
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
uint32_t alpha = colormap[source[i]];
|
||||
uint32_t inv_alpha = 64 - alpha;
|
||||
|
||||
uint32_t bg_red = (dest[i] >> 16) & 0xff;
|
||||
uint32_t bg_green = (dest[i] >> 8) & 0xff;
|
||||
uint32_t bg_blue = (dest[i]) & 0xff;
|
||||
|
||||
uint32_t red = (fg_red * alpha + bg_red * inv_alpha) / 64;
|
||||
uint32_t green = (fg_green * alpha + bg_green * inv_alpha) / 64;
|
||||
uint32_t blue = (fg_blue * alpha + bg_blue * inv_alpha) / 64;
|
||||
|
||||
dest[i] = 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#else
|
||||
DWORD *fgstart;
|
||||
fgstart = &Col2RGB8[0][dc_color];
|
||||
|
||||
|
|
@ -651,11 +507,10 @@ void rt_shaded4cols_c (int sx, int yl, int yh)
|
|||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Adds one span at hx to the screen at sx with clamping.
|
||||
void rt_addclamp1col (int hx, int sx, int yl, int yh)
|
||||
void rt_addclamp1col_c (int hx, int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
canvas_pixel_t *source;
|
||||
|
|
@ -673,28 +528,6 @@ void rt_addclamp1col (int hx, int sx, int yl, int yh)
|
|||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
#ifndef PALETTEOUTPUT
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
|
||||
do {
|
||||
uint32_t fg = shade_pal_index(colormap[*source], light);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
||||
uint32_t bg_red = (*dest >> 16) & 0xff;
|
||||
uint32_t bg_green = (*dest >> 8) & 0xff;
|
||||
uint32_t bg_blue = (*dest) & 0xff;
|
||||
|
||||
uint32_t red = clamp<uint32_t>(fg_red + bg_red, 0, 255);
|
||||
uint32_t green = clamp<uint32_t>(fg_green + bg_green, 0, 255);
|
||||
uint32_t blue = clamp<uint32_t>(fg_blue + bg_blue, 0, 255);
|
||||
|
||||
*dest = 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#else
|
||||
DWORD *fg2rgb = dc_srcblend;
|
||||
DWORD *bg2rgb = dc_destblend;
|
||||
|
||||
|
|
@ -711,7 +544,6 @@ void rt_addclamp1col (int hx, int sx, int yl, int yh)
|
|||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Adds all four spans to the screen starting at sx with clamping.
|
||||
|
|
@ -733,31 +565,6 @@ void rt_addclamp4cols_c (int sx, int yl, int yh)
|
|||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
#ifndef PALETTEOUTPUT
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
|
||||
do {
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
uint32_t fg = shade_pal_index(colormap[source[i]], light);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
||||
uint32_t bg_red = (dest[i] >> 16) & 0xff;
|
||||
uint32_t bg_green = (dest[i] >> 8) & 0xff;
|
||||
uint32_t bg_blue = (dest[i]) & 0xff;
|
||||
|
||||
uint32_t red = clamp<uint32_t>(fg_red + bg_red, 0, 255);
|
||||
uint32_t green = clamp<uint32_t>(fg_green + bg_green, 0, 255);
|
||||
uint32_t blue = clamp<uint32_t>(fg_blue + bg_blue, 0, 255);
|
||||
|
||||
dest[i] = 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#else
|
||||
DWORD *fg2rgb = dc_srcblend;
|
||||
DWORD *bg2rgb = dc_destblend;
|
||||
|
||||
|
|
@ -802,25 +609,24 @@ void rt_addclamp4cols_c (int sx, int yl, int yh)
|
|||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Translates and adds one span at hx to the screen at sx with clamping.
|
||||
void rt_tlateaddclamp1col (int hx, int sx, int yl, int yh)
|
||||
void rt_tlateaddclamp1col_c (int hx, int sx, int yl, int yh)
|
||||
{
|
||||
rt_Translate1col(dc_translation, hx, yl, yh);
|
||||
rt_addclamp1col(hx, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Translates and adds all four spans to the screen starting at sx with clamping.
|
||||
void rt_tlateaddclamp4cols (int sx, int yl, int yh)
|
||||
void rt_tlateaddclamp4cols_c (int sx, int yl, int yh)
|
||||
{
|
||||
rt_Translate4cols(dc_translation, yl, yh);
|
||||
rt_addclamp4cols(sx, yl, yh);
|
||||
}
|
||||
|
||||
// Subtracts one span at hx to the screen at sx with clamping.
|
||||
void rt_subclamp1col (int hx, int sx, int yl, int yh)
|
||||
void rt_subclamp1col_c (int hx, int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
canvas_pixel_t *source;
|
||||
|
|
@ -838,28 +644,6 @@ void rt_subclamp1col (int hx, int sx, int yl, int yh)
|
|||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
#ifndef PALETTEOUTPUT
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
|
||||
do {
|
||||
uint32_t fg = shade_pal_index(colormap[*source], light);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
||||
uint32_t bg_red = (*dest >> 16) & 0xff;
|
||||
uint32_t bg_green = (*dest >> 8) & 0xff;
|
||||
uint32_t bg_blue = (*dest) & 0xff;
|
||||
|
||||
uint32_t red = clamp<uint32_t>(256 - fg_red + bg_red, 256, 256 + 255) - 256;
|
||||
uint32_t green = clamp<uint32_t>(256 - fg_green + bg_green, 256, 256 + 255) - 256;
|
||||
uint32_t blue = clamp<uint32_t>(256 - fg_blue + bg_blue, 256, 256 + 255) - 256;
|
||||
|
||||
*dest = 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#else
|
||||
DWORD *fg2rgb = dc_srcblend;
|
||||
DWORD *bg2rgb = dc_destblend;
|
||||
do {
|
||||
|
|
@ -874,11 +658,10 @@ void rt_subclamp1col (int hx, int sx, int yl, int yh)
|
|||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Subtracts all four spans to the screen starting at sx with clamping.
|
||||
void rt_subclamp4cols (int sx, int yl, int yh)
|
||||
void rt_subclamp4cols_c (int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
canvas_pixel_t *source;
|
||||
|
|
@ -896,32 +679,6 @@ void rt_subclamp4cols (int sx, int yl, int yh)
|
|||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
#ifndef PALETTEOUTPUT
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
|
||||
do {
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
uint32_t fg = shade_pal_index(colormap[source[i]], light);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
||||
uint32_t bg_red = (dest[i] >> 16) & 0xff;
|
||||
uint32_t bg_green = (dest[i] >> 8) & 0xff;
|
||||
uint32_t bg_blue = (dest[i]) & 0xff;
|
||||
|
||||
uint32_t red = clamp<uint32_t>(256 - fg_red + bg_red, 256, 256 + 255) - 256;
|
||||
uint32_t green = clamp<uint32_t>(256 - fg_green + bg_green, 256, 256 + 255) - 256;
|
||||
uint32_t blue = clamp<uint32_t>(256 - fg_blue + bg_blue, 256, 256 + 255) - 256;
|
||||
|
||||
dest[i] = 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#else
|
||||
DWORD *fg2rgb = dc_srcblend;
|
||||
DWORD *bg2rgb = dc_destblend;
|
||||
do {
|
||||
|
|
@ -961,25 +718,24 @@ void rt_subclamp4cols (int sx, int yl, int yh)
|
|||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Translates and subtracts one span at hx to the screen at sx with clamping.
|
||||
void rt_tlatesubclamp1col (int hx, int sx, int yl, int yh)
|
||||
void rt_tlatesubclamp1col_c (int hx, int sx, int yl, int yh)
|
||||
{
|
||||
rt_Translate1col(dc_translation, hx, yl, yh);
|
||||
rt_subclamp1col(hx, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Translates and subtracts all four spans to the screen starting at sx with clamping.
|
||||
void rt_tlatesubclamp4cols (int sx, int yl, int yh)
|
||||
void rt_tlatesubclamp4cols_c (int sx, int yl, int yh)
|
||||
{
|
||||
rt_Translate4cols(dc_translation, yl, yh);
|
||||
rt_subclamp4cols(sx, yl, yh);
|
||||
}
|
||||
|
||||
// Subtracts one span at hx from the screen at sx with clamping.
|
||||
void rt_revsubclamp1col (int hx, int sx, int yl, int yh)
|
||||
void rt_revsubclamp1col_c (int hx, int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
canvas_pixel_t *source;
|
||||
|
|
@ -999,28 +755,6 @@ void rt_revsubclamp1col (int hx, int sx, int yl, int yh)
|
|||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
#ifndef PALETTEOUTPUT
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
|
||||
do {
|
||||
uint32_t fg = shade_pal_index(colormap[*source], light);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
||||
uint32_t bg_red = (*dest >> 16) & 0xff;
|
||||
uint32_t bg_green = (*dest >> 8) & 0xff;
|
||||
uint32_t bg_blue = (*dest) & 0xff;
|
||||
|
||||
uint32_t red = clamp<uint32_t>(256 + fg_red - bg_red, 256, 256 + 255) - 256;
|
||||
uint32_t green = clamp<uint32_t>(256 + fg_green - bg_green, 256, 256 + 255) - 256;
|
||||
uint32_t blue = clamp<uint32_t>(256 + fg_blue - bg_blue, 256, 256 + 255) - 256;
|
||||
|
||||
*dest = 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#else
|
||||
do {
|
||||
DWORD a = (bg2rgb[*dest] | 0x40100400) - fg2rgb[colormap[*source]];
|
||||
DWORD b = a;
|
||||
|
|
@ -1033,11 +767,10 @@ void rt_revsubclamp1col (int hx, int sx, int yl, int yh)
|
|||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Subtracts all four spans from the screen starting at sx with clamping.
|
||||
void rt_revsubclamp4cols (int sx, int yl, int yh)
|
||||
void rt_revsubclamp4cols_c (int sx, int yl, int yh)
|
||||
{
|
||||
BYTE *colormap;
|
||||
canvas_pixel_t *source;
|
||||
|
|
@ -1057,32 +790,6 @@ void rt_revsubclamp4cols (int sx, int yl, int yh)
|
|||
pitch = dc_pitch;
|
||||
colormap = dc_colormap;
|
||||
|
||||
#ifndef PALETTEOUTPUT
|
||||
uint32_t light = calc_light_multiplier(dc_light);
|
||||
|
||||
do {
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
uint32_t fg = shade_pal_index(colormap[source[i]], light);
|
||||
uint32_t fg_red = (fg >> 16) & 0xff;
|
||||
uint32_t fg_green = (fg >> 8) & 0xff;
|
||||
uint32_t fg_blue = fg & 0xff;
|
||||
|
||||
uint32_t bg_red = (dest[i] >> 16) & 0xff;
|
||||
uint32_t bg_green = (dest[i] >> 8) & 0xff;
|
||||
uint32_t bg_blue = (dest[i]) & 0xff;
|
||||
|
||||
uint32_t red = clamp<uint32_t>(256 + fg_red - bg_red, 256, 256 + 255) - 256;
|
||||
uint32_t green = clamp<uint32_t>(256 + fg_green - bg_green, 256, 256 + 255) - 256;
|
||||
uint32_t blue = clamp<uint32_t>(256 + fg_blue - bg_blue, 256, 256 + 255) - 256;
|
||||
|
||||
dest[i] = 0xff000000 | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#else
|
||||
do {
|
||||
DWORD a = (bg2rgb[dest[0]] | 0x40100400) - fg2rgb[colormap[source[0]]];
|
||||
DWORD b = a;
|
||||
|
|
@ -1120,18 +827,17 @@ void rt_revsubclamp4cols (int sx, int yl, int yh)
|
|||
source += 4;
|
||||
dest += pitch;
|
||||
} while (--count);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Translates and subtracts one span at hx from the screen at sx with clamping.
|
||||
void rt_tlaterevsubclamp1col (int hx, int sx, int yl, int yh)
|
||||
void rt_tlaterevsubclamp1col_c (int hx, int sx, int yl, int yh)
|
||||
{
|
||||
rt_Translate1col(dc_translation, hx, yl, yh);
|
||||
rt_revsubclamp1col(hx, sx, yl, yh);
|
||||
}
|
||||
|
||||
// Translates and subtracts all four spans from the screen starting at sx with clamping.
|
||||
void rt_tlaterevsubclamp4cols (int sx, int yl, int yh)
|
||||
void rt_tlaterevsubclamp4cols_c (int sx, int yl, int yh)
|
||||
{
|
||||
rt_Translate4cols(dc_translation, yl, yh);
|
||||
rt_revsubclamp4cols(sx, yl, yh);
|
||||
|
|
@ -1301,7 +1007,7 @@ void rt_draw4cols (int sx)
|
|||
|
||||
// Before each pass through a rendering loop that uses these routines,
|
||||
// call this function to set up the span pointers.
|
||||
void rt_initcols (canvas_pixel_t *buff)
|
||||
void rt_initcols_pal (canvas_pixel_t *buff)
|
||||
{
|
||||
int y;
|
||||
|
||||
|
|
@ -1372,7 +1078,7 @@ void R_DrawColumnHorizP_C (void)
|
|||
}
|
||||
|
||||
// [RH] Just fills a column with a given color
|
||||
void R_FillColumnHorizP (void)
|
||||
void R_FillColumnHorizP_C (void)
|
||||
{
|
||||
int count = dc_count;
|
||||
BYTE color = dc_color;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue