diff options
| author | Ashok Bhat <ashok.bhat@arm.com> | 2014-01-20 20:08:01 +0000 |
|---|---|---|
| committer | Narayan Kamath <narayan@google.com> | 2014-01-27 13:28:16 +0000 |
| commit | 18b4cbeedef21c1fa666a110a157bab66edff976 (patch) | |
| tree | 03ee1d020f152fe0206816e272bc11c032508554 /core/jni/android/graphics/PathEffect.cpp | |
| parent | 4507ea9e3cabcf68f250da20c10cf0edcb6eb3f2 (diff) | |
| download | frameworks_base-18b4cbeedef21c1fa666a110a157bab66edff976.zip frameworks_base-18b4cbeedef21c1fa666a110a157bab66edff976.tar.gz frameworks_base-18b4cbeedef21c1fa666a110a157bab66edff976.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: Ib3eab85ed97ea3e3c227617c20f8d213f17d4ba0
Diffstat (limited to 'core/jni/android/graphics/PathEffect.cpp')
| -rw-r--r-- | core/jni/android/graphics/PathEffect.cpp | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/core/jni/android/graphics/PathEffect.cpp b/core/jni/android/graphics/PathEffect.cpp index 0503614..2803758 100644 --- a/core/jni/android/graphics/PathEffect.cpp +++ b/core/jni/android/graphics/PathEffect.cpp @@ -11,22 +11,29 @@ class SkPathEffectGlue { public: - static void destructor(JNIEnv* env, jobject, SkPathEffect* effect) { + static void destructor(JNIEnv* env, jobject, jlong effectHandle) { + SkPathEffect* effect = reinterpret_cast<SkPathEffect*>(effectHandle); SkSafeUnref(effect); } - static SkPathEffect* Compose_constructor(JNIEnv* env, jobject, - SkPathEffect* outer, SkPathEffect* inner) { - return new SkComposePathEffect(outer, inner); + static jlong Compose_constructor(JNIEnv* env, jobject, + jlong outerHandle, jlong innerHandle) { + SkPathEffect* outer = reinterpret_cast<SkPathEffect*>(outerHandle); + SkPathEffect* inner = reinterpret_cast<SkPathEffect*>(innerHandle); + SkPathEffect* effect = new SkComposePathEffect(outer, inner); + return reinterpret_cast<jlong>(effect); } - static SkPathEffect* Sum_constructor(JNIEnv* env, jobject, - SkPathEffect* first, SkPathEffect* second) { - return new SkSumPathEffect(first, second); + static jlong Sum_constructor(JNIEnv* env, jobject, + jlong firstHandle, jlong secondHandle) { + SkPathEffect* first = reinterpret_cast<SkPathEffect*>(firstHandle); + SkPathEffect* second = reinterpret_cast<SkPathEffect*>(secondHandle); + SkPathEffect* effect = new SkSumPathEffect(first, second); + return reinterpret_cast<jlong>(effect); } - static SkPathEffect* Dash_constructor(JNIEnv* env, jobject, - jfloatArray intervalArray, float phase) { + static jlong Dash_constructor(JNIEnv* env, jobject, + jfloatArray intervalArray, jfloat phase) { AutoJavaFloatArray autoInterval(env, intervalArray); int count = autoInterval.length() & ~1; // even number float* values = autoInterval.ptr(); @@ -36,24 +43,29 @@ public: for (int i = 0; i < count; i++) { intervals[i] = SkFloatToScalar(values[i]); } - return new SkDashPathEffect(intervals, count, SkFloatToScalar(phase)); + SkPathEffect* effect = new SkDashPathEffect(intervals, count, SkFloatToScalar(phase)); + return reinterpret_cast<jlong>(effect); } - static SkPathEffect* OneD_constructor(JNIEnv* env, jobject, - const SkPath* shape, float advance, float phase, int style) { + static jlong OneD_constructor(JNIEnv* env, jobject, + jlong shapeHandle, jfloat advance, jfloat phase, jint style) { + const SkPath* shape = reinterpret_cast<SkPath*>(shapeHandle); SkASSERT(shape != NULL); - return new SkPath1DPathEffect(*shape, SkFloatToScalar(advance), + SkPathEffect* effect = new SkPath1DPathEffect(*shape, SkFloatToScalar(advance), SkFloatToScalar(phase), (SkPath1DPathEffect::Style)style); + return reinterpret_cast<jlong>(effect); } - static SkPathEffect* Corner_constructor(JNIEnv* env, jobject, float radius){ - return new SkCornerPathEffect(SkFloatToScalar(radius)); + static jlong Corner_constructor(JNIEnv* env, jobject, jfloat radius){ + SkPathEffect* effect = new SkCornerPathEffect(SkFloatToScalar(radius)); + return reinterpret_cast<jlong>(effect); } - static SkPathEffect* Discrete_constructor(JNIEnv* env, jobject, - float length, float deviation) { - return new SkDiscretePathEffect(SkFloatToScalar(length), + static jlong Discrete_constructor(JNIEnv* env, jobject, + jfloat length, jfloat deviation) { + SkPathEffect* effect = new SkDiscretePathEffect(SkFloatToScalar(length), SkFloatToScalar(deviation)); + return reinterpret_cast<jlong>(effect); } }; @@ -61,31 +73,31 @@ public: //////////////////////////////////////////////////////////////////////////////////////////////////////// static JNINativeMethod gPathEffectMethods[] = { - { "nativeDestructor", "(I)V", (void*)SkPathEffectGlue::destructor } + { "nativeDestructor", "(J)V", (void*)SkPathEffectGlue::destructor } }; static JNINativeMethod gComposePathEffectMethods[] = { - { "nativeCreate", "(II)I", (void*)SkPathEffectGlue::Compose_constructor } + { "nativeCreate", "(JJ)J", (void*)SkPathEffectGlue::Compose_constructor } }; static JNINativeMethod gSumPathEffectMethods[] = { - { "nativeCreate", "(II)I", (void*)SkPathEffectGlue::Sum_constructor } + { "nativeCreate", "(JJ)J", (void*)SkPathEffectGlue::Sum_constructor } }; static JNINativeMethod gDashPathEffectMethods[] = { - { "nativeCreate", "([FF)I", (void*)SkPathEffectGlue::Dash_constructor } + { "nativeCreate", "([FF)J", (void*)SkPathEffectGlue::Dash_constructor } }; static JNINativeMethod gPathDashPathEffectMethods[] = { - { "nativeCreate", "(IFFI)I", (void*)SkPathEffectGlue::OneD_constructor } + { "nativeCreate", "(JFFI)J", (void*)SkPathEffectGlue::OneD_constructor } }; static JNINativeMethod gCornerPathEffectMethods[] = { - { "nativeCreate", "(F)I", (void*)SkPathEffectGlue::Corner_constructor } + { "nativeCreate", "(F)J", (void*)SkPathEffectGlue::Corner_constructor } }; static JNINativeMethod gDiscretePathEffectMethods[] = { - { "nativeCreate", "(FF)I", (void*)SkPathEffectGlue::Discrete_constructor } + { "nativeCreate", "(FF)J", (void*)SkPathEffectGlue::Discrete_constructor } }; #include <android_runtime/AndroidRuntime.h> |
