summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-04-28 12:28:47 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-04-28 12:28:47 -0700
commit77c9990ae0806575ae7a2750459f3e74f0bec092 (patch)
tree994af71a7483f19d8fc0ceca5d1028c2c740b5f7 /core/jni
parentb8adcad61d9225ecdabde1a01b73455f484cbed7 (diff)
parentcaf0df1b7f99736aed1a0b923ef278fc4fd0fcca (diff)
downloadframeworks_base-77c9990ae0806575ae7a2750459f3e74f0bec092.zip
frameworks_base-77c9990ae0806575ae7a2750459f3e74f0bec092.tar.gz
frameworks_base-77c9990ae0806575ae7a2750459f3e74f0bec092.tar.bz2
Merge change 599 into donut
* changes: Add call to (new) Canvas.freeCaches() in response to low-memory
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android/graphics/Canvas.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp
index 605e4b8..bd6fea8 100644
--- a/core/jni/android/graphics/Canvas.cpp
+++ b/core/jni/android/graphics/Canvas.cpp
@@ -21,6 +21,8 @@
#include "SkCanvas.h"
#include "SkDevice.h"
#include "SkGLCanvas.h"
+#include "SkGraphics.h"
+#include "SkImageRef_GlobalPool.h"
#include "SkShader.h"
#include "SkTemplates.h"
@@ -58,8 +60,11 @@ public:
return new SkGLCanvas;
}
- static void freeGlCaches(JNIEnv* env, jobject) {
+ static void freeCaches(JNIEnv* env, jobject) {
+ // these are called in no particular order
SkGLCanvas::DeleteAllTextures();
+ SkImageRef_GlobalPool::SetRAMUsed(0);
+ SkGraphics::SetFontCacheUsed(0);
}
static jboolean isOpaque(JNIEnv* env, jobject jcanvas) {
@@ -933,7 +938,7 @@ static JNINativeMethod gCanvasMethods[] = {
(void*) SkCanvasGlue::drawTextOnPath__StringPathFFPaint},
{"native_drawPicture", "(II)V", (void*) SkCanvasGlue::drawPicture},
- {"freeGlCaches", "()V", (void*) SkCanvasGlue::freeGlCaches}
+ {"freeCaches", "()V", (void*) SkCanvasGlue::freeCaches}
};
#include <android_runtime/AndroidRuntime.h>