- Fix pixel center sampling bug in SWCanvas::DrawTexture

This commit is contained in:
Magnus Norddahl 2017-07-22 10:40:30 +02:00
parent c56cd245ac
commit 3ff021608d
1 changed files with 3 additions and 1 deletions

View File

@ -128,7 +128,7 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms)
// There is not enough precision in the drawing routines to keep the full // There is not enough precision in the drawing routines to keep the full
// precision for y0. :( // precision for y0. :(
double sprtopscreen; double sprtopscreen;
modf(y0, &sprtopscreen); modf(y0 + 0.5, &sprtopscreen);
double yscale = parms.destheight / img->GetHeight(); double yscale = parms.destheight / img->GetHeight();
double iyscale = 1 / yscale; double iyscale = 1 / yscale;
@ -192,6 +192,8 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms)
int x2_i = int(x2); int x2_i = int(x2);
fixed_t xiscale_i = FLOAT2FIXED(xiscale); fixed_t xiscale_i = FLOAT2FIXED(xiscale);
frac += xiscale_i / 2;
while (x < x2_i) while (x < x2_i)
{ {
drawerargs.DrawMaskedColumn(&thread, x, iscale, img, frac, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, !parms.masked); drawerargs.DrawMaskedColumn(&thread, x, iscale, img, frac, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, !parms.masked);