summaryrefslogtreecommitdiffstats
path: root/core/jni/android/graphics
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2012-09-30 12:14:13 -0700
committerChet Haase <chet@google.com>2012-09-30 15:35:08 -0700
commit6a2d17f71342f981c9df1dc5beff33e30eb3ae2b (patch)
treeaaf68defc949273eccdd48aa40927fe8895ad37d /core/jni/android/graphics
parent933a7546c857dba7704a15b7f7f7847934f14912 (diff)
downloadframeworks_base-6a2d17f71342f981c9df1dc5beff33e30eb3ae2b.zip
frameworks_base-6a2d17f71342f981c9df1dc5beff33e30eb3ae2b.tar.gz
frameworks_base-6a2d17f71342f981c9df1dc5beff33e30eb3ae2b.tar.bz2
Fix texture corruption
When memory gets low on a device, activities flush everything they can. Hardware-accelerated activites, such as Launcher, flush GL resources and destroy the GL context. However, some resources were still hanging around, due to deferred destruction policies (we don't delete layers until the DisplayLists they are in are finalized, to ensure we don't deref deleted objects). This meant that we were referring to obsolete GL data in these objects. in particular, it meant that we might come around later, after a new GL context was created, and delete a texture object that was incorrect. We use the layer's "texture id" to refer to the texture underlying the layer. But if there's a new GL context, then this texture ID is no longer valid, and we may be deleting the texture that a different object (layer, icon, whatever) is referring to, because the driver may return that same ID under the new GL context. The fix is to more aggressively delete things that we know will not be used again when the GL context is destroyed. In particular, we delete all resources being used by all DisplayLists at GL context destruction time. Issue #7195815 Textures corruption on all devices, in many apps Change-Id: I52d2d208173690dbb794a83402d38f14ea4c6c22
Diffstat (limited to 'core/jni/android/graphics')
-rw-r--r--core/jni/android/graphics/Canvas.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp
index 5c27602..2a02f7c 100644
--- a/core/jni/android/graphics/Canvas.cpp
+++ b/core/jni/android/graphics/Canvas.cpp
@@ -931,6 +931,9 @@ static void doDrawTextDecorations(SkCanvas* canvas, jfloat x, jfloat y, jfloat l
SkIRect ir;
bool result = canvas->getClipBounds(&r, SkCanvas::kBW_EdgeType);
+ if (!result) {
+ r.setEmpty();
+ }
r.round(&ir);
(void)GraphicsJNI::irect_to_jrect(ir, env, bounds);
return result;