Loading core/java/android/view/View.java +1 −0 Original line number Diff line number Diff line Loading @@ -10291,6 +10291,7 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit canvas.restoreToCount(restoreCount); if (attachInfo != null) { canvas.setBitmap(null); // Restore the cached Canvas for our siblings attachInfo.mCanvas = canvas; } Loading core/jni/android/graphics/Canvas.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -88,9 +88,12 @@ public: return canvas->getDevice()->accessBitmap(false).height(); } static void setBitmap(JNIEnv* env, jobject, SkCanvas* canvas, SkBitmap* bitmap) { static void setBitmap(JNIEnv* env, jobject, SkCanvas* canvas, SkBitmap* bitmap) { if (bitmap) { canvas->setBitmapDevice(*bitmap); } else { canvas->setDevice(NULL); } } static int saveAll(JNIEnv* env, jobject jcanvas) { Loading graphics/java/android/graphics/Canvas.java +11 −6 Original line number Diff line number Diff line Loading @@ -178,17 +178,22 @@ public class Canvas { * @see #getDensity() */ public void setBitmap(Bitmap bitmap) { if (!bitmap.isMutable()) { throw new IllegalStateException(); } if (isHardwareAccelerated()) { throw new RuntimeException("Can't set a bitmap device on a GL canvas"); } int pointer = 0; if (bitmap != null) { if (!bitmap.isMutable()) { throw new IllegalStateException(); } throwIfRecycled(bitmap); mDensity = bitmap.mDensity; pointer = bitmap.ni(); } native_setBitmap(mNativeCanvas, bitmap.ni()); native_setBitmap(mNativeCanvas, pointer); mBitmap = bitmap; mDensity = bitmap.mDensity; } /** Loading tests/HwAccelerationTest/src/com/android/test/hwui/PathsActivity.java +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ public class PathsActivity extends Activity { Canvas canvas = new Canvas(mBitmap); canvas.translate(-mPathBounds.left + mOffset * 1.5f, -mPathBounds.top + mOffset * 1.5f); canvas.drawPath(mPath, mMediumPaint); canvas.setBitmap(null); } @Override Loading Loading
core/java/android/view/View.java +1 −0 Original line number Diff line number Diff line Loading @@ -10291,6 +10291,7 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit canvas.restoreToCount(restoreCount); if (attachInfo != null) { canvas.setBitmap(null); // Restore the cached Canvas for our siblings attachInfo.mCanvas = canvas; } Loading
core/jni/android/graphics/Canvas.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -88,9 +88,12 @@ public: return canvas->getDevice()->accessBitmap(false).height(); } static void setBitmap(JNIEnv* env, jobject, SkCanvas* canvas, SkBitmap* bitmap) { static void setBitmap(JNIEnv* env, jobject, SkCanvas* canvas, SkBitmap* bitmap) { if (bitmap) { canvas->setBitmapDevice(*bitmap); } else { canvas->setDevice(NULL); } } static int saveAll(JNIEnv* env, jobject jcanvas) { Loading
graphics/java/android/graphics/Canvas.java +11 −6 Original line number Diff line number Diff line Loading @@ -178,17 +178,22 @@ public class Canvas { * @see #getDensity() */ public void setBitmap(Bitmap bitmap) { if (!bitmap.isMutable()) { throw new IllegalStateException(); } if (isHardwareAccelerated()) { throw new RuntimeException("Can't set a bitmap device on a GL canvas"); } int pointer = 0; if (bitmap != null) { if (!bitmap.isMutable()) { throw new IllegalStateException(); } throwIfRecycled(bitmap); mDensity = bitmap.mDensity; pointer = bitmap.ni(); } native_setBitmap(mNativeCanvas, bitmap.ni()); native_setBitmap(mNativeCanvas, pointer); mBitmap = bitmap; mDensity = bitmap.mDensity; } /** Loading
tests/HwAccelerationTest/src/com/android/test/hwui/PathsActivity.java +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ public class PathsActivity extends Activity { Canvas canvas = new Canvas(mBitmap); canvas.translate(-mPathBounds.left + mOffset * 1.5f, -mPathBounds.top + mOffset * 1.5f); canvas.drawPath(mPath, mMediumPaint); canvas.setBitmap(null); } @Override Loading