am d4ccffd3: Merge "AArch64: Use long for pointers in graphics/Interpolator"

* commit 'd4ccffd3ba7f7c27ddfc56231cf7f2424842b1e3':
  AArch64: Use long for pointers in graphics/Interpolator
This commit is contained in:
Narayan Kamath
2014-01-29 04:14:48 -08:00
committed by Android Git Automerger
2 changed files with 26 additions and 21 deletions

View File

@ -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 @@ static void Interpolator_setKeyFrame(JNIEnv* env, jobject clazz, SkInterpolator*
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 @@ static void Interpolator_setRepeatMirror(JNIEnv* env, jobject clazz, SkInterpola
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 @@ static int Interpolator_timeToValues(JNIEnv* env, jobject clazz, SkInterpolator*
env->ReleaseFloatArrayElements(valueArray, values, 0);
}
return result;
return static_cast<jint>(result);
}
// ----------------------------------------------------------------------------
@ -79,12 +84,12 @@ static int Interpolator_timeToValues(JNIEnv* env, jobject clazz, SkInterpolator*
* 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)

View File

@ -151,13 +151,13 @@ public class Interpolator {
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);
}