summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2015-04-17 20:45:15 +0000
committerJohn Reck <jreck@google.com>2015-04-17 20:45:15 +0000
commit1ff961dd6d51247e82e41de052f04fd0b577f09b (patch)
treeb5a50ef42c04b17739892de88d5cd07b7fde7151 /graphics
parent4bd981ec533a65e8dee053a0a709b484770b0a76 (diff)
downloadframeworks_base-1ff961dd6d51247e82e41de052f04fd0b577f09b.zip
frameworks_base-1ff961dd6d51247e82e41de052f04fd0b577f09b.tar.gz
frameworks_base-1ff961dd6d51247e82e41de052f04fd0b577f09b.tar.bz2
Revert "Remove Bitmap#getSkBitmap"
This reverts commit 4bd981ec533a65e8dee053a0a709b484770b0a76. Change-Id: I5c92cd955c6e70e197dc5cbc5dfeed8369a24a31
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/Bitmap.java5
-rw-r--r--graphics/java/android/graphics/Canvas.java18
-rw-r--r--graphics/java/android/graphics/NinePatch.java16
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);
}