mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-13 16:07:40 +00:00
Remove R_InitColumnDrawers and only allow DrawerArgs classes to call drawers
This commit is contained in:
parent
c486892c4a
commit
c574b0ad3f
4 changed files with 29 additions and 49 deletions
|
@ -39,24 +39,18 @@
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
namespace
|
SWPixelFormatDrawers *DrawerArgs::Drawers()
|
||||||
{
|
|
||||||
SWPixelFormatDrawers *active_drawers;
|
|
||||||
SWPalDrawers pal_drawers;
|
|
||||||
SWTruecolorDrawers tc_drawers;
|
|
||||||
}
|
|
||||||
|
|
||||||
void R_InitColumnDrawers()
|
|
||||||
{
|
{
|
||||||
if (r_swtruecolor)
|
if (r_swtruecolor)
|
||||||
active_drawers = &tc_drawers;
|
{
|
||||||
|
static SWTruecolorDrawers tc_drawers;
|
||||||
|
return &tc_drawers;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
active_drawers = &pal_drawers;
|
{
|
||||||
}
|
static SWPalDrawers pal_drawers;
|
||||||
|
return &pal_drawers;
|
||||||
SWPixelFormatDrawers *DrawerArgs::Drawers() const
|
}
|
||||||
{
|
|
||||||
return active_drawers;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteDrawerArgs::SpriteDrawerArgs()
|
SpriteDrawerArgs::SpriteDrawerArgs()
|
||||||
|
|
|
@ -19,25 +19,7 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
class SWPixelFormatDrawers;
|
class SWPixelFormatDrawers;
|
||||||
class DrawerArgs;
|
class DrawerArgs;
|
||||||
|
struct ShadeConstants;
|
||||||
struct ShadeConstants
|
|
||||||
{
|
|
||||||
uint16_t light_alpha;
|
|
||||||
uint16_t light_red;
|
|
||||||
uint16_t light_green;
|
|
||||||
uint16_t light_blue;
|
|
||||||
uint16_t fade_alpha;
|
|
||||||
uint16_t fade_red;
|
|
||||||
uint16_t fade_green;
|
|
||||||
uint16_t fade_blue;
|
|
||||||
uint16_t desaturate;
|
|
||||||
bool simple_shade;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef void(SWPixelFormatDrawers::*DrawerFunc)(const DrawerArgs &args);
|
|
||||||
typedef void(SWPixelFormatDrawers::*WallDrawerFunc)(const WallDrawerArgs &args);
|
|
||||||
typedef void(SWPixelFormatDrawers::*SpriteDrawerFunc)(const SpriteDrawerArgs &args);
|
|
||||||
typedef void(SWPixelFormatDrawers::*SpanDrawerFunc)(const SpanDrawerArgs &args);
|
|
||||||
|
|
||||||
class DrawerArgs
|
class DrawerArgs
|
||||||
{
|
{
|
||||||
|
@ -51,7 +33,8 @@ namespace swrenderer
|
||||||
ShadeConstants ColormapConstants() const;
|
ShadeConstants ColormapConstants() const;
|
||||||
fixed_t Light() const { return LIGHTSCALE(mLight, mShade); }
|
fixed_t Light() const { return LIGHTSCALE(mLight, mShade); }
|
||||||
|
|
||||||
SWPixelFormatDrawers *Drawers() const;
|
protected:
|
||||||
|
static SWPixelFormatDrawers *Drawers();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FSWColormap *mBaseColormap = nullptr;
|
FSWColormap *mBaseColormap = nullptr;
|
||||||
|
@ -123,6 +106,7 @@ namespace swrenderer
|
||||||
int dc_num_lights = 0;
|
int dc_num_lights = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
typedef void(SWPixelFormatDrawers::*SpanDrawerFunc)(const SpanDrawerArgs &args);
|
||||||
SpanDrawerFunc spanfunc;
|
SpanDrawerFunc spanfunc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -164,6 +148,7 @@ namespace swrenderer
|
||||||
uint8_t *dc_dest = nullptr;
|
uint8_t *dc_dest = nullptr;
|
||||||
int dc_dest_y = 0;
|
int dc_dest_y = 0;
|
||||||
|
|
||||||
|
typedef void(SWPixelFormatDrawers::*WallDrawerFunc)(const WallDrawerArgs &args);
|
||||||
WallDrawerFunc wallfunc = nullptr;
|
WallDrawerFunc wallfunc = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -213,8 +198,21 @@ namespace swrenderer
|
||||||
int dc_dest_y = 0;
|
int dc_dest_y = 0;
|
||||||
bool drawer_needs_pal_input = false;
|
bool drawer_needs_pal_input = false;
|
||||||
|
|
||||||
|
typedef void(SWPixelFormatDrawers::*SpriteDrawerFunc)(const SpriteDrawerArgs &args);
|
||||||
SpriteDrawerFunc colfunc;
|
SpriteDrawerFunc colfunc;
|
||||||
};
|
};
|
||||||
|
|
||||||
void R_InitColumnDrawers();
|
struct ShadeConstants
|
||||||
|
{
|
||||||
|
uint16_t light_alpha;
|
||||||
|
uint16_t light_red;
|
||||||
|
uint16_t light_green;
|
||||||
|
uint16_t light_blue;
|
||||||
|
uint16_t fade_alpha;
|
||||||
|
uint16_t fade_red;
|
||||||
|
uint16_t fade_green;
|
||||||
|
uint16_t fade_blue;
|
||||||
|
uint16_t desaturate;
|
||||||
|
bool simple_shade;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,6 @@ namespace swrenderer
|
||||||
if (r_swtruecolor != screen->IsBgra())
|
if (r_swtruecolor != screen->IsBgra())
|
||||||
{
|
{
|
||||||
r_swtruecolor = screen->IsBgra();
|
r_swtruecolor = screen->IsBgra();
|
||||||
R_InitColumnDrawers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_clearbuffer != 0)
|
if (r_clearbuffer != 0)
|
||||||
|
@ -202,7 +201,6 @@ namespace swrenderer
|
||||||
if (r_swtruecolor != canvas->IsBgra())
|
if (r_swtruecolor != canvas->IsBgra())
|
||||||
{
|
{
|
||||||
r_swtruecolor = canvas->IsBgra();
|
r_swtruecolor = canvas->IsBgra();
|
||||||
R_InitColumnDrawers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
R_BeginDrawerCommands();
|
R_BeginDrawerCommands();
|
||||||
|
@ -233,11 +231,6 @@ namespace swrenderer
|
||||||
|
|
||||||
viewactive = savedviewactive;
|
viewactive = savedviewactive;
|
||||||
r_swtruecolor = savedoutputformat;
|
r_swtruecolor = savedoutputformat;
|
||||||
|
|
||||||
if (r_swtruecolor != canvas->IsBgra())
|
|
||||||
{
|
|
||||||
R_InitColumnDrawers();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderScene::ScreenResized()
|
void RenderScene::ScreenResized()
|
||||||
|
@ -259,7 +252,6 @@ namespace swrenderer
|
||||||
fillshort(zeroarray, MAXWIDTH, 0);
|
fillshort(zeroarray, MAXWIDTH, 0);
|
||||||
|
|
||||||
R_InitShadeMaps();
|
R_InitShadeMaps();
|
||||||
R_InitColumnDrawers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderScene::Deinit()
|
void RenderScene::Deinit()
|
||||||
|
|
|
@ -147,11 +147,7 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
|
||||||
static short bottomclipper[MAXWIDTH], topclipper[MAXWIDTH];
|
static short bottomclipper[MAXWIDTH], topclipper[MAXWIDTH];
|
||||||
const BYTE *translation = NULL;
|
const BYTE *translation = NULL;
|
||||||
|
|
||||||
if (r_swtruecolor != IsBgra())
|
r_swtruecolor = IsBgra();
|
||||||
{
|
|
||||||
r_swtruecolor = IsBgra();
|
|
||||||
R_InitColumnDrawers();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (APART(parms.colorOverlay) != 0)
|
if (APART(parms.colorOverlay) != 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue