summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-10-04 13:46:02 -0700
committerRomain Guy <romainguy@google.com>2010-10-04 13:46:02 -0700
commit95930e13faac8c17dabfaa1478089baa772f091b (patch)
tree44bc4a7e95b4a562497b2d5da3f43d3675fc8989 /graphics
parent94e461309b5f6ad0a66508aa1c33330ec9ae13db (diff)
downloadframeworks_base-95930e13faac8c17dabfaa1478089baa772f091b.zip
frameworks_base-95930e13faac8c17dabfaa1478089baa772f091b.tar.gz
frameworks_base-95930e13faac8c17dabfaa1478089baa772f091b.tar.bz2
Apply all Canvas transformations to ColorDrawable.
Change-Id: I29252c58224b236d0770ec005da9842990ef2c06
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/drawable/ColorDrawable.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/graphics/java/android/graphics/drawable/ColorDrawable.java b/graphics/java/android/graphics/drawable/ColorDrawable.java
index 604c602..a25fad4 100644
--- a/graphics/java/android/graphics/drawable/ColorDrawable.java
+++ b/graphics/java/android/graphics/drawable/ColorDrawable.java
@@ -26,10 +26,8 @@ import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
/**
- * A specialized Drawable that fills the Canvas with a specified color,
- * with respect to the clip region. Note that a ColorDrawable ignores the ColorFilter.
- * It also ignores the Bounds, meaning it will draw everywhere in the current clip,
- * even if setBounds(...) was called with a smaller area.
+ * A specialized Drawable that fills the Canvas with a specified color.
+ * Note that a ColorDrawable ignores the ColorFilter.
*
* <p>It can be defined in an XML file with the <code>&lt;color></code> element.</p>
*
@@ -37,6 +35,7 @@ import java.io.IOException;
*/
public class ColorDrawable extends Drawable {
private ColorState mState;
+ private final Paint mPaint = new Paint();
/**
* Creates a new black ColorDrawable.
@@ -66,7 +65,10 @@ public class ColorDrawable extends Drawable {
@Override
public void draw(Canvas canvas) {
- canvas.drawColor(mState.mUseColor);
+ if ((mState.mUseColor >>> 24) != 0) {
+ mPaint.setColor(mState.mUseColor);
+ canvas.drawRect(getBounds(), mPaint);
+ }
}
/**