diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:45 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:45 -0800 |
commit | d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /core/jni/android/graphics/PathEffect.cpp | |
parent | 076357b8567458d4b6dfdcf839ef751634cd2bfb (diff) | |
download | frameworks_base-d83a98f4ce9cfa908f5c54bbd70f03eec07e7553.zip frameworks_base-d83a98f4ce9cfa908f5c54bbd70f03eec07e7553.tar.gz frameworks_base-d83a98f4ce9cfa908f5c54bbd70f03eec07e7553.tar.bz2 |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'core/jni/android/graphics/PathEffect.cpp')
-rw-r--r-- | core/jni/android/graphics/PathEffect.cpp | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/core/jni/android/graphics/PathEffect.cpp b/core/jni/android/graphics/PathEffect.cpp deleted file mode 100644 index 0ecb004..0000000 --- a/core/jni/android/graphics/PathEffect.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include <jni.h> -#include "GraphicsJNI.h" - -#include "SkPathEffect.h" -#include "SkCornerPathEffect.h" -#include "SkDashPathEffect.h" -#include "SkDiscretePathEffect.h" -#include "Sk1DPathEffect.h" -#include "SkTemplates.h" - -class SkPathEffectGlue { -public: - - static void destructor(JNIEnv* env, jobject, SkPathEffect* effect) { - effect->safeUnref(); - } - - static SkPathEffect* Compose_constructor(JNIEnv* env, jobject, - SkPathEffect* outer, SkPathEffect* inner) { - return new SkComposePathEffect(outer, inner); - } - - static SkPathEffect* Sum_constructor(JNIEnv* env, jobject, - SkPathEffect* first, SkPathEffect* second) { - return new SkSumPathEffect(first, second); - } - - static SkPathEffect* Dash_constructor(JNIEnv* env, jobject, - jfloatArray intervalArray, float phase) { - AutoJavaFloatArray autoInterval(env, intervalArray); - int count = autoInterval.length() & ~1; // even number - float* values = autoInterval.ptr(); - - SkAutoSTMalloc<32, SkScalar> storage(count); - SkScalar* intervals = storage.get(); - for (int i = 0; i < count; i++) { - intervals[i] = SkFloatToScalar(values[i]); - } - return new SkDashPathEffect(intervals, count, SkFloatToScalar(phase)); - } - - static SkPathEffect* OneD_constructor(JNIEnv* env, jobject, - const SkPath* shape, float advance, float phase, int style) { - SkASSERT(shape != NULL); - return new SkPath1DPathEffect(*shape, SkFloatToScalar(advance), - SkFloatToScalar(phase), (SkPath1DPathEffect::Style)style); - } - - static SkPathEffect* Corner_constructor(JNIEnv* env, jobject, float radius){ - return new SkCornerPathEffect(SkFloatToScalar(radius)); - } - - static SkPathEffect* Discrete_constructor(JNIEnv* env, jobject, - float length, float deviation) { - return new SkDiscretePathEffect(SkFloatToScalar(length), - SkFloatToScalar(deviation)); - } - -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////////// - -static JNINativeMethod gPathEffectMethods[] = { - { "nativeDestructor", "(I)V", (void*)SkPathEffectGlue::destructor } -}; - -static JNINativeMethod gComposePathEffectMethods[] = { - { "nativeCreate", "(II)I", (void*)SkPathEffectGlue::Compose_constructor } -}; - -static JNINativeMethod gSumPathEffectMethods[] = { - { "nativeCreate", "(II)I", (void*)SkPathEffectGlue::Sum_constructor } -}; - -static JNINativeMethod gDashPathEffectMethods[] = { - { "nativeCreate", "([FF)I", (void*)SkPathEffectGlue::Dash_constructor } -}; - -static JNINativeMethod gPathDashPathEffectMethods[] = { - { "nativeCreate", "(IFFI)I", (void*)SkPathEffectGlue::OneD_constructor } -}; - -static JNINativeMethod gCornerPathEffectMethods[] = { - { "nativeCreate", "(F)I", (void*)SkPathEffectGlue::Corner_constructor } -}; - -static JNINativeMethod gDiscretePathEffectMethods[] = { - { "nativeCreate", "(FF)I", (void*)SkPathEffectGlue::Discrete_constructor } -}; - -#include <android_runtime/AndroidRuntime.h> - -#define REG(env, name, array) \ - result = android::AndroidRuntime::registerNativeMethods(env, name, array, \ - SK_ARRAY_COUNT(array)); \ - if (result < 0) return result - -int register_android_graphics_PathEffect(JNIEnv* env); -int register_android_graphics_PathEffect(JNIEnv* env) -{ - int result; - - REG(env, "android/graphics/PathEffect", gPathEffectMethods); - REG(env, "android/graphics/ComposePathEffect", gComposePathEffectMethods); - REG(env, "android/graphics/SumPathEffect", gSumPathEffectMethods); - REG(env, "android/graphics/DashPathEffect", gDashPathEffectMethods); - REG(env, "android/graphics/PathDashPathEffect", gPathDashPathEffectMethods); - REG(env, "android/graphics/CornerPathEffect", gCornerPathEffectMethods); - REG(env, "android/graphics/DiscretePathEffect", gDiscretePathEffectMethods); - - return 0; -} - |