diff --git a/android/src/org/ppsspp/ppsspp/TextRenderer.java b/android/src/org/ppsspp/ppsspp/TextRenderer.java index db8f6929da..cd8ced4cd4 100644 --- a/android/src/org/ppsspp/ppsspp/TextRenderer.java +++ b/android/src/org/ppsspp/ppsspp/TextRenderer.java @@ -18,10 +18,11 @@ public class TextRenderer { Rect bound = new Rect(); p.setTextSize(textSize); p.getTextBounds(string, 0, string.length(), bound); + float baseline = -p.ascent(); Bitmap bmp = Bitmap.createBitmap(bound.width(), bound.height(), Bitmap.Config.ARGB_4444); Canvas canvas = new Canvas(bmp); p.setColor(Color.WHITE); - canvas.drawText(string, 0, 0, p); + canvas.drawText(string, 0, baseline, p); int bufSize = bmp.getRowBytes() * bmp.getHeight() * 2; // 2 = sizeof(ARGB_4444) ByteBuffer buf = ByteBuffer.allocate(bufSize); @@ -37,7 +38,6 @@ public class TextRenderer { int dstOffset = y * bound.width(); for (int x = 0; x < bound.width(); x++) { int val = bytes[srcOffset + x * 2]; - val = (val << 12) | 0xFFF; output[dstOffset + x] = (short)val; } } diff --git a/ext/native/gfx_es2/draw_text_android.cpp b/ext/native/gfx_es2/draw_text_android.cpp index 885a51e35a..253cf29cc4 100644 --- a/ext/native/gfx_es2/draw_text_android.cpp +++ b/ext/native/gfx_es2/draw_text_android.cpp @@ -135,7 +135,10 @@ void TextDrawerAndroid::DrawString(DrawBuffer &target, const char *str, float x, jshort* jimage = env_->GetShortArrayElements(imageData, nullptr); for (int x = 0; x < entry->bmWidth; x++) { for (int y = 0; y < entry->bmHeight; y++) { - bitmapData[entry->bmWidth * y + x] = jimage[imageWidth * y + x]; + int v = jimage[imageWidth * y + x]; + v = (v << 4) | v; + v = (v << 8) | v; + bitmapData[entry->bmWidth * y + x] = v; } } env_->ReleaseShortArrayElements(imageData, jimage, 0); diff --git a/ext/native/thin3d/thin3d_vulkan.cpp b/ext/native/thin3d/thin3d_vulkan.cpp index dc31b63459..69c24fa1bc 100644 --- a/ext/native/thin3d/thin3d_vulkan.cpp +++ b/ext/native/thin3d/thin3d_vulkan.cpp @@ -675,6 +675,9 @@ enum class TextureState { }; bool VKTexture::Create(const TextureDesc &desc) { + // Zero-sized textures not allowed. + if (desc.width * desc.height * desc.depth == 0) + return false; format_ = desc.format; mipLevels_ = desc.mipLevels; width_ = desc.width;