summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDiego Perez <diegoperez@google.com>2015-02-04 11:53:15 +0000
committerDiego Perez <diegoperez@google.com>2015-02-04 11:57:20 +0000
commit0dfba38010dc3d3dbab5801427726f252113ac6c (patch)
tree2cebf48aa24ed4517ddc7dee9b08ab3be149ff2e /tools
parentd14b64323ff92be9db804d66a1146693c27150a6 (diff)
downloadframeworks_base-0dfba38010dc3d3dbab5801427726f252113ac6c.zip
frameworks_base-0dfba38010dc3d3dbab5801427726f252113ac6c.tar.gz
frameworks_base-0dfba38010dc3d3dbab5801427726f252113ac6c.tar.bz2
Do not paint shadow if outside of the clip area
Change-Id: I064ccc1d1b206a29d9d0db1384782cb5dd5c65ca
Diffstat (limited to 'tools')
-rw-r--r--tools/layoutlib/bridge/src/android/view/ViewGroup_Delegate.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/layoutlib/bridge/src/android/view/ViewGroup_Delegate.java b/tools/layoutlib/bridge/src/android/view/ViewGroup_Delegate.java
index a6c00f7..3915046 100644
--- a/tools/layoutlib/bridge/src/android/view/ViewGroup_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/view/ViewGroup_Delegate.java
@@ -71,8 +71,10 @@ public class ViewGroup_Delegate {
int x = 0;
if (outline.mRect != null) {
Shadow s = getRectShadow(parent, canvas, child, outline);
- shadow = s.mShadow;
- x = -s.mShadowWidth;
+ if (s != null) {
+ shadow = s.mShadow;
+ x = -s.mShadowWidth;
+ }
} else if (outline.mPath != null) {
shadow = getPathShadow(child, outline, canvas);
}
@@ -132,6 +134,9 @@ public class ViewGroup_Delegate {
private static BufferedImage getPathShadow(View child, Outline outline, Canvas canvas) {
Rect clipBounds = canvas.getClipBounds();
+ if (clipBounds.isEmpty()) {
+ return null;
+ }
BufferedImage image = new BufferedImage(clipBounds.width(), clipBounds.height(),
BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = image.createGraphics();