diff options
author | John Reck <jreck@google.com> | 2015-04-13 15:20:29 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2015-04-14 15:38:22 -0700 |
commit | c294d128d03bc9a9982b273a82516c04583438cc (patch) | |
tree | fd6c7ae3a6a292caf48160f0c0c8cc82e4729225 /graphics | |
parent | 4fc266bbef6129b5cefc910f0680eb9d61794faf (diff) | |
download | frameworks_base-c294d128d03bc9a9982b273a82516c04583438cc.zip frameworks_base-c294d128d03bc9a9982b273a82516c04583438cc.tar.gz frameworks_base-c294d128d03bc9a9982b273a82516c04583438cc.tar.bz2 |
A bunch more cleanups
Switch a few places to using android::canvas
instead of SkCanvas as well which eliminated
some JNI
Change-Id: I8f98b56442a06362b82b984cd1bd3a92398d8dbc
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/BitmapShader.java | 5 | ||||
-rw-r--r-- | graphics/java/android/graphics/Canvas.java | 24 |
2 files changed, 8 insertions, 21 deletions
diff --git a/graphics/java/android/graphics/BitmapShader.java b/graphics/java/android/graphics/BitmapShader.java index f2f890e..bd74bc8 100644 --- a/graphics/java/android/graphics/BitmapShader.java +++ b/graphics/java/android/graphics/BitmapShader.java @@ -42,8 +42,7 @@ public class BitmapShader extends Shader { mBitmap = bitmap; mTileX = tileX; mTileY = tileY; - final long b = bitmap.getSkBitmap(); - init(nativeCreate(b, tileX.nativeInt, tileY.nativeInt)); + init(nativeCreate(bitmap, tileX.nativeInt, tileY.nativeInt)); } /** @@ -56,6 +55,6 @@ public class BitmapShader extends Shader { return copy; } - private static native long nativeCreate(long native_bitmap, int shaderTileModeX, + private static native long nativeCreate(Bitmap bitmap, int shaderTileModeX, int shaderTileModeY); } diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java index 48afcbf..2acb8ba 100644 --- a/graphics/java/android/graphics/Canvas.java +++ b/graphics/java/android/graphics/Canvas.java @@ -81,10 +81,6 @@ public class Canvas { */ protected int mScreenDensity = Bitmap.DENSITY_NONE; - // Used by native code - @SuppressWarnings("UnusedDeclaration") - private int mSurfaceFormat; - /** * Flag for drawTextRun indicating left-to-right run direction. * @hide @@ -137,7 +133,7 @@ public class Canvas { public Canvas() { if (!isHardwareAccelerated()) { // 0 means no native bitmap - mNativeCanvasWrapper = initRaster(0); + mNativeCanvasWrapper = initRaster(null); mFinalizer = new CanvasFinalizer(mNativeCanvasWrapper); } else { mFinalizer = null; @@ -158,7 +154,7 @@ public class Canvas { throw new IllegalStateException("Immutable bitmap passed to Canvas constructor"); } throwIfCannotDraw(bitmap); - mNativeCanvasWrapper = initRaster(bitmap.getSkBitmap()); + mNativeCanvasWrapper = initRaster(bitmap); mFinalizer = new CanvasFinalizer(mNativeCanvasWrapper); mBitmap = bitmap; mDensity = bitmap.mDensity; @@ -215,7 +211,7 @@ public class Canvas { } if (bitmap == null) { - native_setBitmap(mNativeCanvasWrapper, 0, false); + native_setBitmap(mNativeCanvasWrapper, null); mDensity = Bitmap.DENSITY_NONE; } else { if (!bitmap.isMutable()) { @@ -223,7 +219,7 @@ public class Canvas { } throwIfCannotDraw(bitmap); - native_setBitmap(mNativeCanvasWrapper, bitmap.getSkBitmap(), true); + native_setBitmap(mNativeCanvasWrapper, bitmap); mDensity = bitmap.mDensity; } @@ -231,13 +227,6 @@ public class Canvas { } /** - * setBitmap() variant for native callers with a raw bitmap handle. - */ - private void setNativeBitmap(long bitmapHandle) { - native_setBitmap(mNativeCanvasWrapper, bitmapHandle, false); - } - - /** * Set the viewport dimensions if this canvas is GL based. If it is not, * this method is ignored and no exception is thrown. * @@ -1976,10 +1965,9 @@ public class Canvas { */ public static native void freeTextLayoutCaches(); - private static native long initRaster(long nativeBitmapOrZero); + private static native long initRaster(Bitmap bitmap); private static native void native_setBitmap(long canvasHandle, - long bitmapHandle, - boolean copyState); + Bitmap bitmap); private static native boolean native_isOpaque(long canvasHandle); private static native int native_getWidth(long canvasHandle); private static native int native_getHeight(long canvasHandle); |