diff options
author | Ashok Bhat <ashok.bhat@arm.com> | 2014-01-20 20:08:01 +0000 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2014-01-28 10:02:43 +0000 |
commit | 36bef0bf30d6bae48cf3837df351075ca4fce654 (patch) | |
tree | 9b4ac2bcd764da7526d309e0341be30ab63c9f1d /graphics | |
parent | 729b12c7a91f9caa65af77197cf6a8814a5a2051 (diff) | |
download | frameworks_base-36bef0bf30d6bae48cf3837df351075ca4fce654.zip frameworks_base-36bef0bf30d6bae48cf3837df351075ca4fce654.tar.gz frameworks_base-36bef0bf30d6bae48cf3837df351075ca4fce654.tar.bz2 |
AArch64: Make graphics classes 64-bit compatible
This a merger of two commits submitted to AOSP by
the following authors:
ashok.bhat@arm.com, david.butcher@arm.coma
craig.barber@arm.com, kevin.petit@arm.com and
marcus.oakland@arm.com
Due to the very large number of internal conflicts, I
have chosen to cherry-pick this change instead
of letting it merge through AOSP because the merge
conflict resolution would be very hard to review.
Commit messages below:
================================================
AArch64: Make graphics classes 64-bit compatible
Changes in this patch include
[x] Long is used to store native pointers as they can
be 64-bit.
[x] Some minor changes have been done to conform with
standard JNI practice (e.g. use of jint instead of int
in JNI function prototypes)
[x] AssetAtlasManager is not completely 64-bit compatible
yet. Specifically mAtlasMap member has to be converted
to hold native pointer using long. Added a TODO to
AssetAtlasManager.java to indicate the change required.
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
==================================================================
AArch64: Use long for pointers in graphics/Camera
For storing pointers, long is used in
android/graphics/Camera class, as native
pointers can be 64-bit.
In addition, some minor changes have been done
to conform with standard JNI practice (e.g. use of
jint instead of int in JNI function prototypes)
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
===================================================================
Change-Id: Id5793fa0ebc17ee8b1eecf4b3f327977fdccff71
Diffstat (limited to 'graphics')
42 files changed, 435 insertions, 406 deletions
diff --git a/graphics/java/android/graphics/AvoidXfermode.java b/graphics/java/android/graphics/AvoidXfermode.java index 5a59e36..206c959 100644 --- a/graphics/java/android/graphics/AvoidXfermode.java +++ b/graphics/java/android/graphics/AvoidXfermode.java @@ -56,6 +56,6 @@ public class AvoidXfermode extends Xfermode { native_instance = nativeCreate(opColor, tolerance, mode.nativeInt); } - private static native int nativeCreate(int opColor, int tolerance, - int nativeMode); + private static native long nativeCreate(int opColor, int tolerance, + int nativeMode); } diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java index 536c4b6..d6b73fd 100644 --- a/graphics/java/android/graphics/Bitmap.java +++ b/graphics/java/android/graphics/Bitmap.java @@ -41,7 +41,7 @@ public final class Bitmap implements Parcelable { * * @hide */ - public final int mNativeBitmap; + public final long mNativeBitmap; /** * Backing buffer for the Bitmap. @@ -113,7 +113,7 @@ public final class Bitmap implements Parcelable { * int (pointer). */ @SuppressWarnings({"UnusedDeclaration"}) // called from JNI - Bitmap(int nativeBitmap, byte[] buffer, int width, int height, int density, + Bitmap(long nativeBitmap, byte[] buffer, int width, int height, int density, boolean isMutable, boolean isPremultiplied, byte[] ninePatchChunk, int[] layoutBounds) { if (nativeBitmap == 0) { @@ -1536,7 +1536,7 @@ public final class Bitmap implements Parcelable { */ public Bitmap extractAlpha(Paint paint, int[] offsetXY) { checkRecycled("Can't extractAlpha on a recycled bitmap"); - int nativePaint = paint != null ? paint.mNativePaint : 0; + long nativePaint = paint != null ? paint.mNativePaint : 0; Bitmap bm = nativeExtractAlpha(mNativeBitmap, nativePaint, offsetXY); if (bm == null) { throw new RuntimeException("Failed to extractAlpha on Bitmap"); @@ -1570,9 +1570,9 @@ public final class Bitmap implements Parcelable { } private static class BitmapFinalizer { - private final int mNativeBitmap; + private final long mNativeBitmap; - BitmapFinalizer(int nativeBitmap) { + BitmapFinalizer(long nativeBitmap) { mNativeBitmap = nativeBitmap; } @@ -1593,56 +1593,57 @@ public final class Bitmap implements Parcelable { private static native Bitmap nativeCreate(int[] colors, int offset, int stride, int width, int height, int nativeConfig, boolean mutable); - private static native Bitmap nativeCopy(int srcBitmap, int nativeConfig, + private static native Bitmap nativeCopy(long nativeSrcBitmap, int nativeConfig, boolean isMutable); - private static native void nativeDestructor(int nativeBitmap); - private static native boolean nativeRecycle(int nativeBitmap); - private static native void nativeReconfigure(int nativeBitmap, int width, int height, + private static native void nativeDestructor(long nativeBitmap); + private static native boolean nativeRecycle(long nativeBitmap); + private static native void nativeReconfigure(long nativeBitmap, int width, int height, int config, int allocSize); - private static native boolean nativeCompress(int nativeBitmap, int format, + private static native boolean nativeCompress(long nativeBitmap, int format, int quality, OutputStream stream, byte[] tempStorage); - private static native void nativeErase(int nativeBitmap, int color); - private static native int nativeRowBytes(int nativeBitmap); - private static native int nativeConfig(int nativeBitmap); + private static native void nativeErase(long nativeBitmap, int color); + private static native int nativeRowBytes(long nativeBitmap); + private static native int nativeConfig(long nativeBitmap); - private static native int nativeGetPixel(int nativeBitmap, int x, int y, + private static native int nativeGetPixel(long nativeBitmap, int x, int y, boolean isPremultiplied); - private static native void nativeGetPixels(int nativeBitmap, int[] pixels, + private static native void nativeGetPixels(long nativeBitmap, int[] pixels, int offset, int stride, int x, int y, int width, int height, boolean isPremultiplied); - private static native void nativeSetPixel(int nativeBitmap, int x, int y, + private static native void nativeSetPixel(long nativeBitmap, int x, int y, int color, boolean isPremultiplied); - private static native void nativeSetPixels(int nativeBitmap, int[] colors, + private static native void nativeSetPixels(long nativeBitmap, int[] colors, int offset, int stride, int x, int y, int width, int height, boolean isPremultiplied); - private static native void nativeCopyPixelsToBuffer(int nativeBitmap, + private static native void nativeCopyPixelsToBuffer(long nativeBitmap, Buffer dst); - private static native void nativeCopyPixelsFromBuffer(int nb, Buffer src); - private static native int nativeGenerationId(int nativeBitmap); + private static native void nativeCopyPixelsFromBuffer(long nativeBitmap, Buffer src); + private static native int nativeGenerationId(long nativeBitmap); private static native Bitmap nativeCreateFromParcel(Parcel p); // returns true on success - private static native boolean nativeWriteToParcel(int nativeBitmap, + private static native boolean nativeWriteToParcel(long nativeBitmap, boolean isMutable, int density, Parcel p); // returns a new bitmap built from the native bitmap's alpha, and the paint - private static native Bitmap nativeExtractAlpha(int nativeBitmap, - int nativePaint, + private static native Bitmap nativeExtractAlpha(long nativeBitmap, + long nativePaint, int[] offsetXY); - private static native void nativePrepareToDraw(int nativeBitmap); - private static native boolean nativeHasAlpha(int nativeBitmap); - private static native void nativeSetAlphaAndPremultiplied(int nBitmap, boolean hasAlpha, + private static native void nativePrepareToDraw(long nativeBitmap); + private static native boolean nativeHasAlpha(long nativeBitmap); + private static native void nativeSetAlphaAndPremultiplied(long nativeBitmap, + boolean hasAlpha, boolean isPremul); - private static native boolean nativeHasMipMap(int nativeBitmap); - private static native void nativeSetHasMipMap(int nBitmap, boolean hasMipMap); - private static native boolean nativeSameAs(int nb0, int nb1); - - /* package */ final int ni() { + private static native boolean nativeHasMipMap(long nativeBitmap); + private static native void nativeSetHasMipMap(long nativeBitmap, boolean hasMipMap); + private static native boolean nativeSameAs(long nativeBitmap0, long nativeBitmap1); + + /* package */ final long ni() { return mNativeBitmap; } } diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java index 2b69a15..c20502f 100644 --- a/graphics/java/android/graphics/BitmapFactory.java +++ b/graphics/java/android/graphics/BitmapFactory.java @@ -595,7 +595,7 @@ public class BitmapFactory { Trace.traceBegin(Trace.TRACE_TAG_GRAPHICS, "decodeBitmap"); try { if (is instanceof AssetManager.AssetInputStream) { - final int asset = ((AssetManager.AssetInputStream) is).getAssetInt(); + final long asset = ((AssetManager.AssetInputStream) is).getNativeAsset(); bm = nativeDecodeAsset(asset, outPadding, opts); } else { bm = decodeStreamInternal(is, outPadding, opts); @@ -698,7 +698,7 @@ public class BitmapFactory { Rect padding, Options opts); private static native Bitmap nativeDecodeFileDescriptor(FileDescriptor fd, Rect padding, Options opts); - private static native Bitmap nativeDecodeAsset(int asset, Rect padding, Options opts); + private static native Bitmap nativeDecodeAsset(long nativeAsset, Rect padding, Options opts); private static native Bitmap nativeDecodeByteArray(byte[] data, int offset, int length, Options opts); private static native boolean nativeIsSeekable(FileDescriptor fd); diff --git a/graphics/java/android/graphics/BitmapShader.java b/graphics/java/android/graphics/BitmapShader.java index a4f75b9..b7673d8 100644 --- a/graphics/java/android/graphics/BitmapShader.java +++ b/graphics/java/android/graphics/BitmapShader.java @@ -42,7 +42,7 @@ public class BitmapShader extends Shader { mBitmap = bitmap; mTileX = tileX; mTileY = tileY; - final int b = bitmap.ni(); + final long b = bitmap.ni(); native_instance = nativeCreate(b, tileX.nativeInt, tileY.nativeInt); native_shader = nativePostCreate(native_instance, b, tileX.nativeInt, tileY.nativeInt); } @@ -57,8 +57,8 @@ public class BitmapShader extends Shader { return copy; } - private static native int nativeCreate(int native_bitmap, int shaderTileModeX, + private static native long nativeCreate(long native_bitmap, int shaderTileModeX, int shaderTileModeY); - private static native int nativePostCreate(int native_shader, int native_bitmap, + private static native long nativePostCreate(long native_shader, long native_bitmap, int shaderTileModeX, int shaderTileModeY); } diff --git a/graphics/java/android/graphics/BlurMaskFilter.java b/graphics/java/android/graphics/BlurMaskFilter.java index 5eafe76..939af52 100644 --- a/graphics/java/android/graphics/BlurMaskFilter.java +++ b/graphics/java/android/graphics/BlurMaskFilter.java @@ -47,5 +47,5 @@ public class BlurMaskFilter extends MaskFilter { native_instance = nativeConstructor(radius, style.native_int); } - private static native int nativeConstructor(float radius, int style); + private static native long nativeConstructor(float radius, int style); } diff --git a/graphics/java/android/graphics/Camera.java b/graphics/java/android/graphics/Camera.java index 9e07bd4..c263a84 100644 --- a/graphics/java/android/graphics/Camera.java +++ b/graphics/java/android/graphics/Camera.java @@ -159,7 +159,7 @@ public class Camera { } public native float dotWithNormal(float dx, float dy, float dz); - + protected void finalize() throws Throwable { try { nativeDestructor(); @@ -170,8 +170,8 @@ public class Camera { private native void nativeConstructor(); private native void nativeDestructor(); - private native void nativeGetMatrix(int native_matrix); - private native void nativeApplyToCanvas(int native_canvas); - - int native_instance; + private native void nativeGetMatrix(long native_matrix); + private native void nativeApplyToCanvas(long native_canvas); + + long native_instance; } diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java index 13f4299..2b72b93 100644 --- a/graphics/java/android/graphics/Canvas.java +++ b/graphics/java/android/graphics/Canvas.java @@ -40,7 +40,7 @@ public class Canvas { // assigned in constructors or setBitmap, freed in finalizer /** @hide */ - public int mNativeCanvas; + public long mNativeCanvas; // may be null private Bitmap mBitmap; @@ -84,9 +84,9 @@ public class Canvas { private final CanvasFinalizer mFinalizer; private static final class CanvasFinalizer { - private int mNativeCanvas; + private long mNativeCanvas; - public CanvasFinalizer(int nativeCanvas) { + public CanvasFinalizer(long nativeCanvas) { mNativeCanvas = nativeCanvas; } @@ -144,7 +144,7 @@ public class Canvas { } /** @hide */ - public Canvas(int nativeCanvas) { + public Canvas(long nativeCanvas) { if (nativeCanvas == 0) { throw new IllegalStateException(); } @@ -157,8 +157,8 @@ public class Canvas { * Replace existing canvas while ensuring that the swap has occurred before * the previous native canvas is unreferenced. */ - private void safeCanvasSwap(int nativeCanvas, boolean copyState) { - final int oldCanvas = mNativeCanvas; + private void safeCanvasSwap(long nativeCanvas, boolean copyState) { + final long oldCanvas = mNativeCanvas; mNativeCanvas = nativeCanvas; mFinalizer.mNativeCanvas = nativeCanvas; if (copyState) { @@ -174,7 +174,7 @@ public class Canvas { * * @hide */ - public int getNativeCanvas() { + public long getNativeCanvas() { return mNativeCanvas; } @@ -712,7 +712,7 @@ public class Canvas { } public void setDrawFilter(DrawFilter filter) { - int nativeFilter = 0; + long nativeFilter = 0; if (filter != null) { nativeFilter = filter.mNativeInt; } @@ -1387,7 +1387,7 @@ public class Canvas { vertOffset, texs, texOffset, colors, colorOffset, indices, indexOffset, indexCount, paint.mNativePaint); } - + /** * Draw the text, with origin at (x,y), using the specified paint. The * origin is interpreted based on the Align setting in the paint. @@ -1713,137 +1713,155 @@ public class Canvas { */ public static native void freeTextLayoutCaches(); - private static native int initRaster(int nativeBitmapOrZero); - private static native void copyNativeCanvasState(int srcCanvas, int dstCanvas); - private static native int native_saveLayer(int nativeCanvas, RectF bounds, - int paint, int layerFlags); - private static native int native_saveLayer(int nativeCanvas, float l, + private static native long initRaster(long nativeBitmapOrZero); + private static native void copyNativeCanvasState(long nativeSrcCanvas, + long nativeDstCanvas); + private static native int native_saveLayer(long nativeCanvas, + RectF bounds, + long nativePaint, + int layerFlags); + private static native int native_saveLayer(long nativeCanvas, float l, float t, float r, float b, - int paint, int layerFlags); - private static native int native_saveLayerAlpha(int nativeCanvas, + long nativePaint, + int layerFlags); + private static native int native_saveLayerAlpha(long nativeCanvas, RectF bounds, int alpha, int layerFlags); - private static native int native_saveLayerAlpha(int nativeCanvas, float l, + private static native int native_saveLayerAlpha(long nativeCanvas, float l, float t, float r, float b, int alpha, int layerFlags); - private static native void native_concat(int nCanvas, int nMatrix); - private static native void native_setMatrix(int nCanvas, int nMatrix); - private static native boolean native_clipRect(int nCanvas, + private static native void native_concat(long nativeCanvas, + long nativeMatrix); + private static native void native_setMatrix(long nativeCanvas, + long nativeMatrix); + private static native boolean native_clipRect(long nativeCanvas, float left, float top, float right, float bottom, int regionOp); - private static native boolean native_clipPath(int nativeCanvas, - int nativePath, + private static native boolean native_clipPath(long nativeCanvas, + long nativePath, int regionOp); - private static native boolean native_clipRegion(int nativeCanvas, - int nativeRegion, + private static native boolean native_clipRegion(long nativeCanvas, + long nativeRegion, int regionOp); - private static native void nativeSetDrawFilter(int nativeCanvas, - int nativeFilter); - private static native boolean native_getClipBounds(int nativeCanvas, + private static native void nativeSetDrawFilter(long nativeCanvas, + long nativeFilter); + private static native boolean native_getClipBounds(long nativeCanvas, Rect bounds); - private static native void native_getCTM(int canvas, int matrix); - private static native boolean native_quickReject(int nativeCanvas, + private static native void native_getCTM(long nativeCanvas, + long nativeMatrix); + private static native boolean native_quickReject(long nativeCanvas, RectF rect); - private static native boolean native_quickReject(int nativeCanvas, - int path); - private static native boolean native_quickReject(int nativeCanvas, + private static native boolean native_quickReject(long nativeCanvas, + long nativePath); + private static native boolean native_quickReject(long nativeCanvas, float left, float top, float right, float bottom); - private static native void native_drawRGB(int nativeCanvas, int r, int g, + private static native void native_drawRGB(long nativeCanvas, int r, int g, int b); - private static native void native_drawARGB(int nativeCanvas, int a, int r, + private static native void native_drawARGB(long nativeCanvas, int a, int r, int g, int b); - private static native void native_drawColor(int nativeCanvas, int color); - private static native void native_drawColor(int nativeCanvas, int color, + private static native void native_drawColor(long nativeCanvas, int color); + private static native void native_drawColor(long nativeCanvas, int color, int mode); - private static native void native_drawPaint(int nativeCanvas, int paint); - private static native void native_drawLine(int nativeCanvas, float startX, + private static native void native_drawPaint(long nativeCanvas, + long nativePaint); + private static native void native_drawLine(long nativeCanvas, float startX, float startY, float stopX, - float stopY, int paint); - private static native void native_drawRect(int nativeCanvas, RectF rect, - int paint); - private static native void native_drawRect(int nativeCanvas, float left, + float stopY, long nativePaint); + private static native void native_drawRect(long nativeCanvas, RectF rect, + long nativePaint); + private static native void native_drawRect(long nativeCanvas, float left, float top, float right, - float bottom, int paint); - private static native void native_drawOval(int nativeCanvas, RectF oval, - int paint); - private static native void native_drawCircle(int nativeCanvas, float cx, + float bottom, + long nativePaint); + private static native void native_drawOval(long nativeCanvas, RectF oval, + long nativePaint); + private static native void native_drawCircle(long nativeCanvas, float cx, float cy, float radius, - int paint); - private static native void native_drawArc(int nativeCanvas, RectF oval, + long nativePaint); + private static native void native_drawArc(long nativeCanvas, RectF oval, float startAngle, float sweep, - boolean useCenter, int paint); - private static native void native_drawRoundRect(int nativeCanvas, + boolean useCenter, + long nativePaint); + private static native void native_drawRoundRect(long nativeCanvas, RectF rect, float rx, - float ry, int paint); - private static native void native_drawPath(int nativeCanvas, int path, - int paint); - private native void native_drawBitmap(int nativeCanvas, int bitmap, + float ry, long nativePaint); + private static native void native_drawPath(long nativeCanvas, + long nativePath, + long nativePaint); + private native void native_drawBitmap(long nativeCanvas, long nativeBitmap, float left, float top, - int nativePaintOrZero, + long nativePaintOrZero, int canvasDensity, int screenDensity, int bitmapDensity); - private native void native_drawBitmap(int nativeCanvas, int bitmap, + private native void native_drawBitmap(long nativeCanvas, long nativeBitmap, Rect src, RectF dst, - int nativePaintOrZero, + long nativePaintOrZero, int screenDensity, int bitmapDensity); - private static native void native_drawBitmap(int nativeCanvas, int bitmap, + private static native void native_drawBitmap(long nativeCanvas, + long nativeBitmap, Rect src, Rect dst, - int nativePaintOrZero, + long nativePaintOrZero, int screenDensity, int bitmapDensity); - private static native void native_drawBitmap(int nativeCanvas, int[] colors, + private static native void native_drawBitmap(long nativeCanvas, int[] colors, int offset, int stride, float x, float y, int width, int height, boolean hasAlpha, - int nativePaintOrZero); - private static native void nativeDrawBitmapMatrix(int nCanvas, int nBitmap, - int nMatrix, int nPaint); - private static native void nativeDrawBitmapMesh(int nCanvas, int nBitmap, + long nativePaintOrZero); + private static native void nativeDrawBitmapMatrix(long nativeCanvas, + long nativeBitmap, + long nativeMatrix, + long nativePaint); + private static native void nativeDrawBitmapMesh(long nativeCanvas, + long nativeBitmap, int meshWidth, int meshHeight, float[] verts, int vertOffset, - int[] colors, int colorOffset, int nPaint); - private static native void nativeDrawVertices(int nCanvas, int mode, int n, + int[] colors, int colorOffset, + long nativePaint); + private static native void nativeDrawVertices(long nativeCanvas, int mode, int n, float[] verts, int vertOffset, float[] texs, int texOffset, int[] colors, int colorOffset, short[] indices, - int indexOffset, int indexCount, int nPaint); - - private static native void native_drawText(int nativeCanvas, char[] text, + int indexOffset, int indexCount, long nativePaint); + + private static native void native_drawText(long nativeCanvas, char[] text, int index, int count, float x, - float y, int flags, int paint, int typeface); - private static native void native_drawText(int nativeCanvas, String text, + float y, int flags, long nativePaint, + long nativeTypeface); + private static native void native_drawText(long nativeCanvas, String text, int start, int end, float x, - float y, int flags, int paint, int typeface); + float y, int flags, long nativePaint, + long nativeTypeface); - private static native void native_drawTextRun(int nativeCanvas, String text, + private static native void native_drawTextRun(long nativeCanvas, String text, int start, int end, int contextStart, int contextEnd, - float x, float y, int flags, int paint, int typeface); + float x, float y, int flags, long nativePaint, long nativeTypeface); - private static native void native_drawTextRun(int nativeCanvas, char[] text, + private static native void native_drawTextRun(long nativeCanvas, char[] text, int start, int count, int contextStart, int contextCount, - float x, float y, int flags, int paint, int typeface); + float x, float y, int flags, long nativePaint, long nativeTypeface); - private static native void native_drawPosText(int nativeCanvas, + private static native void native_drawPosText(long nativeCanvas, char[] text, int index, int count, float[] pos, - int paint); - private static native void native_drawPosText(int nativeCanvas, + long nativePaint); + private static native void native_drawPosText(long nativeCanvas, String text, float[] pos, - int paint); - private static native void native_drawTextOnPath(int nativeCanvas, + long nativePaint); + private static native void native_drawTextOnPath(long nativeCanvas, char[] text, int index, - int count, int path, + int count, long nativePath, float hOffset, float vOffset, int bidiFlags, - int paint); - private static native void native_drawTextOnPath(int nativeCanvas, - String text, int path, - float hOffset, - float vOffset, - int flags, int paint); - private static native void finalizer(int nativeCanvas); + long nativePaint); + private static native void native_drawTextOnPath(long nativeCanvas, + String text, long nativePath, + float hOffset, + float vOffset, + int flags, long nativePaint); + private static native void finalizer(long nativeCanvas); } diff --git a/graphics/java/android/graphics/ColorFilter.java b/graphics/java/android/graphics/ColorFilter.java index 8e0af77..d3c1974 100644 --- a/graphics/java/android/graphics/ColorFilter.java +++ b/graphics/java/android/graphics/ColorFilter.java @@ -28,14 +28,14 @@ package android.graphics; */ public class ColorFilter { // Holds the pointer to the native SkColorFilter instance - int native_instance; + long native_instance; /** * Holds the pointer to the native SkiaColorFilter instance, from libhwui. * * @hide */ - public int nativeColorFilter; + public long nativeColorFilter; @Override protected void finalize() throws Throwable { @@ -46,5 +46,5 @@ public class ColorFilter { } } - static native void destroyFilter(int native_instance, int nativeColorFilter); + static native void destroyFilter(long native_instance, long nativeColorFilter); } diff --git a/graphics/java/android/graphics/ColorMatrixColorFilter.java b/graphics/java/android/graphics/ColorMatrixColorFilter.java index 8de32ec..3f7331d 100644 --- a/graphics/java/android/graphics/ColorMatrixColorFilter.java +++ b/graphics/java/android/graphics/ColorMatrixColorFilter.java @@ -119,6 +119,6 @@ public class ColorMatrixColorFilter extends ColorFilter { nativeColorFilter = nColorMatrixFilter(native_instance, colorMatrix); } - private static native int nativeColorMatrixFilter(float[] array); - private static native int nColorMatrixFilter(int nativeFilter, float[] array); + private static native long nativeColorMatrixFilter(float[] array); + private static native long nColorMatrixFilter(long nativeFilter, float[] array); } diff --git a/graphics/java/android/graphics/ComposePathEffect.java b/graphics/java/android/graphics/ComposePathEffect.java index beac78e..3fc9eb5 100644 --- a/graphics/java/android/graphics/ComposePathEffect.java +++ b/graphics/java/android/graphics/ComposePathEffect.java @@ -27,6 +27,7 @@ public class ComposePathEffect extends PathEffect { innerpe.native_instance); } - private static native int nativeCreate(int outerpe, int innerpe); + private static native long nativeCreate(long nativeOuterpe, + long nativeInnerpe); } diff --git a/graphics/java/android/graphics/ComposeShader.java b/graphics/java/android/graphics/ComposeShader.java index de0d3d6..5109ffd 100644 --- a/graphics/java/android/graphics/ComposeShader.java +++ b/graphics/java/android/graphics/ComposeShader.java @@ -104,12 +104,12 @@ public class ComposeShader extends Shader { return copy; } - private static native int nativeCreate1(int native_shaderA, int native_shaderB, - int native_mode); - private static native int nativeCreate2(int native_shaderA, int native_shaderB, + private static native long nativeCreate1(long native_shaderA, long native_shaderB, + long native_mode); + private static native long nativeCreate2(long native_shaderA, long native_shaderB, int porterDuffMode); - private static native int nativePostCreate1(int native_shader, int native_skiaShaderA, - int native_skiaShaderB, int native_mode); - private static native int nativePostCreate2(int native_shader, int native_skiaShaderA, - int native_skiaShaderB, int porterDuffMode); + private static native long nativePostCreate1(long native_shader, long native_skiaShaderA, + long native_skiaShaderB, long native_mode); + private static native long nativePostCreate2(long native_shader, long native_skiaShaderA, + long native_skiaShaderB, int porterDuffMode); } diff --git a/graphics/java/android/graphics/CornerPathEffect.java b/graphics/java/android/graphics/CornerPathEffect.java index 400c886..8f4d7d9 100644 --- a/graphics/java/android/graphics/CornerPathEffect.java +++ b/graphics/java/android/graphics/CornerPathEffect.java @@ -28,6 +28,6 @@ public class CornerPathEffect extends PathEffect { native_instance = nativeCreate(radius); } - private static native int nativeCreate(float radius); + private static native long nativeCreate(float radius); } diff --git a/graphics/java/android/graphics/DashPathEffect.java b/graphics/java/android/graphics/DashPathEffect.java index 2bdecce..ef3ebe8 100644 --- a/graphics/java/android/graphics/DashPathEffect.java +++ b/graphics/java/android/graphics/DashPathEffect.java @@ -38,6 +38,6 @@ public class DashPathEffect extends PathEffect { native_instance = nativeCreate(intervals, phase); } - private static native int nativeCreate(float intervals[], float phase); + private static native long nativeCreate(float intervals[], float phase); } diff --git a/graphics/java/android/graphics/DiscretePathEffect.java b/graphics/java/android/graphics/DiscretePathEffect.java index de8b2f0..3b3c9c9 100644 --- a/graphics/java/android/graphics/DiscretePathEffect.java +++ b/graphics/java/android/graphics/DiscretePathEffect.java @@ -26,6 +26,6 @@ public class DiscretePathEffect extends PathEffect { native_instance = nativeCreate(segmentLength, deviation); } - private static native int nativeCreate(float length, float deviation); + private static native long nativeCreate(float length, float deviation); } diff --git a/graphics/java/android/graphics/DrawFilter.java b/graphics/java/android/graphics/DrawFilter.java index 1f64539..ed38f37 100644 --- a/graphics/java/android/graphics/DrawFilter.java +++ b/graphics/java/android/graphics/DrawFilter.java @@ -25,7 +25,7 @@ package android.graphics; public class DrawFilter { // this is set by subclasses, but don't make it public - /* package */ int mNativeInt; // pointer to native object + /* package */ long mNativeInt; // pointer to native object protected void finalize() throws Throwable { try { @@ -35,6 +35,6 @@ public class DrawFilter { } } - private static native void nativeDestructor(int nativeDrawFilter); + private static native void nativeDestructor(long nativeDrawFilter); } diff --git a/graphics/java/android/graphics/EmbossMaskFilter.java b/graphics/java/android/graphics/EmbossMaskFilter.java index 5dd8611..a9e180f 100644 --- a/graphics/java/android/graphics/EmbossMaskFilter.java +++ b/graphics/java/android/graphics/EmbossMaskFilter.java @@ -33,6 +33,6 @@ public class EmbossMaskFilter extends MaskFilter { native_instance = nativeConstructor(direction, ambient, specular, blurRadius); } - private static native int nativeConstructor(float[] direction, float ambient, float specular, float blurRadius); + private static native long nativeConstructor(float[] direction, float ambient, float specular, float blurRadius); } diff --git a/graphics/java/android/graphics/LargeBitmap.java b/graphics/java/android/graphics/LargeBitmap.java index c70c709..936c338 100644 --- a/graphics/java/android/graphics/LargeBitmap.java +++ b/graphics/java/android/graphics/LargeBitmap.java @@ -27,7 +27,7 @@ package android.graphics; * @hide */ public final class LargeBitmap { - private int mNativeLargeBitmap; + private long mNativeLargeBitmap; private boolean mRecycled; /* Private constructor that must received an already allocated native @@ -35,8 +35,8 @@ public final class LargeBitmap { This can be called from JNI code. */ - private LargeBitmap(int lbm) { - mNativeLargeBitmap = lbm; + private LargeBitmap(long nativeLbm) { + mNativeLargeBitmap = nativeLbm; mRecycled = false; } @@ -109,10 +109,10 @@ public final class LargeBitmap { recycle(); } - private static native Bitmap nativeDecodeRegion(int lbm, + private static native Bitmap nativeDecodeRegion(long nativeLbm, int start_x, int start_y, int width, int height, BitmapFactory.Options options); - private static native int nativeGetWidth(int lbm); - private static native int nativeGetHeight(int lbm); - private static native void nativeClean(int lbm); + private static native int nativeGetWidth(long nativeLbm); + private static native int nativeGetHeight(long nativeLbm); + private static native void nativeClean(long nativeLbm); } diff --git a/graphics/java/android/graphics/LayerRasterizer.java b/graphics/java/android/graphics/LayerRasterizer.java index 9bd55a5..dc307c6 100644 --- a/graphics/java/android/graphics/LayerRasterizer.java +++ b/graphics/java/android/graphics/LayerRasterizer.java @@ -34,7 +34,7 @@ public class LayerRasterizer extends Rasterizer { nativeAddLayer(native_instance, paint.mNativePaint, 0, 0); } - private static native int nativeConstructor(); - private static native void nativeAddLayer(int native_layer, int native_paint, float dx, float dy); + private static native long nativeConstructor(); + private static native void nativeAddLayer(long native_layer, long native_paint, float dx, float dy); } diff --git a/graphics/java/android/graphics/LightingColorFilter.java b/graphics/java/android/graphics/LightingColorFilter.java index 75f1827..5829edf 100644 --- a/graphics/java/android/graphics/LightingColorFilter.java +++ b/graphics/java/android/graphics/LightingColorFilter.java @@ -104,6 +104,6 @@ public class LightingColorFilter extends ColorFilter { nativeColorFilter = nCreateLightingFilter(native_instance, mMul, mAdd); } - private static native int native_CreateLightingFilter(int mul, int add); - private static native int nCreateLightingFilter(int nativeFilter, int mul, int add); + private static native long native_CreateLightingFilter(int mul, int add); + private static native long nCreateLightingFilter(long nativeFilter, int mul, int add); } diff --git a/graphics/java/android/graphics/LinearGradient.java b/graphics/java/android/graphics/LinearGradient.java index 4c88de3..9ad3e49 100644 --- a/graphics/java/android/graphics/LinearGradient.java +++ b/graphics/java/android/graphics/LinearGradient.java @@ -116,12 +116,12 @@ public class LinearGradient extends Shader { return copy; } - private native int nativeCreate1(float x0, float y0, float x1, float y1, + private native long nativeCreate1(float x0, float y0, float x1, float y1, int colors[], float positions[], int tileMode); - private native int nativeCreate2(float x0, float y0, float x1, float y1, + private native long nativeCreate2(float x0, float y0, float x1, float y1, int color0, int color1, int tileMode); - private native int nativePostCreate1(int native_shader, float x0, float y0, float x1, float y1, + private native long nativePostCreate1(long native_shader, float x0, float y0, float x1, float y1, int colors[], float positions[], int tileMode); - private native int nativePostCreate2(int native_shader, float x0, float y0, float x1, float y1, + private native long nativePostCreate2(long native_shader, float x0, float y0, float x1, float y1, int color0, int color1, int tileMode); } diff --git a/graphics/java/android/graphics/MaskFilter.java b/graphics/java/android/graphics/MaskFilter.java index 4ebb619..27a7dda 100644 --- a/graphics/java/android/graphics/MaskFilter.java +++ b/graphics/java/android/graphics/MaskFilter.java @@ -27,6 +27,6 @@ public class MaskFilter { nativeDestructor(native_instance); } - private static native void nativeDestructor(int native_filter); - int native_instance; + private static native void nativeDestructor(long native_filter); + long native_instance; } diff --git a/graphics/java/android/graphics/Matrix.java b/graphics/java/android/graphics/Matrix.java index 32e0c01..c8bcf26 100644 --- a/graphics/java/android/graphics/Matrix.java +++ b/graphics/java/android/graphics/Matrix.java @@ -219,7 +219,7 @@ public class Matrix { /** * @hide */ - public int native_instance; + public long native_instance; /** * Create an identity matrix @@ -800,83 +800,86 @@ public class Matrix { } } - /*package*/ final int ni() { + /*package*/ final long ni() { return native_instance; } - private static native int native_create(int native_src_or_zero); - private static native boolean native_isIdentity(int native_object); - private static native boolean native_rectStaysRect(int native_object); - private static native void native_reset(int native_object); - private static native void native_set(int native_object, int other); - private static native void native_setTranslate(int native_object, + private static native long native_create(long native_src_or_zero); + private static native boolean native_isIdentity(long native_object); + private static native boolean native_rectStaysRect(long native_object); + private static native void native_reset(long native_object); + private static native void native_set(long native_object, + long native_other); + private static native void native_setTranslate(long native_object, float dx, float dy); - private static native void native_setScale(int native_object, + private static native void native_setScale(long native_object, float sx, float sy, float px, float py); - private static native void native_setScale(int native_object, + private static native void native_setScale(long native_object, float sx, float sy); - private static native void native_setRotate(int native_object, + private static native void native_setRotate(long native_object, float degrees, float px, float py); - private static native void native_setRotate(int native_object, + private static native void native_setRotate(long native_object, float degrees); - private static native void native_setSinCos(int native_object, + private static native void native_setSinCos(long native_object, float sinValue, float cosValue, float px, float py); - private static native void native_setSinCos(int native_object, + private static native void native_setSinCos(long native_object, float sinValue, float cosValue); - private static native void native_setSkew(int native_object, + private static native void native_setSkew(long native_object, float kx, float ky, float px, float py); - private static native void native_setSkew(int native_object, + private static native void native_setSkew(long native_object, float kx, float ky); - private static native boolean native_setConcat(int native_object, - int a, int b); - private static native boolean native_preTranslate(int native_object, + private static native boolean native_setConcat(long native_object, + long native_a, + long native_b); + private static native boolean native_preTranslate(long native_object, float dx, float dy); - private static native boolean native_preScale(int native_object, + private static native boolean native_preScale(long native_object, float sx, float sy, float px, float py); - private static native boolean native_preScale(int native_object, + private static native boolean native_preScale(long native_object, float sx, float sy); - private static native boolean native_preRotate(int native_object, + private static native boolean native_preRotate(long native_object, float degrees, float px, float py); - private static native boolean native_preRotate(int native_object, + private static native boolean native_preRotate(long native_object, float degrees); - private static native boolean native_preSkew(int native_object, + private static native boolean native_preSkew(long native_object, float kx, float ky, float px, float py); - private static native boolean native_preSkew(int native_object, + private static native boolean native_preSkew(long native_object, float kx, float ky); - private static native boolean native_preConcat(int native_object, - int other_matrix); - private static native boolean native_postTranslate(int native_object, + private static native boolean native_preConcat(long native_object, + long native_other_matrix); + private static native boolean native_postTranslate(long native_object, float dx, float dy); - private static native boolean native_postScale(int native_object, + private static native boolean native_postScale(long native_object, float sx, float sy, float px, float py); - private static native boolean native_postScale(int native_object, + private static native boolean native_postScale(long native_object, float sx, float sy); - private static native boolean native_postRotate(int native_object, + private static native boolean native_postRotate(long native_object, float degrees, float px, float py); - private static native boolean native_postRotate(int native_object, + private static native boolean native_postRotate(long native_object, float degrees); - private static native boolean native_postSkew(int native_object, + private static native boolean native_postSkew(long native_object, float kx, float ky, float px, float py); - private static native boolean native_postSkew(int native_object, + private static native boolean native_postSkew(long native_object, float kx, float ky); - private static native boolean native_postConcat(int native_object, - int other_matrix); - private static native boolean native_setRectToRect(int native_object, + private static native boolean native_postConcat(long native_object, + long native_other_matrix); + private static native boolean native_setRectToRect(long native_object, RectF src, RectF dst, int stf); - private static native boolean native_setPolyToPoly(int native_object, + private static native boolean native_setPolyToPoly(long native_object, float[] src, int srcIndex, float[] dst, int dstIndex, int pointCount); - private static native boolean native_invert(int native_object, int inverse); - private static native void native_mapPoints(int native_object, + private static native boolean native_invert(long native_object, + long native_inverse); + private static native void native_mapPoints(long native_object, float[] dst, int dstIndex, float[] src, int srcIndex, int ptCount, boolean isPts); - private static native boolean native_mapRect(int native_object, + private static native boolean native_mapRect(long native_object, RectF dst, RectF src); - private static native float native_mapRadius(int native_object, + private static native float native_mapRadius(long native_object, float radius); - private static native void native_getValues(int native_object, + private static native void native_getValues(long native_object, float[] values); - private static native void native_setValues(int native_object, + private static native void native_setValues(long native_object, float[] values); - private static native boolean native_equals(int native_a, int native_b); - private static native void finalizer(int native_instance); + private static native boolean native_equals(long native_a, long native_b); + private static native void finalizer(long native_instance); } diff --git a/graphics/java/android/graphics/NinePatch.java b/graphics/java/android/graphics/NinePatch.java index 528d9de..69089b1 100644 --- a/graphics/java/android/graphics/NinePatch.java +++ b/graphics/java/android/graphics/NinePatch.java @@ -39,7 +39,7 @@ public class NinePatch { * * @hide */ - public final int mNativeChunk; + public final long mNativeChunk; private Paint mPaint; private String mSrcName; @@ -217,7 +217,7 @@ public class NinePatch { * that are transparent. */ public final Region getTransparentRegion(Rect bounds) { - int r = nativeGetTransparentRegion(mBitmap.ni(), mNativeChunk, bounds); + long r = nativeGetTransparentRegion(mBitmap.ni(), mNativeChunk, bounds); return r != 0 ? new Region(r) : null; } @@ -236,11 +236,11 @@ public class NinePatch { * If validation is successful, this method returns a native Res_png_9patch* * object used by the renderers. */ - private static native int validateNinePatchChunk(int bitmap, byte[] chunk); - private static native void nativeFinalize(int chunk); - private static native void nativeDraw(int canvas_instance, RectF loc, int bitmap_instance, - int c, int paint_instance_or_null, int destDensity, int srcDensity); - private static native void nativeDraw(int canvas_instance, Rect loc, int bitmap_instance, - int c, int paint_instance_or_null, int destDensity, int srcDensity); - private static native int nativeGetTransparentRegion(int bitmap, int chunk, Rect location); + 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, long bitmap_instance, + long c, long paint_instance_or_null, int destDensity, int srcDensity); + 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(long bitmap, long chunk, Rect location); } diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java index c2d4df2..916cb5a 100644 --- a/graphics/java/android/graphics/Paint.java +++ b/graphics/java/android/graphics/Paint.java @@ -32,11 +32,11 @@ public class Paint { /** * @hide */ - public int mNativePaint; + public long mNativePaint; /** * @hide */ - public int mNativeTypeface; + public long mNativeTypeface; private ColorFilter mColorFilter; private MaskFilter mMaskFilter; @@ -949,7 +949,7 @@ public class Paint { * @return shader */ public Shader setShader(Shader shader) { - int shaderNative = 0; + long shaderNative = 0; if (shader != null) shaderNative = shader.native_instance; native_setShader(mNativePaint, shaderNative); @@ -973,7 +973,7 @@ public class Paint { * @return filter */ public ColorFilter setColorFilter(ColorFilter filter) { - int filterNative = 0; + long filterNative = 0; if (filter != null) filterNative = filter.native_instance; native_setColorFilter(mNativePaint, filterNative); @@ -1000,7 +1000,7 @@ public class Paint { * @return xfermode */ public Xfermode setXfermode(Xfermode xfermode) { - int xfermodeNative = 0; + long xfermodeNative = 0; if (xfermode != null) xfermodeNative = xfermode.native_instance; native_setXfermode(mNativePaint, xfermodeNative); @@ -1027,7 +1027,7 @@ public class Paint { * @return effect */ public PathEffect setPathEffect(PathEffect effect) { - int effectNative = 0; + long effectNative = 0; if (effect != null) { effectNative = effect.native_instance; } @@ -1056,7 +1056,7 @@ public class Paint { * @return maskfilter */ public MaskFilter setMaskFilter(MaskFilter maskfilter) { - int maskfilterNative = 0; + long maskfilterNative = 0; if (maskfilter != null) { maskfilterNative = maskfilter.native_instance; } @@ -1087,7 +1087,7 @@ public class Paint { * @return typeface */ public Typeface setTypeface(Typeface typeface) { - int typefaceNative = 0; + long typefaceNative = 0; if (typeface != null) { typefaceNative = typeface.native_instance; } @@ -1119,7 +1119,7 @@ public class Paint { * @return rasterizer */ public Rasterizer setRasterizer(Rasterizer rasterizer) { - int rasterizerNative = 0; + long rasterizerNative = 0; if (rasterizer != null) { rasterizerNative = rasterizer.native_instance; } @@ -2214,68 +2214,68 @@ public class Paint { } } - private static native int native_init(); - private static native int native_initWithPaint(int paint); - private static native void native_reset(int native_object); - private static native void native_set(int native_dst, int native_src); - private static native int native_getStyle(int native_object); - private static native void native_setStyle(int native_object, int style); - private static native int native_getStrokeCap(int native_object); - private static native void native_setStrokeCap(int native_object, int cap); - private static native int native_getStrokeJoin(int native_object); - private static native void native_setStrokeJoin(int native_object, + private static native long native_init(); + private static native long native_initWithPaint(long paint); + private static native void native_reset(long native_object); + private static native void native_set(long native_dst, long native_src); + private static native int native_getStyle(long native_object); + private static native void native_setStyle(long native_object, int style); + private static native int native_getStrokeCap(long native_object); + private static native void native_setStrokeCap(long native_object, int cap); + private static native int native_getStrokeJoin(long native_object); + private static native void native_setStrokeJoin(long native_object, int join); - private static native boolean native_getFillPath(int native_object, - int src, int dst); - private static native int native_setShader(int native_object, int shader); - private static native int native_setColorFilter(int native_object, - int filter); - private static native int native_setXfermode(int native_object, - int xfermode); - private static native int native_setPathEffect(int native_object, - int effect); - private static native int native_setMaskFilter(int native_object, - int maskfilter); - private static native int native_setTypeface(int native_object, - int typeface); - private static native int native_setRasterizer(int native_object, - int rasterizer); - - private static native int native_getTextAlign(int native_object); - private static native void native_setTextAlign(int native_object, + private static native boolean native_getFillPath(long native_object, + long src, long dst); + private static native long native_setShader(long native_object, long shader); + private static native long native_setColorFilter(long native_object, + long filter); + private static native long native_setXfermode(long native_object, + long xfermode); + private static native long native_setPathEffect(long native_object, + long effect); + private static native long native_setMaskFilter(long native_object, + long maskfilter); + private static native long native_setTypeface(long native_object, + long typeface); + private static native long native_setRasterizer(long native_object, + long rasterizer); + + private static native int native_getTextAlign(long native_object); + private static native void native_setTextAlign(long native_object, int align); - private static native void native_setTextLocale(int native_object, + private static native void native_setTextLocale(long native_object, String locale); - private static native int native_getTextWidths(int native_object, + private static native int native_getTextWidths(long native_object, char[] text, int index, int count, int bidiFlags, float[] widths); - private static native int native_getTextWidths(int native_object, + private static native int native_getTextWidths(long native_object, String text, int start, int end, int bidiFlags, float[] widths); - private static native int native_getTextGlyphs(int native_object, + private static native int native_getTextGlyphs(long native_object, String text, int start, int end, int contextStart, int contextEnd, int flags, char[] glyphs); - private static native float native_getTextRunAdvances(int native_object, + private static native float native_getTextRunAdvances(long native_object, char[] text, int index, int count, int contextIndex, int contextCount, int flags, float[] advances, int advancesIndex); - private static native float native_getTextRunAdvances(int native_object, + private static native float native_getTextRunAdvances(long native_object, String text, int start, int end, int contextStart, int contextEnd, int flags, float[] advances, int advancesIndex); - private native int native_getTextRunCursor(int native_object, char[] text, + private native int native_getTextRunCursor(long native_object, char[] text, int contextStart, int contextLength, int flags, int offset, int cursorOpt); - private native int native_getTextRunCursor(int native_object, String text, + private native int native_getTextRunCursor(long native_object, String text, int contextStart, int contextEnd, int flags, int offset, int cursorOpt); - private static native void native_getTextPath(int native_object, int bidiFlags, - char[] text, int index, int count, float x, float y, int path); - private static native void native_getTextPath(int native_object, int bidiFlags, - String text, int start, int end, float x, float y, int path); - private static native void nativeGetStringBounds(int nativePaint, + private static native void native_getTextPath(long native_object, int bidiFlags, + char[] text, int index, int count, float x, float y, long path); + private static native void native_getTextPath(long native_object, int bidiFlags, + String text, int start, int end, float x, float y, long path); + private static native void nativeGetStringBounds(long nativePaint, String text, int start, int end, int bidiFlags, Rect bounds); - private static native void nativeGetCharArrayBounds(int nativePaint, + private static native void nativeGetCharArrayBounds(long nativePaint, char[] text, int index, int count, int bidiFlags, Rect bounds); - private static native void finalizer(int nativePaint); + private static native void finalizer(long nativePaint); } diff --git a/graphics/java/android/graphics/PaintFlagsDrawFilter.java b/graphics/java/android/graphics/PaintFlagsDrawFilter.java index c833a12..65a6218 100644 --- a/graphics/java/android/graphics/PaintFlagsDrawFilter.java +++ b/graphics/java/android/graphics/PaintFlagsDrawFilter.java @@ -38,6 +38,6 @@ public class PaintFlagsDrawFilter extends DrawFilter { mNativeInt = nativeConstructor(clearBits, setBits); } - private static native int nativeConstructor(int clearBits, int setBits); + private static native long nativeConstructor(int clearBits, int setBits); } diff --git a/graphics/java/android/graphics/Path.java b/graphics/java/android/graphics/Path.java index 4776088..5ac3f85 100644 --- a/graphics/java/android/graphics/Path.java +++ b/graphics/java/android/graphics/Path.java @@ -27,8 +27,8 @@ public class Path { /** * @hide */ - public final int mNativePath; - private int mNativePathMeasure; + public final long mNativePath; + private long mNativePathMeasure; /** * @hide @@ -53,7 +53,7 @@ public class Path { * @param src The path to copy from when initializing the new path */ public Path(Path src) { - int valNative = 0; + long valNative = 0; if (src != null) { valNative = src.mNativePath; isSimplePath = src.isSimplePath; @@ -657,7 +657,7 @@ public class Path { * the original path is modified. */ public void offset(float dx, float dy, Path dst) { - int dstNative = 0; + long dstNative = 0; if (dst != null) { dstNative = dst.mNativePath; dst.isSimplePath = false; @@ -703,7 +703,7 @@ public class Path { * then the the original path is modified */ public void transform(Matrix matrix, Path dst) { - int dstNative = 0; + long dstNative = 0; if (dst != null) { dst.isSimplePath = false; dstNative = dst.mNativePath; @@ -738,7 +738,7 @@ public class Path { } } - final int ni() { + final long ni() { return mNativePath; } @@ -818,7 +818,7 @@ public class Path { if (trimStart > trimEnd) { throw new IllegalArgumentException("trim end cannot be less than start"); } - int dstNative = 0; + long dstNative = 0; if (dst != null) { dstNative = dst.mNativePath; dst.isSimplePath = false; @@ -828,54 +828,54 @@ public class Path { trimStart, trimEnd, trimOffset); } - private static native int init1(); - private static native int init2(int nPath); - private static native void native_reset(int nPath); - private static native void native_rewind(int nPath); - private static native void native_set(int native_dst, int native_src); - private static native int native_getFillType(int nPath); - private static native void native_setFillType(int nPath, int ft); - private static native boolean native_isEmpty(int nPath); - private static native boolean native_isRect(int nPath, RectF rect); - private static native void native_computeBounds(int nPath, RectF bounds); - private static native void native_incReserve(int nPath, int extraPtCount); - private static native void native_moveTo(int nPath, float x, float y); - private static native void native_rMoveTo(int nPath, float dx, float dy); - private static native void native_lineTo(int nPath, float x, float y); - private static native void native_rLineTo(int nPath, float dx, float dy); - private static native void native_quadTo(int nPath, float x1, float y1, + private static native long init1(); + private static native long init2(long nPath); + private static native void native_reset(long nPath); + private static native void native_rewind(long nPath); + private static native void native_set(long native_dst, long native_src); + private static native int native_getFillType(long nPath); + private static native void native_setFillType(long nPath, int ft); + private static native boolean native_isEmpty(long nPath); + private static native boolean native_isRect(long nPath, RectF rect); + private static native void native_computeBounds(long nPath, RectF bounds); + private static native void native_incReserve(long nPath, int extraPtCount); + private static native void native_moveTo(long nPath, float x, float y); + private static native void native_rMoveTo(long nPath, float dx, float dy); + private static native void native_lineTo(long nPath, float x, float y); + private static native void native_rLineTo(long nPath, float dx, float dy); + private static native void native_quadTo(long nPath, float x1, float y1, float x2, float y2); - private static native void native_rQuadTo(int nPath, float dx1, float dy1, + private static native void native_rQuadTo(long nPath, float dx1, float dy1, float dx2, float dy2); - private static native void native_cubicTo(int nPath, float x1, float y1, + private static native void native_cubicTo(long nPath, float x1, float y1, float x2, float y2, float x3, float y3); - private static native void native_rCubicTo(int nPath, float x1, float y1, + private static native void native_rCubicTo(long nPath, float x1, float y1, float x2, float y2, float x3, float y3); - private static native void native_arcTo(int nPath, RectF oval, + private static native void native_arcTo(long nPath, RectF oval, float startAngle, float sweepAngle, boolean forceMoveTo); - private static native void native_close(int nPath); - private static native void native_addRect(int nPath, RectF rect, int dir); - private static native void native_addRect(int nPath, float left, float top, + private static native void native_close(long nPath); + private static native void native_addRect(long nPath, RectF rect, int dir); + private static native void native_addRect(long nPath, float left, float top, float right, float bottom, int dir); - private static native void native_addOval(int nPath, RectF oval, int dir); - private static native void native_addCircle(int nPath, float x, float y, float radius, int dir); - private static native void native_addArc(int nPath, RectF oval, + private static native void native_addOval(long nPath, RectF oval, int dir); + private static native void native_addCircle(long nPath, float x, float y, float radius, int dir); + private static native void native_addArc(long nPath, RectF oval, float startAngle, float sweepAngle); - private static native void native_addRoundRect(int nPath, RectF rect, + private static native void native_addRoundRect(long nPath, RectF rect, float rx, float ry, int dir); - private static native void native_addRoundRect(int nPath, RectF r, float[] radii, int dir); - private static native void native_addPath(int nPath, int src, float dx, float dy); - private static native void native_addPath(int nPath, int src); - private static native void native_addPath(int nPath, int src, int matrix); - private static native void native_offset(int nPath, float dx, float dy, int dst_path); - private static native void native_offset(int nPath, float dx, float dy); - private static native void native_setLastPoint(int nPath, float dx, float dy); - private static native void native_transform(int nPath, int matrix, int dst_path); - private static native void native_transform(int nPath, int matrix); - private static native boolean native_op(int path1, int path2, int op, int result); - private static native void finalizer(int nPath); - private static native float[] native_approximate(int nPath, float error); - private static native int native_trim(int nPath, int nTargetPath, int nPathMeasure, + private static native void native_addRoundRect(long nPath, RectF r, float[] radii, int dir); + private static native void native_addPath(long nPath, long src, float dx, float dy); + private static native void native_addPath(long nPath, long src); + private static native void native_addPath(long nPath, long src, long matrix); + private static native void native_offset(long nPath, float dx, float dy, long dst_path); + private static native void native_offset(long nPath, float dx, float dy); + private static native void native_setLastPoint(long nPath, float dx, float dy); + private static native void native_transform(long nPath, long matrix, long dst_path); + private static native void native_transform(long nPath, long matrix); + private static native boolean native_op(long path1, long path2, int op, long result); + private static native void finalizer(long nPath); + private static native float[] native_approximate(long nPath, float error); + private static native int native_trim(long nPath, long nTargetPath, long nPathMeasure, float trimStart, float trimEnd, float trimOffset); - private static native void native_destroyMeasure(int nPathMeasure); + private static native void native_destroyMeasure(long nPathMeasure); } diff --git a/graphics/java/android/graphics/PathDashPathEffect.java b/graphics/java/android/graphics/PathDashPathEffect.java index e8ad5fd..4f43f68 100644 --- a/graphics/java/android/graphics/PathDashPathEffect.java +++ b/graphics/java/android/graphics/PathDashPathEffect.java @@ -45,7 +45,7 @@ public class PathDashPathEffect extends PathEffect { style.native_style); } - private static native int nativeCreate(int native_path, float advance, + private static native long nativeCreate(long native_path, float advance, float phase, int native_style); } diff --git a/graphics/java/android/graphics/PathEffect.java b/graphics/java/android/graphics/PathEffect.java index 9b2cd66..617dfca 100644 --- a/graphics/java/android/graphics/PathEffect.java +++ b/graphics/java/android/graphics/PathEffect.java @@ -27,6 +27,6 @@ public class PathEffect { nativeDestructor(native_instance); } - private static native void nativeDestructor(int native_patheffect); - int native_instance; + private static native void nativeDestructor(long native_patheffect); + long native_instance; } diff --git a/graphics/java/android/graphics/Picture.java b/graphics/java/android/graphics/Picture.java index 71e02f6..25188e0 100644 --- a/graphics/java/android/graphics/Picture.java +++ b/graphics/java/android/graphics/Picture.java @@ -29,7 +29,7 @@ import java.io.OutputStream; */ public class Picture { private Canvas mRecordingCanvas; - private final int mNativePicture; + private final long mNativePicture; /** * @hide @@ -63,7 +63,7 @@ public class Picture { * into it. */ public Canvas beginRecording(int width, int height) { - int ni = nativeBeginRecording(mNativePicture, width, height); + long ni = nativeBeginRecording(mNativePicture, width, height); mRecordingCanvas = new RecordingCanvas(this, ni); return mRecordingCanvas; } @@ -164,11 +164,11 @@ public class Picture { } } - final int ni() { + final long ni() { return mNativePicture; } - private Picture(int nativePicture, boolean fromStream) { + private Picture(long nativePicture, boolean fromStream) { if (nativePicture == 0) { throw new RuntimeException(); } @@ -177,21 +177,21 @@ public class Picture { } // return empty picture if src is 0, or a copy of the native src - private static native int nativeConstructor(int nativeSrcOr0); - private static native int nativeCreateFromStream(InputStream stream, + private static native long nativeConstructor(long nativeSrcOr0); + private static native long nativeCreateFromStream(InputStream stream, byte[] storage); - private static native int nativeBeginRecording(int nativeCanvas, + private static native long nativeBeginRecording(long nativeCanvas, int w, int h); - private static native void nativeEndRecording(int nativeCanvas); - private static native void nativeDraw(int nativeCanvas, int nativePicture); - private static native boolean nativeWriteToStream(int nativePicture, + private static native void nativeEndRecording(long nativeCanvas); + private static native void nativeDraw(long nativeCanvas, long nativePicture); + private static native boolean nativeWriteToStream(long nativePicture, OutputStream stream, byte[] storage); - private static native void nativeDestructor(int nativePicture); + private static native void nativeDestructor(long nativePicture); private static class RecordingCanvas extends Canvas { private final Picture mPicture; - public RecordingCanvas(Picture pict, int nativeCanvas) { + public RecordingCanvas(Picture pict, long nativeCanvas) { super(nativeCanvas); mPicture = pict; } diff --git a/graphics/java/android/graphics/PixelXorXfermode.java b/graphics/java/android/graphics/PixelXorXfermode.java index 6075ec3..0080e65 100644 --- a/graphics/java/android/graphics/PixelXorXfermode.java +++ b/graphics/java/android/graphics/PixelXorXfermode.java @@ -29,5 +29,5 @@ public class PixelXorXfermode extends Xfermode { native_instance = nativeCreate(opColor); } - private static native int nativeCreate(int opColor); + private static native long nativeCreate(int opColor); } diff --git a/graphics/java/android/graphics/PorterDuffColorFilter.java b/graphics/java/android/graphics/PorterDuffColorFilter.java index 9870ad2..93fc1c7 100644 --- a/graphics/java/android/graphics/PorterDuffColorFilter.java +++ b/graphics/java/android/graphics/PorterDuffColorFilter.java @@ -96,7 +96,7 @@ public class PorterDuffColorFilter extends ColorFilter { nativeColorFilter = nCreatePorterDuffFilter(native_instance, mColor, mMode.nativeInt); } - private static native int native_CreatePorterDuffFilter(int srcColor, int porterDuffMode); - private static native int nCreatePorterDuffFilter(int nativeFilter, int srcColor, + private static native long native_CreatePorterDuffFilter(int srcColor, int porterDuffMode); + private static native long nCreatePorterDuffFilter(long nativeFilter, int srcColor, int porterDuffMode); } diff --git a/graphics/java/android/graphics/PorterDuffXfermode.java b/graphics/java/android/graphics/PorterDuffXfermode.java index 6ba064c..d9d7689 100644 --- a/graphics/java/android/graphics/PorterDuffXfermode.java +++ b/graphics/java/android/graphics/PorterDuffXfermode.java @@ -32,5 +32,5 @@ public class PorterDuffXfermode extends Xfermode { native_instance = nativeCreateXfermode(mode.nativeInt); } - private static native int nativeCreateXfermode(int mode); + private static native long nativeCreateXfermode(int mode); } diff --git a/graphics/java/android/graphics/RadialGradient.java b/graphics/java/android/graphics/RadialGradient.java index f011e5c..f10e5d6 100644 --- a/graphics/java/android/graphics/RadialGradient.java +++ b/graphics/java/android/graphics/RadialGradient.java @@ -117,14 +117,14 @@ public class RadialGradient extends Shader { return copy; } - private static native int nativeCreate1(float x, float y, float radius, + private static native long nativeCreate1(float x, float y, float radius, int colors[], float positions[], int tileMode); - private static native int nativeCreate2(float x, float y, float radius, + private static native long nativeCreate2(float x, float y, float radius, int color0, int color1, int tileMode); - private static native int nativePostCreate1(int native_shader, float x, float y, float radius, + private static native long nativePostCreate1(long native_shader, float x, float y, float radius, int colors[], float positions[], int tileMode); - private static native int nativePostCreate2(int native_shader, float x, float y, float radius, + private static native long nativePostCreate2(long native_shader, float x, float y, float radius, int color0, int color1, int tileMode); } diff --git a/graphics/java/android/graphics/Rasterizer.java b/graphics/java/android/graphics/Rasterizer.java index feb5f0c..817814c 100644 --- a/graphics/java/android/graphics/Rasterizer.java +++ b/graphics/java/android/graphics/Rasterizer.java @@ -27,7 +27,7 @@ public class Rasterizer { finalizer(native_instance); } - private static native void finalizer(int native_instance); + private static native void finalizer(long native_instance); - int native_instance; + long native_instance; } diff --git a/graphics/java/android/graphics/Region.java b/graphics/java/android/graphics/Region.java index 72d0c43..727723d 100644 --- a/graphics/java/android/graphics/Region.java +++ b/graphics/java/android/graphics/Region.java @@ -30,7 +30,7 @@ public class Region implements Parcelable { /** * @hide */ - public final int mNativeRegion; + public final long mNativeRegion; // the native values for these must match up with the enum in SkRegion.h public enum Op { @@ -342,7 +342,7 @@ public class Region implements Parcelable { * @return a new region created from the data in the parcel */ public Region createFromParcel(Parcel p) { - int ni = nativeCreateFromParcel(p); + long ni = nativeCreateFromParcel(p); if (ni == 0) { throw new RuntimeException(); } @@ -385,7 +385,7 @@ public class Region implements Parcelable { } } - Region(int ni) { + Region(long ni) { if (ni == 0) { throw new RuntimeException(); } @@ -394,38 +394,38 @@ public class Region implements Parcelable { /* add dummy parameter so constructor can be called from jni without triggering 'not cloneable' exception */ - private Region(int ni, int dummy) { + private Region(long ni, int dummy) { this(ni); } - final int ni() { + final long ni() { return mNativeRegion; } - private static native boolean nativeEquals(int native_r1, int native_r2); + private static native boolean nativeEquals(long native_r1, long native_r2); - private static native int nativeConstructor(); - private static native void nativeDestructor(int native_region); + private static native long nativeConstructor(); + private static native void nativeDestructor(long native_region); - private static native void nativeSetRegion(int native_dst, int native_src); - private static native boolean nativeSetRect(int native_dst, int left, + private static native void nativeSetRegion(long native_dst, long native_src); + private static native boolean nativeSetRect(long native_dst, int left, int top, int right, int bottom); - private static native boolean nativeSetPath(int native_dst, int native_path, - int native_clip); - private static native boolean nativeGetBounds(int native_region, Rect rect); - private static native boolean nativeGetBoundaryPath(int native_region, - int native_path); + private static native boolean nativeSetPath(long native_dst, long native_path, + long native_clip); + private static native boolean nativeGetBounds(long native_region, Rect rect); + private static native boolean nativeGetBoundaryPath(long native_region, + long native_path); - private static native boolean nativeOp(int native_dst, int left, int top, + private static native boolean nativeOp(long native_dst, int left, int top, int right, int bottom, int op); - private static native boolean nativeOp(int native_dst, Rect rect, - int native_region, int op); - private static native boolean nativeOp(int native_dst, int native_region1, - int native_region2, int op); + private static native boolean nativeOp(long native_dst, Rect rect, + long native_region, int op); + private static native boolean nativeOp(long native_dst, long native_region1, + long native_region2, int op); - private static native int nativeCreateFromParcel(Parcel p); - private static native boolean nativeWriteToParcel(int native_region, + private static native long nativeCreateFromParcel(Parcel p); + private static native boolean nativeWriteToParcel(long native_region, Parcel p); - private static native String nativeToString(int native_region); + private static native String nativeToString(long native_region); } diff --git a/graphics/java/android/graphics/RegionIterator.java b/graphics/java/android/graphics/RegionIterator.java index 817f853..8401adb 100644 --- a/graphics/java/android/graphics/RegionIterator.java +++ b/graphics/java/android/graphics/RegionIterator.java @@ -45,10 +45,10 @@ public class RegionIterator { nativeDestructor(mNativeIter); } - private static native int nativeConstructor(int native_region); - private static native void nativeDestructor(int native_iter); - private static native boolean nativeNext(int native_iter, Rect r); - - private final int mNativeIter; + private static native long nativeConstructor(long native_region); + private static native void nativeDestructor(long native_iter); + private static native boolean nativeNext(long native_iter, Rect r); + + private final long mNativeIter; } diff --git a/graphics/java/android/graphics/Shader.java b/graphics/java/android/graphics/Shader.java index afc68d8..94b4c4a 100644 --- a/graphics/java/android/graphics/Shader.java +++ b/graphics/java/android/graphics/Shader.java @@ -28,11 +28,11 @@ public class Shader { * * @hide */ - public int native_instance; + public long native_instance; /** * @hide */ - public int native_shader; + public long native_shader; private Matrix mLocalMatrix; @@ -112,7 +112,7 @@ public class Shader { } } - private static native void nativeDestructor(int native_shader, int native_skiaShader); - private static native void nativeSetLocalMatrix(int native_shader, - int native_skiaShader, int matrix_instance); + private static native void nativeDestructor(long native_shader, long native_skiaShader); + private static native void nativeSetLocalMatrix(long native_shader, + long native_skiaShader, long matrix_instance); } diff --git a/graphics/java/android/graphics/SumPathEffect.java b/graphics/java/android/graphics/SumPathEffect.java index cc7c778..8fedc31 100644 --- a/graphics/java/android/graphics/SumPathEffect.java +++ b/graphics/java/android/graphics/SumPathEffect.java @@ -27,6 +27,6 @@ public class SumPathEffect extends PathEffect { second.native_instance); } - private static native int nativeCreate(int first, int second); + private static native long nativeCreate(long first, long second); } diff --git a/graphics/java/android/graphics/SweepGradient.java b/graphics/java/android/graphics/SweepGradient.java index e9cda39..21239f7 100644 --- a/graphics/java/android/graphics/SweepGradient.java +++ b/graphics/java/android/graphics/SweepGradient.java @@ -106,12 +106,12 @@ public class SweepGradient extends Shader { return copy; } - private static native int nativeCreate1(float x, float y, int colors[], float positions[]); - private static native int nativeCreate2(float x, float y, int color0, int color1); + private static native long nativeCreate1(float x, float y, int colors[], float positions[]); + private static native long nativeCreate2(float x, float y, int color0, int color1); - private static native int nativePostCreate1(int native_shader, float cx, float cy, + private static native long nativePostCreate1(long native_shader, float cx, float cy, int[] colors, float[] positions); - private static native int nativePostCreate2(int native_shader, float cx, float cy, + private static native long nativePostCreate2(long native_shader, float cx, float cy, int color0, int color1); } diff --git a/graphics/java/android/graphics/TableMaskFilter.java b/graphics/java/android/graphics/TableMaskFilter.java index a8a7ff0..d0c1438 100644 --- a/graphics/java/android/graphics/TableMaskFilter.java +++ b/graphics/java/android/graphics/TableMaskFilter.java @@ -28,7 +28,7 @@ public class TableMaskFilter extends MaskFilter { native_instance = nativeNewTable(table); } - private TableMaskFilter(int ni) { + private TableMaskFilter(long ni) { native_instance = ni; } @@ -40,7 +40,7 @@ public class TableMaskFilter extends MaskFilter { return new TableMaskFilter(nativeNewGamma(gamma)); } - private static native int nativeNewTable(byte[] table); - private static native int nativeNewClip(int min, int max); - private static native int nativeNewGamma(float gamma); + private static native long nativeNewTable(byte[] table); + private static native long nativeNewClip(int min, int max); + private static native long nativeNewGamma(float gamma); } diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java index aea3ee5..73e0e8d 100644 --- a/graphics/java/android/graphics/Typeface.java +++ b/graphics/java/android/graphics/Typeface.java @@ -18,6 +18,7 @@ package android.graphics; import android.content.res.AssetManager; import android.util.SparseArray; +import android.util.LongSparseArray; import java.io.File; @@ -45,13 +46,13 @@ public class Typeface { public static final Typeface MONOSPACE; static Typeface[] sDefaults; - private static final SparseArray<SparseArray<Typeface>> sTypefaceCache = - new SparseArray<SparseArray<Typeface>>(3); + private static final LongSparseArray<SparseArray<Typeface>> sTypefaceCache = + new LongSparseArray<SparseArray<Typeface>>(3); /** * @hide */ - public int native_instance; + public long native_instance; // Style public static final int NORMAL = 0; @@ -103,7 +104,7 @@ public class Typeface { * @return The best matching typeface. */ public static Typeface create(Typeface family, int style) { - int ni = 0; + long ni = 0; if (family != null) { // Return early if we're asked for the same face/style if (family.mStyle == style) { @@ -173,7 +174,7 @@ public class Typeface { } // don't allow clients to call this directly - private Typeface(int ni) { + private Typeface(long ni) { if (ni == 0) { throw new RuntimeException("native typeface cannot be made"); } @@ -217,15 +218,20 @@ public class Typeface { @Override public int hashCode() { - int result = native_instance; + /* + * Modified method for hashCode with long native_instance derived from + * http://developer.android.com/reference/java/lang/Object.html + */ + int result = 17; + result = 31 * result + (int) (native_instance ^ (native_instance >>> 32)); result = 31 * result + mStyle; return result; } - private static native int nativeCreate(String familyName, int style); - private static native int nativeCreateFromTypeface(int native_instance, int style); - private static native void nativeUnref(int native_instance); - private static native int nativeGetStyle(int native_instance); - private static native int nativeCreateFromAsset(AssetManager mgr, String path); - private static native int nativeCreateFromFile(String path); + private static native long nativeCreate(String familyName, int style); + private static native long nativeCreateFromTypeface(long native_instance, int style); + private static native void nativeUnref(long native_instance); + private static native int nativeGetStyle(long native_instance); + private static native long nativeCreateFromAsset(AssetManager mgr, String path); + private static native long nativeCreateFromFile(String path); } diff --git a/graphics/java/android/graphics/Xfermode.java b/graphics/java/android/graphics/Xfermode.java index 2467bdc..883350d 100644 --- a/graphics/java/android/graphics/Xfermode.java +++ b/graphics/java/android/graphics/Xfermode.java @@ -38,7 +38,7 @@ public class Xfermode { } } - private static native void finalizer(int native_instance); + private static native void finalizer(long native_instance); - int native_instance; + long native_instance; } |