Skip to content

Commit f2798f9

Browse files
committed
Make rectangle rendering pixel-perfect
Offsetting two of the borders renders all of the corners (previously, the top-left pixel was left out) and ensures that semitransparent pixels are not double-rendered. Pixel-perfection still depends on drivers not stuffing up line rendering; 0.5px should probably be added to all coordinates at some point.
1 parent fdd7f25 commit f2798f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crawl-ref/source/tilebuf.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ void LineBuffer::add(float pos_sx, float pos_sy, float pos_ex, float pos_ey,
318318
void LineBuffer::add_square(float sx, float sy, float ex, float ey,
319319
const VColour &col)
320320
{
321-
add(sx, sy, ex, sy, col);
322-
add(ex, sy, ex, ey, col);
321+
add(sx-1, sy, ex-1, sy, col);
322+
add(ex, sy-1, ex, ey-1, col);
323323
add(ex, ey, sx, ey, col);
324324
add(sx, ey, sx, sy, col);
325325
}

0 commit comments

Comments
 (0)