diff options
author | Sven de Marothy <sven@physto.se> | 2005-06-23 20:35:49 +0000 |
---|---|---|
committer | Sven de Marothy <sven@physto.se> | 2005-06-23 20:35:49 +0000 |
commit | 500ec73a50c5d70cb3d484deaaa518d8e73726b3 (patch) | |
tree | d6cd204745e09e9059f077e987e3fdbc6cbe06b4 /gnu/java/awt | |
parent | a9d7e0858268717cb2240a2af694738acefc12c3 (diff) | |
download | classpath-500ec73a50c5d70cb3d484deaaa518d8e73726b3.tar.gz |
2005-06-23 Sven de Marothy <sven@physto.se>
* gnu/java/awt/peer/gtk/GtkImage.java: Add case source size > size.
Diffstat (limited to 'gnu/java/awt')
-rw-r--r-- | gnu/java/awt/peer/gtk/GtkImage.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gnu/java/awt/peer/gtk/GtkImage.java b/gnu/java/awt/peer/gtk/GtkImage.java index 82ae99cbc..6ea0653ad 100644 --- a/gnu/java/awt/peer/gtk/GtkImage.java +++ b/gnu/java/awt/peer/gtk/GtkImage.java @@ -375,18 +375,30 @@ public class GtkImage extends Image int dstY = (dy1 < dy2) ? dy1 : dy2; // Clipping. This requires the dst to be scaled as well, + if (srcWidth > width) + { + dstWidth = (int)((double)dstWidth*((double)width/(double)srcWidth)); + srcWidth = width - srcX; + } + + if (srcHeight > height) + { + dstHeight = (int)((double)dstHeight*((double)height/(double)srcHeight)); + srcHeight = height - srcY; + } + if (srcWidth + srcX > width) { dstWidth = (int)((double)dstWidth * (double)(width - srcX)/(double)srcWidth); srcWidth = width - srcX; - } + } if (srcHeight + srcY > height) { dstHeight = (int)((double)dstHeight * (double)(width - srcY)/(double)srcHeight); srcHeight = height - srcY; } - + if(bgcolor != null) drawPixelsScaledFlipped (g, bgcolor.getRed (), bgcolor.getGreen (), bgcolor.getBlue (), |