mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-06 04:33:49 +01:00
Set a minimum of 1x1 for Android text bitmap measurement.
Should fix some crashes seen on Google Play
This commit is contained in:
1 parent
773dba1be2
commit
8e6a1bc849
2 files changed
+7
-6
No files matched your search
@@ -54,6 +54,12 @@ public class TextRenderer {
|
||||
total.x = Math.max(sz.x, total.x);
|
||||
}
|
||||
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.
|
||||
if (total.x < 1)
|
||||
total.x = 1;
|
||||
if (total.y < 1)
|
||||
total.y = 1;
|
||||
return total;
|
||||
}
|
||||
|
||||
@@ -67,10 +73,6 @@ public class TextRenderer {
|
||||
|
||||
int w = s.x;
|
||||
int h = s.y;
|
||||
if (w == 0)
|
||||
w = 1;
|
||||
if (h == 0)
|
||||
h = 1;
|
||||
|
||||
Bitmap bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bmp);
|
||||
|
||||
Reference in new issue
Block a user