Permalink
Browse files

Try harder to free up memory from the Android native font rendering s…

…ystem. Might help #10069
  • Loading branch information...
hrydgard committed Nov 7, 2017
1 parent 7922a2a commit 4970668b99200eb1c90693a5baf07657caeb43ae
Showing with 2 additions and 3 deletions.
  1. +1 −0 android/src/org/ppsspp/ppsspp/TextRenderer.java
  2. +1 −3 ext/native/gfx_es2/draw_text_android.cpp
@@ -57,6 +57,7 @@ public static int measureText(String string, double textSize) {
int [] pixels = new int[w * h];
bmp.getPixels(pixels, 0, w, 0, 0, w, h);
bmp.recycle();
return pixels;
}
}
@@ -164,9 +164,6 @@ void TextDrawerAndroid::DrawString(DrawBuffer &target, const char *str, float x,
std::string text(NormalizeString(std::string(str)));
if (text.empty())
return;
JNIEnv *env;
int result = javaVM->GetEnv((void **)&env, JNI_VERSION_1_6);
assert(env == env_);
uint32_t stringHash = hash::Adler32((const uint8_t *)text.data(), text.size());
uint32_t entryHash = stringHash ^ fontHash_ ^ (align << 24);
@@ -221,6 +218,7 @@ void TextDrawerAndroid::DrawString(DrawBuffer &target, const char *str, float x,
}
}
env_->ReleaseIntArrayElements(imageData, jimage, 0);
env_->DeleteLocalRef(imageData);
desc.initData.push_back((uint8_t *)bitmapData);
entry->texture = draw_->CreateTexture(desc);
delete[] bitmapData;

0 comments on commit 4970668

Please sign in to comment.