diff options
author | John Reck <jreck@google.com> | 2015-04-17 20:46:21 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-04-17 20:46:22 +0000 |
commit | afbeb2c2374bf7b7f7efa120944714fab469173d (patch) | |
tree | 4536c4995989aa41fd349733939fbbf4f677ad9d /graphics | |
parent | eaa388bc2c4259e4d9c887af2aca0aa4ce50b08e (diff) | |
parent | 1ff961dd6d51247e82e41de052f04fd0b577f09b (diff) | |
download | frameworks_base-afbeb2c2374bf7b7f7efa120944714fab469173d.zip frameworks_base-afbeb2c2374bf7b7f7efa120944714fab469173d.tar.gz frameworks_base-afbeb2c2374bf7b7f7efa120944714fab469173d.tar.bz2 |
Merge "Revert "Remove Bitmap#getSkBitmap""
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/Bitmap.java | 5 | ||||
-rw-r--r-- | graphics/java/android/graphics/Canvas.java | 18 | ||||
-rw-r--r-- | graphics/java/android/graphics/NinePatch.java | 16 |
3 files changed, 22 insertions, 17 deletions
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java index be5c52b..76d6edf 100644 --- a/graphics/java/android/graphics/Bitmap.java +++ b/graphics/java/android/graphics/Bitmap.java @@ -1568,6 +1568,11 @@ public final class Bitmap implements Parcelable { nativePrepareToDraw(mSkBitmapPtr); } + /** @hide */ + public final long getSkBitmap() { + return mSkBitmapPtr; + } + /** * Refs the underlying SkPixelRef and returns a pointer to it. * diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java index 1c56884..2acb8ba 100644 --- a/graphics/java/android/graphics/Canvas.java +++ b/graphics/java/android/graphics/Canvas.java @@ -1335,7 +1335,7 @@ public class Canvas { */ public void drawBitmap(@NonNull Bitmap bitmap, float left, float top, @Nullable Paint paint) { throwIfCannotDraw(bitmap); - native_drawBitmap(mNativeCanvasWrapper, bitmap, left, top, + native_drawBitmap(mNativeCanvasWrapper, bitmap.getSkBitmap(), left, top, paint != null ? paint.getNativeInstance() : 0, mDensity, mScreenDensity, bitmap.mDensity); } @@ -1381,7 +1381,7 @@ public class Canvas { bottom = src.bottom; } - native_drawBitmap(mNativeCanvasWrapper, bitmap, left, top, right, bottom, + native_drawBitmap(mNativeCanvasWrapper, bitmap.getSkBitmap(), left, top, right, bottom, dst.left, dst.top, dst.right, dst.bottom, nativePaint, mScreenDensity, bitmap.mDensity); } @@ -1428,7 +1428,7 @@ public class Canvas { bottom = src.bottom; } - native_drawBitmap(mNativeCanvasWrapper, bitmap, left, top, right, bottom, + native_drawBitmap(mNativeCanvasWrapper, bitmap.getSkBitmap(), left, top, right, bottom, dst.left, dst.top, dst.right, dst.bottom, nativePaint, mScreenDensity, bitmap.mDensity); } @@ -1509,7 +1509,7 @@ public class Canvas { * @param paint May be null. The paint used to draw the bitmap */ public void drawBitmap(@NonNull Bitmap bitmap, @NonNull Matrix matrix, @Nullable Paint paint) { - nativeDrawBitmapMatrix(mNativeCanvasWrapper, bitmap, matrix.ni(), + nativeDrawBitmapMatrix(mNativeCanvasWrapper, bitmap.getSkBitmap(), matrix.ni(), paint != null ? paint.getNativeInstance() : 0); } @@ -1564,7 +1564,7 @@ public class Canvas { // no mul by 2, since we need only 1 color per vertex checkRange(colors.length, colorOffset, count); } - nativeDrawBitmapMesh(mNativeCanvasWrapper, bitmap, meshWidth, meshHeight, + nativeDrawBitmapMesh(mNativeCanvasWrapper, bitmap.getSkBitmap(), meshWidth, meshHeight, verts, vertOffset, colors, colorOffset, paint != null ? paint.getNativeInstance() : 0); } @@ -2052,13 +2052,13 @@ public class Canvas { private static native void native_drawPath(long nativeCanvas, long nativePath, long nativePaint); - private native void native_drawBitmap(long nativeCanvas, Bitmap bitmap, + private native void native_drawBitmap(long nativeCanvas, long nativeBitmap, float left, float top, long nativePaintOrZero, int canvasDensity, int screenDensity, int bitmapDensity); - private native void native_drawBitmap(long nativeCanvas, Bitmap bitmap, + private native void native_drawBitmap(long nativeCanvas, long nativeBitmap, float srcLeft, float srcTop, float srcRight, float srcBottom, float dstLeft, float dstTop, float dstRight, float dstBottom, long nativePaintOrZero, int screenDensity, int bitmapDensity); @@ -2068,11 +2068,11 @@ public class Canvas { boolean hasAlpha, long nativePaintOrZero); private static native void nativeDrawBitmapMatrix(long nativeCanvas, - Bitmap bitmap, + long nativeBitmap, long nativeMatrix, long nativePaint); private static native void nativeDrawBitmapMesh(long nativeCanvas, - Bitmap bitmap, + long nativeBitmap, int meshWidth, int meshHeight, float[] verts, int vertOffset, int[] colors, int colorOffset, diff --git a/graphics/java/android/graphics/NinePatch.java b/graphics/java/android/graphics/NinePatch.java index 21a212a..9c4299a 100644 --- a/graphics/java/android/graphics/NinePatch.java +++ b/graphics/java/android/graphics/NinePatch.java @@ -98,7 +98,7 @@ public class NinePatch { public NinePatch(Bitmap bitmap, byte[] chunk, String srcName) { mBitmap = bitmap; mSrcName = srcName; - mNativeChunk = validateNinePatchChunk(chunk); + mNativeChunk = validateNinePatchChunk(mBitmap.getSkBitmap(), chunk); } /** @@ -199,12 +199,12 @@ public class NinePatch { } void drawSoftware(Canvas canvas, RectF location, Paint paint) { - nativeDraw(canvas.getNativeCanvasWrapper(), location, mBitmap, mNativeChunk, + nativeDraw(canvas.getNativeCanvasWrapper(), location, mBitmap.getSkBitmap(), mNativeChunk, paint != null ? paint.getNativeInstance() : 0, canvas.mDensity, mBitmap.mDensity); } void drawSoftware(Canvas canvas, Rect location, Paint paint) { - nativeDraw(canvas.getNativeCanvasWrapper(), location, mBitmap, mNativeChunk, + nativeDraw(canvas.getNativeCanvasWrapper(), location, mBitmap.getSkBitmap(), mNativeChunk, paint != null ? paint.getNativeInstance() : 0, canvas.mDensity, mBitmap.mDensity); } @@ -252,7 +252,7 @@ public class NinePatch { * that are transparent. */ public final Region getTransparentRegion(Rect bounds) { - long r = nativeGetTransparentRegion(mBitmap, mNativeChunk, bounds); + long r = nativeGetTransparentRegion(mBitmap.getSkBitmap(), mNativeChunk, bounds); return r != 0 ? new Region(r) : null; } @@ -271,11 +271,11 @@ public class NinePatch { * If validation is successful, this method returns a native Res_png_9patch* * object used by the renderers. */ - private static native long validateNinePatchChunk(byte[] chunk); + private static native long validateNinePatchChunk(long bitmap, byte[] chunk); private static native void nativeFinalize(long chunk); - private static native void nativeDraw(long canvas_instance, RectF loc, Bitmap bitmap_instance, + private static native void nativeDraw(long canvas_instance, RectF loc, long bitmap_instance, long c, long paint_instance_or_null, int destDensity, int srcDensity); - private static native void nativeDraw(long canvas_instance, Rect loc, Bitmap bitmap_instance, + private static native void nativeDraw(long canvas_instance, Rect loc, long bitmap_instance, long c, long paint_instance_or_null, int destDensity, int srcDensity); - private static native long nativeGetTransparentRegion(Bitmap bitmap, long chunk, Rect location); + private static native long nativeGetTransparentRegion(long bitmap, long chunk, Rect location); } |