VK: Add extra safety checks around font texture creation. Motivated by some Play crashes.

This commit is contained in:
Henrik Rydgård committed 2018-11-21 17:33:30 +01:00
1 parent c73b13781c
commit 7af93d08cf
4 files changed
+41 -18

No files matched your search

@@ -56,10 +56,15 @@ public class TextRenderer {
total.y = (int) (p.descent() - p.ascent()) * lines.length + 2;
// Returning a 0 size can create problems when the caller
// uses the measurement to create a texture.
// Also, clamp to a reasonable maximum size.
if (total.x < 1)
total.x = 1;
if (total.y < 1)
total.y = 1;
if (total.x > 2048)
total.x = 2048;
if (total.y > 2048)
total.y = 2048;
return total;
}