Font: Fix clipping when x/y aren't 0.

The final X2/Y2 are relative to the glyph at x,y.
This commit is contained in:
Unknown W. Brackets committed 2016-01-23 16:01:25 -08:00
1 parent b8a2a6647d
commit e8fb61cf43
1 file changed
+2 -2
+2 -2
View File
@@ -637,8 +637,8 @@ void PGF::DrawCharacter(const GlyphImage *image, int clipX, int clipY, int clipW
int renderX1 = std::max(clipX, x) - x;
int renderY1 = std::max(clipY, y) - y;
// We can render up to frac beyond the glyph w/h, so add 1px if necessary.
int renderX2 = std::min(clipX + clipWidth, glyph.w + (xFrac > 0 ? 1 : 0));
int renderY2 = std::min(clipY + clipHeight, glyph.h + (yFrac > 0 ? 1 : 0));
int renderX2 = std::min(clipX + clipWidth - x, glyph.w + (xFrac > 0 ? 1 : 0));
int renderY2 = std::min(clipY + clipHeight - y, glyph.h + (yFrac > 0 ? 1 : 0));
if (xFrac == 0 && yFrac == 0) {
for (int yy = renderY1; yy < renderY2; ++yy) {