Merge "AArch64: Use long for pointers in graphics/Interpolator"
diff --git a/core/jni/android/graphics/Interpolator.cpp b/core/jni/android/graphics/Interpolator.cpp
index aa33c3d..ca04dfe 100644
--- a/core/jni/android/graphics/Interpolator.cpp
+++ b/core/jni/android/graphics/Interpolator.cpp
@@ -5,23 +5,26 @@
 #include "SkInterpolator.h"
 #include "SkTemplates.h"
 
-static SkInterpolator* Interpolator_constructor(JNIEnv* env, jobject clazz, int valueCount, int frameCount)
+static jlong Interpolator_constructor(JNIEnv* env, jobject clazz, jint valueCount, jint frameCount)
 {
-    return new SkInterpolator(valueCount, frameCount);
+    return reinterpret_cast<jlong>(new SkInterpolator(valueCount, frameCount));
 }
 
-static void Interpolator_destructor(JNIEnv* env, jobject clazz, SkInterpolator* interp)
+static void Interpolator_destructor(JNIEnv* env, jobject clazz, jlong interpHandle)
 {
+    SkInterpolator* interp = reinterpret_cast<SkInterpolator*>(interpHandle);
     delete interp;
 }
 
-static void Interpolator_reset(JNIEnv* env, jobject clazz, SkInterpolator* interp, int valueCount, int frameCount)
+static void Interpolator_reset(JNIEnv* env, jobject clazz, jlong interpHandle, jint valueCount, jint frameCount)
 {
+    SkInterpolator* interp = reinterpret_cast<SkInterpolator*>(interpHandle);
     interp->reset(valueCount, frameCount);
 }
 
-static void Interpolator_setKeyFrame(JNIEnv* env, jobject clazz, SkInterpolator* interp, int index, int msec, jfloatArray valueArray, jfloatArray blendArray)
+static void Interpolator_setKeyFrame(JNIEnv* env, jobject clazz, jlong interpHandle, jint index, jint msec, jfloatArray valueArray, jfloatArray blendArray)
 {
+    SkInterpolator* interp = reinterpret_cast<SkInterpolator*>(interpHandle);
     SkScalar    blendStorage[4];
     SkScalar*   blend = NULL;
 
@@ -46,8 +49,9 @@
     interp->setKeyFrame(index, msec, scalars, blend);
 }
 
-static void Interpolator_setRepeatMirror(JNIEnv* env, jobject clazz, SkInterpolator* interp, float repeatCount, jboolean mirror)
+static void Interpolator_setRepeatMirror(JNIEnv* env, jobject clazz, jlong interpHandle, jfloat repeatCount, jboolean mirror)
 {
+    SkInterpolator* interp = reinterpret_cast<SkInterpolator*>(interpHandle);
     if (repeatCount > 32000)
         repeatCount = 32000;
 
@@ -55,8 +59,9 @@
     interp->setMirror(mirror != 0);
 }
 
-static int Interpolator_timeToValues(JNIEnv* env, jobject clazz, SkInterpolator* interp, int msec, jfloatArray valueArray)
+static jint Interpolator_timeToValues(JNIEnv* env, jobject clazz, jlong interpHandle, jint msec, jfloatArray valueArray)
 {
+    SkInterpolator* interp = reinterpret_cast<SkInterpolator*>(interpHandle);
     SkInterpolatorBase::Result result;
 
     float* values = valueArray ? env->GetFloatArrayElements(valueArray, NULL) : NULL;
@@ -70,7 +75,7 @@
         env->ReleaseFloatArrayElements(valueArray, values, 0);
     }
 
-    return result;
+    return static_cast<jint>(result);
 }
 
 // ----------------------------------------------------------------------------
@@ -79,12 +84,12 @@
  * JNI registration.
  */
 static JNINativeMethod gInterpolatorMethods[] = {
-    { "nativeConstructor",      "(II)I",        (void*)Interpolator_constructor     },
-    { "nativeDestructor",       "(I)V",         (void*)Interpolator_destructor      },
-    { "nativeReset",            "(III)V",       (void*)Interpolator_reset           },
-    { "nativeSetKeyFrame",      "(III[F[F)V",   (void*)Interpolator_setKeyFrame     },
-    { "nativeSetRepeatMirror",  "(IFZ)V",       (void*)Interpolator_setRepeatMirror },
-    { "nativeTimeToValues",     "(II[F)I",      (void*)Interpolator_timeToValues    }
+    { "nativeConstructor",      "(II)J",        (void*)Interpolator_constructor     },
+    { "nativeDestructor",       "(J)V",         (void*)Interpolator_destructor      },
+    { "nativeReset",            "(JII)V",       (void*)Interpolator_reset           },
+    { "nativeSetKeyFrame",      "(JII[F[F)V",   (void*)Interpolator_setKeyFrame     },
+    { "nativeSetRepeatMirror",  "(JFZ)V",       (void*)Interpolator_setRepeatMirror },
+    { "nativeTimeToValues",     "(JI[F)I",      (void*)Interpolator_timeToValues    }
 };
 
 int register_android_graphics_Interpolator(JNIEnv* env)
diff --git a/graphics/java/android/graphics/Interpolator.java b/graphics/java/android/graphics/Interpolator.java
index 75851a6..f695a9e 100644
--- a/graphics/java/android/graphics/Interpolator.java
+++ b/graphics/java/android/graphics/Interpolator.java
@@ -151,13 +151,13 @@
     
     private int mValueCount;
     private int mFrameCount;
-    private final int native_instance;
+    private final long native_instance;
 
-    private static native int  nativeConstructor(int valueCount, int frameCount);
-    private static native void nativeDestructor(int native_instance);
-    private static native void nativeReset(int native_instance, int valueCount, int frameCount);
-    private static native void nativeSetKeyFrame(int native_instance, int index, int msec, float[] values, float[] blend);
-    private static native void nativeSetRepeatMirror(int native_instance, float repeatCount, boolean mirror);
-    private static native int  nativeTimeToValues(int native_instance, int msec, float[] values);
+    private static native long nativeConstructor(int valueCount, int frameCount);
+    private static native void nativeDestructor(long native_instance);
+    private static native void nativeReset(long native_instance, int valueCount, int frameCount);
+    private static native void nativeSetKeyFrame(long native_instance, int index, int msec, float[] values, float[] blend);
+    private static native void nativeSetRepeatMirror(long native_instance, float repeatCount, boolean mirror);
+    private static native int  nativeTimeToValues(long native_instance, int msec, float[] values);
 }