From 36a23d60b81c0550ce87f2204a3ea86629fcbeca Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Mon, 30 Jan 2017 05:26:57 +0100 Subject: [PATCH] Make spanfunc private and local to SpanDrawerArgs --- src/swrenderer/drawers/r_drawerargs.cpp | 11 ++++++++++- src/swrenderer/drawers/r_drawerargs.h | 9 +++++++-- src/swrenderer/plane/r_flatplane.cpp | 2 +- src/v_draw.cpp | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/swrenderer/drawers/r_drawerargs.cpp b/src/swrenderer/drawers/r_drawerargs.cpp index f98db9a43c..880166d303 100644 --- a/src/swrenderer/drawers/r_drawerargs.cpp +++ b/src/swrenderer/drawers/r_drawerargs.cpp @@ -65,6 +65,10 @@ namespace swrenderer basecolfunc = &SWPixelFormatDrawers::DrawColumn; fuzzcolfunc = &SWPixelFormatDrawers::DrawFuzzColumn; transcolfunc = &SWPixelFormatDrawers::DrawTranslatedColumn; + } + + SpanDrawerArgs::SpanDrawerArgs() + { spanfunc = &SWPixelFormatDrawers::DrawSpan; } @@ -617,7 +621,7 @@ namespace swrenderer return nullptr; } - void DrawerArgs::SetSpanStyle(bool masked, bool additive, fixed_t alpha) + void SpanDrawerArgs::SetSpanStyle(bool masked, bool additive, fixed_t alpha) { if (masked) { @@ -673,6 +677,11 @@ namespace swrenderer } } + void SpanDrawerArgs::DrawSpan() + { + (Drawers()->*spanfunc)(*this); + } + void SpanDrawerArgs::DrawTiltedSpan(int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy, FDynamicColormap *basecolormap) { Drawers()->DrawTiltedSpan(*this, y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy, basecolormap); diff --git a/src/swrenderer/drawers/r_drawerargs.h b/src/swrenderer/drawers/r_drawerargs.h index 3e8fd0ee5e..8ce0f821ed 100644 --- a/src/swrenderer/drawers/r_drawerargs.h +++ b/src/swrenderer/drawers/r_drawerargs.h @@ -46,7 +46,6 @@ namespace swrenderer bool SetPatchStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade = 0); bool SetPatchStyle(FRenderStyle style, float alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade = 0); - void SetSpanStyle(bool masked, bool additive, fixed_t alpha); void SetColorMapLight(FSWColormap *base_colormap, float light, int shade); void SetTranslationMap(lighttable_t *translation); @@ -63,7 +62,6 @@ namespace swrenderer ColumnDrawerFunc basecolfunc; ColumnDrawerFunc fuzzcolfunc; ColumnDrawerFunc transcolfunc; - SpanDrawerFunc spanfunc; uint32_t *dc_srcblend; uint32_t *dc_destblend; @@ -144,8 +142,12 @@ namespace swrenderer class SpanDrawerArgs : public DrawerArgs { public: + SpanDrawerArgs(); + + void SetSpanStyle(bool masked, bool additive, fixed_t alpha); void SetSpanTexture(FTexture *tex); + void DrawSpan(); void DrawTiltedSpan(int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy, FDynamicColormap *basecolormap); void DrawColoredSpan(int y, int x1, int x2); void DrawFogBoundaryLine(int y, int x1, int x2); @@ -170,6 +172,9 @@ namespace swrenderer FVector3 dc_viewpos_step; TriLight *dc_lights = nullptr; int dc_num_lights = 0; + + private: + SpanDrawerFunc spanfunc; }; class ColumnDrawerArgs : public DrawerArgs diff --git a/src/swrenderer/plane/r_flatplane.cpp b/src/swrenderer/plane/r_flatplane.cpp index 45ffa790e8..0663d02bfa 100644 --- a/src/swrenderer/plane/r_flatplane.cpp +++ b/src/swrenderer/plane/r_flatplane.cpp @@ -254,7 +254,7 @@ namespace swrenderer drawerargs.ds_x1 = x1; drawerargs.ds_x2 = x2; - (drawerargs.Drawers()->*drawerargs.spanfunc)(drawerargs); + drawerargs.DrawSpan(); } void RenderFlatPlane::StepColumn() diff --git a/src/v_draw.cpp b/src/v_draw.cpp index a016272d06..f7e9520ef2 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -1491,7 +1491,7 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints, drawerargs.ds_xfrac = xs_RoundToInt(tex.X * scalex); drawerargs.ds_yfrac = xs_RoundToInt(tex.Y * scaley); - (drawerargs.Drawers()->*drawerargs.spanfunc)(drawerargs); + drawerargs.DrawSpan(); #endif } x += xinc;