Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java +13 −2 Original line number Original line Diff line number Diff line Loading @@ -616,6 +616,8 @@ public class GcSnapshot { return; return; } } int x = 0; int y = 0; int width; int width; int height; int height; Rectangle clipBounds = originalGraphics.getClipBounds(); Rectangle clipBounds = originalGraphics.getClipBounds(); Loading @@ -626,6 +628,8 @@ public class GcSnapshot { } } // If we have clipBounds available, use them as they will always be // If we have clipBounds available, use them as they will always be // smaller than the full layer size. // smaller than the full layer size. x = clipBounds.x; y = clipBounds.y; width = clipBounds.width; width = clipBounds.width; height = clipBounds.height; height = clipBounds.height; } else { } else { Loading @@ -646,13 +650,20 @@ public class GcSnapshot { true /*compositeOnly*/, forceMode); true /*compositeOnly*/, forceMode); try { try { // The main draw operation. // 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); drawable.draw(imageGraphics, paint); // Apply the color filter. // 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); filter.applyFilter(imageGraphics, width, height); // Draw the tinted image on the main layer. // Draw the tinted image on the main layer using as start point the clipping configuredGraphics.drawImage(image, 0, 0, null); // upper left coordinates. configuredGraphics.drawImage(image, x, y, null); layer.change(); layer.change(); } finally { } finally { // dispose Graphics2D objects // dispose Graphics2D objects Loading Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/GcSnapshot.java +13 −2 Original line number Original line Diff line number Diff line Loading @@ -616,6 +616,8 @@ public class GcSnapshot { return; return; } } int x = 0; int y = 0; int width; int width; int height; int height; Rectangle clipBounds = originalGraphics.getClipBounds(); Rectangle clipBounds = originalGraphics.getClipBounds(); Loading @@ -626,6 +628,8 @@ public class GcSnapshot { } } // If we have clipBounds available, use them as they will always be // If we have clipBounds available, use them as they will always be // smaller than the full layer size. // smaller than the full layer size. x = clipBounds.x; y = clipBounds.y; width = clipBounds.width; width = clipBounds.width; height = clipBounds.height; height = clipBounds.height; } else { } else { Loading @@ -646,13 +650,20 @@ public class GcSnapshot { true /*compositeOnly*/, forceMode); true /*compositeOnly*/, forceMode); try { try { // The main draw operation. // 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); drawable.draw(imageGraphics, paint); // Apply the color filter. // 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); filter.applyFilter(imageGraphics, width, height); // Draw the tinted image on the main layer. // Draw the tinted image on the main layer using as start point the clipping configuredGraphics.drawImage(image, 0, 0, null); // upper left coordinates. configuredGraphics.drawImage(image, x, y, null); layer.change(); layer.change(); } finally { } finally { // dispose Graphics2D objects // dispose Graphics2D objects Loading