diff options
author | John Reck <jreck@google.com> | 2015-04-17 20:45:40 +0000 |
---|---|---|
committer | John Reck <jreck@google.com> | 2015-04-17 20:47:27 +0000 |
commit | 9d4efdf2802f06ccf7031610891f75af70ea5538 (patch) | |
tree | a86a7a833af6b45b466a391c5ff72fbffcdca329 /graphics | |
parent | 7809f835cae637c12eebdc92103ad88890228d97 (diff) | |
download | frameworks_base-9d4efdf2802f06ccf7031610891f75af70ea5538.zip frameworks_base-9d4efdf2802f06ccf7031610891f75af70ea5538.tar.gz frameworks_base-9d4efdf2802f06ccf7031610891f75af70ea5538.tar.bz2 |
Revert "A bunch more cleanups"
This reverts commit c294d128d03bc9a9982b273a82516c04583438cc.
Change-Id: Id1ebb236950f7c36c6d86e1dd95566d3a200748d
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, 21 insertions, 8 deletions
diff --git a/graphics/java/android/graphics/BitmapShader.java b/graphics/java/android/graphics/BitmapShader.java index bd74bc8..f2f890e 100644 --- a/graphics/java/android/graphics/BitmapShader.java +++ b/graphics/java/android/graphics/BitmapShader.java @@ -42,7 +42,8 @@ public class BitmapShader extends Shader { mBitmap = bitmap; mTileX = tileX; mTileY = tileY; - init(nativeCreate(bitmap, tileX.nativeInt, tileY.nativeInt)); + final long b = bitmap.getSkBitmap(); + init(nativeCreate(b, tileX.nativeInt, tileY.nativeInt)); } /** @@ -55,6 +56,6 @@ public class BitmapShader extends Shader { return copy; } - private static native long nativeCreate(Bitmap bitmap, int shaderTileModeX, + private static native long nativeCreate(long native_bitmap, int shaderTileModeX, int shaderTileModeY); } diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java index 2acb8ba..48afcbf 100644 --- a/graphics/java/android/graphics/Canvas.java +++ b/graphics/java/android/graphics/Canvas.java @@ -81,6 +81,10 @@ 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 @@ -133,7 +137,7 @@ public class Canvas { public Canvas() { if (!isHardwareAccelerated()) { // 0 means no native bitmap - mNativeCanvasWrapper = initRaster(null); + mNativeCanvasWrapper = initRaster(0); mFinalizer = new CanvasFinalizer(mNativeCanvasWrapper); } else { mFinalizer = null; @@ -154,7 +158,7 @@ public class Canvas { throw new IllegalStateException("Immutable bitmap passed to Canvas constructor"); } throwIfCannotDraw(bitmap); - mNativeCanvasWrapper = initRaster(bitmap); + mNativeCanvasWrapper = initRaster(bitmap.getSkBitmap()); mFinalizer = new CanvasFinalizer(mNativeCanvasWrapper); mBitmap = bitmap; mDensity = bitmap.mDensity; @@ -211,7 +215,7 @@ public class Canvas { } if (bitmap == null) { - native_setBitmap(mNativeCanvasWrapper, null); + native_setBitmap(mNativeCanvasWrapper, 0, false); mDensity = Bitmap.DENSITY_NONE; } else { if (!bitmap.isMutable()) { @@ -219,7 +223,7 @@ public class Canvas { } throwIfCannotDraw(bitmap); - native_setBitmap(mNativeCanvasWrapper, bitmap); + native_setBitmap(mNativeCanvasWrapper, bitmap.getSkBitmap(), true); mDensity = bitmap.mDensity; } @@ -227,6 +231,13 @@ 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. * @@ -1965,9 +1976,10 @@ public class Canvas { */ public static native void freeTextLayoutCaches(); - private static native long initRaster(Bitmap bitmap); + private static native long initRaster(long nativeBitmapOrZero); private static native void native_setBitmap(long canvasHandle, - Bitmap bitmap); + long bitmapHandle, + boolean copyState); private static native boolean native_isOpaque(long canvasHandle); private static native int native_getWidth(long canvasHandle); private static native int native_getHeight(long canvasHandle); |