diff options
author | Diego Perez <diegoperez@google.com> | 2015-06-15 15:48:24 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-06-15 15:48:24 +0000 |
commit | dc929e28acd32f7adebdc0d5afd3dc7eaa1a09fe (patch) | |
tree | d4be8a99e16f830881cf17d87869e97a025002a6 /tools | |
parent | d2161615988725fd49791d67a534bccdee3957cd (diff) | |
parent | 40a216d95973bb897ee0d755ef260a616f176798 (diff) | |
download | frameworks_base-dc929e28acd32f7adebdc0d5afd3dc7eaa1a09fe.zip frameworks_base-dc929e28acd32f7adebdc0d5afd3dc7eaa1a09fe.tar.gz frameworks_base-dc929e28acd32f7adebdc0d5afd3dc7eaa1a09fe.tar.bz2 |
am 40a216d9: am df6f63ba: am 2422011d: am b2411c62: am ead59b0d: Merge "Fix GcSnapshot drawInLayer when clipping is used." into lmp-mr1-dev
* commit '40a216d95973bb897ee0d755ef260a616f176798':
Fix GcSnapshot drawInLayer when clipping is used.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java index c34f9b5..a39eb4d 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java @@ -616,6 +616,8 @@ public class GcSnapshot { return; } + int x = 0; + int y = 0; int width; int height; Rectangle clipBounds = originalGraphics.getClipBounds(); @@ -626,6 +628,8 @@ public class GcSnapshot { } // If we have clipBounds available, use them as they will always be // smaller than the full layer size. + x = clipBounds.x; + y = clipBounds.y; width = clipBounds.width; height = clipBounds.height; } else { @@ -646,13 +650,20 @@ public class GcSnapshot { true /*compositeOnly*/, forceMode); try { // The main draw operation. + // We translate the operation to take into account that the rendering does not + // know about the clipping area. + imageGraphics.translate(-x, -y); drawable.draw(imageGraphics, paint); // Apply the color filter. + // Restore the original coordinates system and apply the filter only to the + // clipped area. + imageGraphics.translate(x, y); filter.applyFilter(imageGraphics, width, height); - // Draw the tinted image on the main layer. - configuredGraphics.drawImage(image, 0, 0, null); + // Draw the tinted image on the main layer using as start point the clipping + // upper left coordinates. + configuredGraphics.drawImage(image, x, y, null); layer.change(); } finally { // dispose Graphics2D objects |