diff options
| author | Sven de Marothy <sven@physto.se> | 2006-05-31 20:52:46 +0000 |
|---|---|---|
| committer | Sven de Marothy <sven@physto.se> | 2006-05-31 20:52:46 +0000 |
| commit | 22ee7e593a30ddf2c178e6d5019cbec7cfa08051 (patch) | |
| tree | 2d5f8dcd0b32dd9ee5d515c0d813e285310bfebf /gnu/java | |
| parent | 6cb6da46bae339c91ae0d189400b1575e3622293 (diff) | |
| download | classpath-22ee7e593a30ddf2c178e6d5019cbec7cfa08051.tar.gz | |
2006-05-30 Sven de Marothy <sven@physto.se>
Should fix PR 27835
* gnu/java/awt/peer/gtk/BufferedImageGraphics.java
(updateBufferedImage): Keep within image bounds.
Diffstat (limited to 'gnu/java')
| -rw-r--r-- | gnu/java/awt/peer/gtk/BufferedImageGraphics.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gnu/java/awt/peer/gtk/BufferedImageGraphics.java b/gnu/java/awt/peer/gtk/BufferedImageGraphics.java index e94d31c3b..31d76000f 100644 --- a/gnu/java/awt/peer/gtk/BufferedImageGraphics.java +++ b/gnu/java/awt/peer/gtk/BufferedImageGraphics.java @@ -119,7 +119,16 @@ public class BufferedImageGraphics extends CairoGraphics2D private void updateBufferedImage(int x, int y, int width, int height) { int[] pixels = surface.getPixels(imageWidth * imageHeight * 4); - + if( x > imageWidth || y > imageHeight ) + return; + // Clip edges. + if( x < 0 ){ width = width + x; x = 0; } + if( y < 0 ){ height = height + y; y = 0; } + if( x + width > imageWidth ) + width = imageWidth - x; + if( y + height > imageHeight ) + height = imageHeight - y; + int index = 0; for (int j = y; j < y + height; ++j) for (int i = x; i < x + width; ++i) |
