Skip to content

Commit

Permalink
- Fix pixel center sampling bug in SWCanvas::DrawTexture
Browse files Browse the repository at this point in the history
  • Loading branch information
dpjudas committed Jul 22, 2017
1 parent c56cd24 commit 3ff0216
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/swrenderer/r_swcanvas.cpp
Expand Up @@ -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
// precision for y0. :(
double sprtopscreen;
modf(y0, &sprtopscreen);
modf(y0 + 0.5, &sprtopscreen);

double yscale = parms.destheight / img->GetHeight();
double iyscale = 1 / yscale;
Expand Down Expand Up @@ -192,6 +192,8 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms)
int x2_i = int(x2);
fixed_t xiscale_i = FLOAT2FIXED(xiscale);

frac += xiscale_i / 2;

while (x < x2_i)
{
drawerargs.DrawMaskedColumn(&thread, x, iscale, img, frac, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, !parms.masked);
Expand Down

0 comments on commit 3ff0216

Please sign in to comment.