Merge R_SetupSpanBits with R_SetSpanSource and rename it to R_SetSpanTexture

This commit is contained in:
Magnus Norddahl 2016-12-27 07:30:29 +01:00
parent 4d0cc9e7bb
commit 5a7765910f
4 changed files with 7 additions and 15 deletions

View file

@ -601,7 +601,7 @@ namespace swrenderer
}
}
void R_SetupSpanBits(FTexture *tex)
void R_SetSpanTexture(FTexture *tex)
{
using namespace drawerargs;
@ -616,6 +616,9 @@ namespace swrenderer
{
ds_ybits--;
}
ds_source = r_swtruecolor ? (const uint8_t*)tex->GetPixelsBgra() : tex->GetPixels();
ds_source_mipmapped = tex->Mipmapped() && tex->GetWidth() > 1 && tex->GetHeight() > 1;
}
void R_SetSpanColormap(FDynamicColormap *colormap, int shade)
@ -623,14 +626,6 @@ namespace swrenderer
R_SetDSColorMapLight(colormap, 0, shade);
}
void R_SetSpanSource(FTexture *tex)
{
using namespace drawerargs;
ds_source = r_swtruecolor ? (const uint8_t*)tex->GetPixelsBgra() : tex->GetPixels();
ds_source_mipmapped = tex->Mipmapped() && tex->GetWidth() > 1 && tex->GetHeight() > 1;
}
/////////////////////////////////////////////////////////////////////////
void R_DrawWallColumn()

View file

@ -178,9 +178,8 @@ namespace swrenderer
void R_SetDSColorMapLight(FSWColormap *base_colormap, float light, int shade);
void R_SetTranslationMap(lighttable_t *translation);
void R_SetupSpanBits(FTexture *tex);
void R_SetSpanTexture(FTexture *tex);
void R_SetSpanColormap(FDynamicColormap *colormap, int shade);
void R_SetSpanSource(FTexture *tex);
void R_MapTiltedPlane(int y, int x1);
void R_MapColoredPlane(int y, int x1);

View file

@ -1179,10 +1179,9 @@ void R_DrawSinglePlane (visplane_t *pl, fixed_t alpha, bool additive, bool maske
{ // Don't waste time on a masked texture if it isn't really masked.
masked = false;
}
R_SetupSpanBits(tex);
R_SetSpanTexture(tex);
double xscale = pl->xform.xScale * tex->Scale.X;
double yscale = pl->xform.yScale * tex->Scale.Y;
R_SetSpanSource(tex);
basecolormap = pl->colormap;
planeshade = LIGHT2SHADE(pl->lightlevel);

View file

@ -1379,12 +1379,11 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
sinrot = sin(rotation.Radians());
// Setup constant texture mapping parameters.
R_SetupSpanBits(tex);
R_SetSpanTexture(tex);
if (colormap)
R_SetSpanColormap(colormap, clamp(shade >> FRACBITS, 0, NUMCOLORMAPS - 1));
else
R_SetSpanColormap(&identitycolormap, 0);
R_SetSpanSource(tex);
if (ds_xbits != 0)
{
scalex = double(1u << (32 - ds_xbits)) / scalex;