From 96890564bdbd2f2a41dfc323fc8b3938fb335639 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Fri, 5 Sep 2014 10:33:39 -0700 Subject: Replace native crash with IAE when calling picture.draw() w/ a HW canvas bug:17397958 Change-Id: I75f942db0e604f9fd6ab31e6c81f718c0f57b16a --- graphics/java/android/graphics/Canvas.java | 2 +- graphics/java/android/graphics/Picture.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'graphics/java') diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java index f18694b07e59..0927ffd548cf 100644 --- a/graphics/java/android/graphics/Canvas.java +++ b/graphics/java/android/graphics/Canvas.java @@ -203,7 +203,7 @@ public class Canvas { */ public void setBitmap(@Nullable Bitmap bitmap) { if (isHardwareAccelerated()) { - throw new RuntimeException("Can't set a bitmap device on a GL canvas"); + throw new RuntimeException("Can't set a bitmap device on a HW accelerated canvas"); } if (bitmap == null) { diff --git a/graphics/java/android/graphics/Picture.java b/graphics/java/android/graphics/Picture.java index 5aa7c6a8df52..d28c3d574d05 100644 --- a/graphics/java/android/graphics/Picture.java +++ b/graphics/java/android/graphics/Picture.java @@ -122,6 +122,11 @@ public class Picture { * @param canvas The picture is drawn to this canvas */ public void draw(Canvas canvas) { + if (canvas.isHardwareAccelerated()) { + throw new IllegalArgumentException( + "Picture playback is only supported on software canvas."); + } + if (mRecordingCanvas != null) { endRecording(); } -- cgit v1.2.3-59-g8ed1b