am b2411c62: am ead59b0d: Merge "Fix GcSnapshot drawInLayer when clipping is used." into lmp-mr1-dev
* commit 'b2411c622cf9124f6af5f70d416adb179f9c88bb': Fix GcSnapshot drawInLayer when clipping is used.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user