summaryrefslogtreecommitdiffstats
path: root/core/jni/android/graphics/PathEffect.cpp
diff options
context:
space:
mode:
authorLeon Scroggins III <scroggo@google.com>2014-04-04 17:05:24 -0400
committerLeon Scroggins III <scroggo@google.com>2014-04-07 18:41:17 -0400
commit2e0103eb340822f9d580c1aa8492bae8394b8243 (patch)
tree478b090d3c66d50c26f4d57ad16ba5233a62a80b /core/jni/android/graphics/PathEffect.cpp
parent7716b7d8ef9addb913bbc4bdd3153fa36bd1aa87 (diff)
downloadframeworks_base-2e0103eb340822f9d580c1aa8492bae8394b8243.zip
frameworks_base-2e0103eb340822f9d580c1aa8492bae8394b8243.tar.gz
frameworks_base-2e0103eb340822f9d580c1aa8492bae8394b8243.tar.bz2
Remove SkFloatToScalar.
Now that SkScalar is always float (it may someday be double, but float to double is trivial), remove callers of SkFloatToScalar, which is deprecated in Skia. BUG:13694396 Change-Id: I524a9bb6f7702bc810bac55fb9d2cd5361a01cf7
Diffstat (limited to 'core/jni/android/graphics/PathEffect.cpp')
-rw-r--r--core/jni/android/graphics/PathEffect.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/core/jni/android/graphics/PathEffect.cpp b/core/jni/android/graphics/PathEffect.cpp
index 81b46ce..28d881d 100644
--- a/core/jni/android/graphics/PathEffect.cpp
+++ b/core/jni/android/graphics/PathEffect.cpp
@@ -35,15 +35,13 @@ public:
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();
-
- SkAutoSTMalloc<32, SkScalar> storage(count);
- SkScalar* intervals = storage.get();
- for (int i = 0; i < count; i++) {
- intervals[i] = SkFloatToScalar(values[i]);
- }
- SkPathEffect* effect = SkDashPathEffect::Create(intervals, count, SkFloatToScalar(phase));
+ int count = autoInterval.length() & ~1; // even number
+#ifdef SK_SCALAR_IS_FLOAT
+ SkScalar* intervals = autoInterval.ptr();
+#else
+ #error Need to convert float array to SkScalar array before calling the following function.
+#endif
+ SkPathEffect* effect = SkDashPathEffect::Create(intervals, count, phase);
return reinterpret_cast<jlong>(effect);
}
@@ -51,20 +49,19 @@ public:
jlong shapeHandle, jfloat advance, jfloat phase, jint style) {
const SkPath* shape = reinterpret_cast<SkPath*>(shapeHandle);
SkASSERT(shape != NULL);
- SkPathEffect* effect = SkPath1DPathEffect::Create(*shape, SkFloatToScalar(advance),
- SkFloatToScalar(phase), (SkPath1DPathEffect::Style)style);
+ SkPathEffect* effect = SkPath1DPathEffect::Create(*shape, advance, phase,
+ (SkPath1DPathEffect::Style)style);
return reinterpret_cast<jlong>(effect);
}
static jlong Corner_constructor(JNIEnv* env, jobject, jfloat radius){
- SkPathEffect* effect = SkCornerPathEffect::Create(SkFloatToScalar(radius));
+ SkPathEffect* effect = SkCornerPathEffect::Create(radius);
return reinterpret_cast<jlong>(effect);
}
static jlong Discrete_constructor(JNIEnv* env, jobject,
jfloat length, jfloat deviation) {
- SkPathEffect* effect = SkDiscretePathEffect::Create(SkFloatToScalar(length),
- SkFloatToScalar(deviation));
+ SkPathEffect* effect = SkDiscretePathEffect::Create(length, deviation);
return reinterpret_cast<jlong>(effect);
}