• R/O
  • SSH
  • HTTPS

kirikirij: Commit


Commit MetaInfo

Revision180 (tree)
Time2012-07-16 01:14:54
Authorjin1016

Log Message

copyRect で同一レイヤー内で領域が重なるコピーの不具合を修正

Change Summary

Incremental Difference

--- base/trunk/src/src/jp/kirikiri/tvp2env/NativeImageBuffer.java (revision 179)
+++ base/trunk/src/src/jp/kirikiri/tvp2env/NativeImageBuffer.java (revision 180)
@@ -258,6 +258,21 @@
258258 return ret;
259259 }
260260 public final boolean copyRect(int x, int y, NativeImageBuffer src, Rect refrect, int plane) {
261+ BufferedImage tmp;
262+ if( this == src ) {
263+ // コピー元とコピー先が同じ場合は、一端テンポラリへコピーする
264+ int type = src.mImage.getType();
265+ int w = refrect.width();
266+ int h = refrect.height();
267+ tmp = new BufferedImage( w, h, type );
268+ Graphics2D g = (Graphics2D)tmp.getGraphics();
269+ g.setComposite( AlphaComposite.Src );
270+ g.drawImage( src.mImage, 0, 0, w, h, refrect.left, refrect.top, refrect.right, refrect.bottom, null );
271+ g.dispose();
272+ refrect = new Rect(0,0,w,h);
273+ } else {
274+ tmp = src.mImage;
275+ }
261276 Graphics2D g = (Graphics2D)mImage.getGraphics();
262277 if( (BaseBitmap.BB_COPY_MAIN|BaseBitmap.BB_COPY_MASK) == plane ) {
263278 g.setComposite( AlphaComposite.Src );
@@ -266,7 +281,7 @@
266281 } else if( BaseBitmap.BB_COPY_MASK == plane ) {
267282 g.setComposite(new CustomOperationComposite( CustomOperationComposite.copyMask, 255, false ));
268283 }
269- boolean ret = g.drawImage( src.mImage, x, y, x+refrect.width(), y+refrect.height(),
284+ boolean ret = g.drawImage( tmp, x, y, x+refrect.width(), y+refrect.height(),
270285 refrect.left, refrect.top, refrect.right, refrect.bottom, null );
271286 g.dispose();
272287 return ret;
Show on old repository browser