Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5129136

Browse files
committed
Merge pull request #5432 from mdboom/fix-segfault-in-text-drawing
Don't draw text when it's completely clipped away
1 parent 4a2a186 commit 5129136

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/_backend_agg.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -788,9 +788,11 @@ inline void RendererAgg::draw_text_image(GCAgg &gc, ImageArray &image, int x, in
788788
text.clip(clip);
789789
}
790790

791-
for (int yi = text.y1; yi < text.y2; ++yi) {
792-
pixFmt.blend_solid_hspan(text.x1, yi, (text.x2 - text.x1), gc.color,
793-
&image(yi - (y - image.dim(0)), text.x1 - x));
791+
if (text.x2 > text.x1) {
792+
for (int yi = text.y1; yi < text.y2; ++yi) {
793+
pixFmt.blend_solid_hspan(text.x1, yi, (text.x2 - text.x1), gc.color,
794+
&image(yi - (y - image.dim(0)), text.x1 - x));
795+
}
794796
}
795797
}
796798
}

0 commit comments

Comments
 (0)