mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 05:21:16 +00:00
Fix vid_hw2d 0 translation bug
This commit is contained in:
parent
93f43e8751
commit
10b36934c2
4 changed files with 17 additions and 29 deletions
|
@ -19,7 +19,6 @@ namespace swrenderer
|
|||
void DrawerArgs::SetLight(FSWColormap *base_colormap, float light, int shade)
|
||||
{
|
||||
mBaseColormap = base_colormap;
|
||||
mTranslation = nullptr;
|
||||
mLight = light;
|
||||
mShade = shade;
|
||||
}
|
||||
|
|
|
@ -480,11 +480,7 @@ namespace swrenderer
|
|||
SetLight(&identitycolormap, 0, 0);
|
||||
}
|
||||
|
||||
if (!SpriteDrawerArgs::SetBlendFunc(style.BlendOp, fglevel, bglevel, style.Flags))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return SpriteDrawerArgs::SetBlendFunc(style.BlendOp, fglevel, bglevel, style.Flags);
|
||||
}
|
||||
|
||||
bool SpriteDrawerArgs::SetStyle(FRenderStyle style, float alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade)
|
||||
|
@ -492,20 +488,6 @@ namespace swrenderer
|
|||
return SetStyle(style, FLOAT2FIXED(alpha), translation, color, basecolormap, shadedlightshade);
|
||||
}
|
||||
|
||||
bool SpriteDrawerArgs::SetStyle(FRenderStyle style, float alpha, lighttable_t *translation, uint32_t color)
|
||||
{
|
||||
SetTranslationMap(translation);
|
||||
SetLight(nullptr, 0.0f, 0);
|
||||
|
||||
FDynamicColormap *basecolormap = &identitycolormap;
|
||||
if (!SetStyle(style, alpha, -1, color, basecolormap))
|
||||
return false;
|
||||
|
||||
if (!Colormap())
|
||||
SetTranslationMap(identitymap);
|
||||
return true;
|
||||
}
|
||||
|
||||
void SpriteDrawerArgs::FillColumn(RenderThread *thread)
|
||||
{
|
||||
thread->Drawers()->FillColumn(*this);
|
||||
|
|
|
@ -18,7 +18,6 @@ namespace swrenderer
|
|||
|
||||
bool SetStyle(FRenderStyle style, fixed_t alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade = 0);
|
||||
bool SetStyle(FRenderStyle style, float alpha, int translation, uint32_t color, FDynamicColormap *&basecolormap, fixed_t shadedlightshade = 0);
|
||||
bool SetStyle(FRenderStyle style, float alpha, lighttable_t *translation, uint32_t color);
|
||||
void SetDest(int x, int y);
|
||||
void SetCount(int count) { dc_count = count; }
|
||||
void SetSolidColor(int color) { dc_color = color; }
|
||||
|
|
|
@ -192,14 +192,15 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
|
|||
using namespace swrenderer;
|
||||
|
||||
static short bottomclipper[MAXWIDTH], topclipper[MAXWIDTH];
|
||||
lighttable_t *translation = NULL;
|
||||
|
||||
auto viewport = RenderViewport::Instance();
|
||||
|
||||
viewport->RenderTarget = screen;
|
||||
|
||||
viewport->RenderTarget->Lock(true);
|
||||
|
||||
lighttable_t *translation = nullptr;
|
||||
FDynamicColormap *basecolormap = &identitycolormap;
|
||||
int shade = 0;
|
||||
|
||||
if (APART(parms.colorOverlay) != 0)
|
||||
{
|
||||
// The software renderer cannot invert the source without inverting the overlay
|
||||
|
@ -216,10 +217,15 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
|
|||
parms.colorOverlay = PalEntry(parms.colorOverlay).InverseColor();
|
||||
}
|
||||
// Note that this overrides the translation in software, but not in hardware.
|
||||
if (!viewport->RenderTarget->IsBgra())
|
||||
FDynamicColormap *colormap = GetSpecialLights(MAKERGB(255, 255, 255), parms.colorOverlay & MAKEARGB(0, 255, 255, 255), 0);
|
||||
|
||||
if (viewport->RenderTarget->IsBgra())
|
||||
{
|
||||
basecolormap = colormap;
|
||||
shade = (APART(parms.colorOverlay)*NUMCOLORMAPS / 255) << FRACBITS;
|
||||
}
|
||||
else
|
||||
{
|
||||
FDynamicColormap *colormap = GetSpecialLights(MAKERGB(255, 255, 255),
|
||||
parms.colorOverlay & MAKEARGB(0, 255, 255, 255), 0);
|
||||
translation = &colormap->Maps[(APART(parms.colorOverlay)*NUMCOLORMAPS / 255) * 256];
|
||||
}
|
||||
}
|
||||
|
@ -233,8 +239,10 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
|
|||
|
||||
SpriteDrawerArgs drawerargs;
|
||||
|
||||
bool visible = drawerargs.SetStyle(parms.style, parms.Alpha, translation, parms.fillcolor);
|
||||
|
||||
drawerargs.SetTranslationMap(translation);
|
||||
drawerargs.SetLight(basecolormap, 0.0f, shade);
|
||||
bool visible = drawerargs.SetStyle(parms.style, parms.Alpha, -1, parms.fillcolor, basecolormap);
|
||||
|
||||
double x0 = parms.x - parms.left * parms.destwidth / parms.texwidth;
|
||||
double y0 = parms.y - parms.top * parms.destheight / parms.texheight;
|
||||
|
||||
|
|
Loading…
Reference in a new issue