am cdc095ae
: am 7be33110
: am d4ccffd3
: Merge "AArch64: Use long for pointers in graphics/Interpolator"
* commit 'cdc095ae4850d9ffd08de0d6e8828949603fcdd1': AArch64: Use long for pointers in graphics/Interpolator
This commit is contained in:
@ -5,23 +5,26 @@
|
|||||||
#include "SkInterpolator.h"
|
#include "SkInterpolator.h"
|
||||||
#include "SkTemplates.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;
|
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);
|
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 blendStorage[4];
|
||||||
SkScalar* blend = NULL;
|
SkScalar* blend = NULL;
|
||||||
|
|
||||||
@ -46,8 +49,9 @@ static void Interpolator_setKeyFrame(JNIEnv* env, jobject clazz, SkInterpolator*
|
|||||||
interp->setKeyFrame(index, msec, scalars, blend);
|
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)
|
if (repeatCount > 32000)
|
||||||
repeatCount = 32000;
|
repeatCount = 32000;
|
||||||
|
|
||||||
@ -55,8 +59,9 @@ static void Interpolator_setRepeatMirror(JNIEnv* env, jobject clazz, SkInterpola
|
|||||||
interp->setMirror(mirror != 0);
|
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;
|
SkInterpolatorBase::Result result;
|
||||||
|
|
||||||
float* values = valueArray ? env->GetFloatArrayElements(valueArray, NULL) : NULL;
|
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);
|
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.
|
* JNI registration.
|
||||||
*/
|
*/
|
||||||
static JNINativeMethod gInterpolatorMethods[] = {
|
static JNINativeMethod gInterpolatorMethods[] = {
|
||||||
{ "nativeConstructor", "(II)I", (void*)Interpolator_constructor },
|
{ "nativeConstructor", "(II)J", (void*)Interpolator_constructor },
|
||||||
{ "nativeDestructor", "(I)V", (void*)Interpolator_destructor },
|
{ "nativeDestructor", "(J)V", (void*)Interpolator_destructor },
|
||||||
{ "nativeReset", "(III)V", (void*)Interpolator_reset },
|
{ "nativeReset", "(JII)V", (void*)Interpolator_reset },
|
||||||
{ "nativeSetKeyFrame", "(III[F[F)V", (void*)Interpolator_setKeyFrame },
|
{ "nativeSetKeyFrame", "(JII[F[F)V", (void*)Interpolator_setKeyFrame },
|
||||||
{ "nativeSetRepeatMirror", "(IFZ)V", (void*)Interpolator_setRepeatMirror },
|
{ "nativeSetRepeatMirror", "(JFZ)V", (void*)Interpolator_setRepeatMirror },
|
||||||
{ "nativeTimeToValues", "(II[F)I", (void*)Interpolator_timeToValues }
|
{ "nativeTimeToValues", "(JI[F)I", (void*)Interpolator_timeToValues }
|
||||||
};
|
};
|
||||||
|
|
||||||
int register_android_graphics_Interpolator(JNIEnv* env)
|
int register_android_graphics_Interpolator(JNIEnv* env)
|
||||||
|
@ -151,13 +151,13 @@ public class Interpolator {
|
|||||||
|
|
||||||
private int mValueCount;
|
private int mValueCount;
|
||||||
private int mFrameCount;
|
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 long nativeConstructor(int valueCount, int frameCount);
|
||||||
private static native void nativeDestructor(int native_instance);
|
private static native void nativeDestructor(long native_instance);
|
||||||
private static native void nativeReset(int native_instance, int valueCount, int frameCount);
|
private static native void nativeReset(long 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 nativeSetKeyFrame(long 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 void nativeSetRepeatMirror(long native_instance, float repeatCount, boolean mirror);
|
||||||
private static native int nativeTimeToValues(int native_instance, int msec, float[] values);
|
private static native int nativeTimeToValues(long native_instance, int msec, float[] values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user