summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Diego Perez <diegoperez@google.com> 2015-02-17 22:24:14 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2015-02-17 22:24:14 +0000
commitd66f2eb241ba8676ef01f4efd23be5ae62d3a7aa (patch)
tree8ee60e2fff634b4186abb2656108c31dbd20a589
parentf12d02339fefc4111b62715d5c0fb2e58570c34b (diff)
parenta0fb87a3b831e8eb4e4f7e03fc170cf8f93a2161 (diff)
am a0fb87a3: am 98c3461a: Merge "Do not paint shadow if outside of the clip area" into lmp-dev automerge: a912fed
* commit 'a0fb87a3b831e8eb4e4f7e03fc170cf8f93a2161': Do not paint shadow if outside of the clip area
-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 a6c00f77a50a..391504682c72 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();