Change redundant bRenderingToCanvas into a helper function

This commit is contained in:
Magnus Norddahl 2017-02-01 21:59:48 +01:00
parent bb0a223b80
commit ca93d7456a
5 changed files with 4 additions and 7 deletions

View file

@ -85,7 +85,6 @@ void PolyRenderer::RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int
viewwidth = width;
viewport->RenderTarget = canvas;
viewport->bRenderingToCanvas = true;
R_SetWindow(12, width, height, height, true);
viewport->SetViewport(width, height, WidescreenRatio);
viewwindowx = x;
@ -99,7 +98,6 @@ void PolyRenderer::RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int
canvas->Unlock();
viewport->RenderTarget = screen;
viewport->bRenderingToCanvas = false;
R_ExecuteSetViewSize();
float trueratio;
ActiveRatio(width, height, &trueratio);

View file

@ -815,7 +815,7 @@ namespace swrenderer
auto viewport = RenderViewport::Instance();
// clip ceiling to console bottom
fillshort(floorclip, viewwidth, viewheight);
fillshort(ceilingclip, viewwidth, !screen->Accel2D && ConBottom > viewwindowy && !viewport->bRenderingToCanvas ? (ConBottom - viewwindowy) : 0);
fillshort(ceilingclip, viewwidth, !screen->Accel2D && ConBottom > viewwindowy && !viewport->RenderingToCanvas() ? (ConBottom - viewwindowy) : 0);
}
void RenderOpaquePass::AddSprites(sector_t *sec, int lightlevel, WaterFakeSide fakeside, bool foggy, FDynamicColormap *basecolormap)

View file

@ -199,7 +199,6 @@ namespace swrenderer
viewwidth = width;
viewport->RenderTarget = canvas;
viewport->bRenderingToCanvas = true;
R_SetWindow(12, width, height, height, true);
viewwindowx = x;
@ -212,7 +211,6 @@ namespace swrenderer
R_EndDrawerCommands();
viewport->RenderTarget = screen;
viewport->bRenderingToCanvas = false;
R_ExecuteSetViewSize();
float trueratio;

View file

@ -48,7 +48,7 @@ namespace swrenderer
{
int virtheight, virtwidth, virtwidth2, virtheight2;
if (!bRenderingToCanvas)
if (!RenderingToCanvas())
{ // Set r_viewsize cvar to reflect the current view size
UCVarValue value;
char temp[16];

View file

@ -27,7 +27,6 @@ namespace swrenderer
void SetupFreelook();
DCanvas *RenderTarget = nullptr;
bool bRenderingToCanvas = false;
fixed_t viewingrangerecip = 0;
double FocalLengthX = 0.0;
double FocalLengthY = 0.0;
@ -47,6 +46,8 @@ namespace swrenderer
uint8_t *dc_destorg = nullptr;
bool RenderingToCanvas() const { return RenderTarget != screen; }
private:
void InitTextureMapping();
void SetupBuffer();