summaryrefslogtreecommitdiffstats
path: root/graphics/java/android/graphics/Paint.java
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2014-03-31 13:52:39 -0400
committerDerek Sollenberger <djsollen@google.com>2014-05-07 09:36:04 -0400
commitc29a0a4664a4b9871fadd668b632469a0db240b9 (patch)
tree33e324bd3698bf9c100f998389694e4baeefaa57 /graphics/java/android/graphics/Paint.java
parentae84e20b2a0cb77223d40f55c71011d3ae8c71c7 (diff)
downloadframeworks_base-c29a0a4664a4b9871fadd668b632469a0db240b9.zip
frameworks_base-c29a0a4664a4b9871fadd668b632469a0db240b9.tar.gz
frameworks_base-c29a0a4664a4b9871fadd668b632469a0db240b9.tar.bz2
Avoid caching shadow properties in Java & HWUI.
bug: 10650594 Change-Id: I6f57df002710bb0567ed7e53fc0bfe96cfd504b8
Diffstat (limited to 'graphics/java/android/graphics/Paint.java')
-rw-r--r--graphics/java/android/graphics/Paint.java59
1 files changed, 16 insertions, 43 deletions
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index 1e1128e..457b3ea 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -55,27 +55,6 @@ public class Paint {
/**
* @hide
*/
- public boolean hasShadow;
- /**
- * @hide
- */
- public float shadowDx;
- /**
- * @hide
- */
- public float shadowDy;
- /**
- * @hide
- */
- public float shadowRadius;
- /**
- * @hide
- */
- public int shadowColor;
-
- /**
- * @hide
- */
public int mBidiFlags = BIDI_DEFAULT_LTR;
static final Style[] sStyleArray = {
@@ -492,12 +471,6 @@ public class Paint {
mCompatScaling = 1;
mInvCompatScaling = 1;
- hasShadow = false;
- shadowDx = 0;
- shadowDy = 0;
- shadowRadius = 0;
- shadowColor = 0;
-
mBidiFlags = BIDI_DEFAULT_LTR;
setTextLocale(Locale.getDefault());
setElegantTextHeight(false);
@@ -538,12 +511,6 @@ public class Paint {
mCompatScaling = paint.mCompatScaling;
mInvCompatScaling = paint.mInvCompatScaling;
- hasShadow = paint.hasShadow;
- shadowDx = paint.shadowDx;
- shadowDy = paint.shadowDy;
- shadowRadius = paint.shadowRadius;
- shadowColor = paint.shadowColor;
-
mBidiFlags = paint.mBidiFlags;
mLocale = paint.mLocale;
}
@@ -1135,22 +1102,24 @@ public class Paint {
* layer is removed.
*/
public void setShadowLayer(float radius, float dx, float dy, int color) {
- hasShadow = radius > 0.0f;
- shadowRadius = radius;
- shadowDx = dx;
- shadowDy = dy;
- shadowColor = color;
- nSetShadowLayer(radius, dx, dy, color);
+ native_setShadowLayer(mNativePaint, radius, dx, dy, color);
}
-
- private native void nSetShadowLayer(float radius, float dx, float dy, int color);
/**
* Clear the shadow layer.
*/
public void clearShadowLayer() {
- hasShadow = false;
- nSetShadowLayer(0, 0, 0, 0);
+ setShadowLayer(0, 0, 0, 0);
+ }
+
+ /**
+ * Checks if the paint has a shadow layer attached
+ *
+ * @return true if the paint has a shadow layer attached and false otherwise
+ * @hide
+ */
+ public boolean hasShadowLayer() {
+ return native_hasShadowLayer(mNativePaint);
}
/**
@@ -2295,4 +2264,8 @@ public class Paint {
private static native void nativeGetCharArrayBounds(long nativePaint,
char[] text, int index, int count, int bidiFlags, Rect bounds);
private static native void finalizer(long nativePaint);
+
+ private static native void native_setShadowLayer(long native_object,
+ float radius, float dx, float dy, int color);
+ private static native boolean native_hasShadowLayer(long native_object);
}