[aseprite] 61/134: Fix position of the pasted image

Tobias Hansen thansen at moszumanska.debian.org
Sat Mar 14 17:10:05 UTC 2015


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit 8fc01593f76f811f1ae5d199fbabed85ffbd9b5c
Author: David Capello <davidcapello at gmail.com>
Date:   Wed Nov 12 11:32:18 2014 -0300

    Fix position of the pasted image
---
 src/app/ui/editor/editor.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp
index f074af7..db7991b 100644
--- a/src/app/ui/editor/editor.cpp
+++ b/src/app/ui/editor/editor.cpp
@@ -970,7 +970,8 @@ Rect Editor::getVisibleSpriteBounds()
   screenToEditor(vp.x, vp.y, &x1, &y1);
   screenToEditor(vp.x+vp.w-1, vp.y+vp.h-1, &x2, &y2);
 
-  return Rect(x1, y1, x2-x1+1, y2-y1+1);
+  return Rect(0, 0, m_sprite->width(), m_sprite->height())
+    .createIntersect(Rect(x1, y1, x2-x1+1, y2-y1+1));
 }
 
 // Changes the scroll to see the given point as the center of the editor.
@@ -1365,10 +1366,6 @@ void Editor::pasteImage(const Image* image, int x, int y)
 
   // Check bounds where the image will be pasted.
   {
-    // First we limit the image inside the sprite's bounds.
-    x = MID(0, x, sprite->width() - image->width());
-    y = MID(0, y, sprite->height() - image->height());
-
     // Then we check if the image will be visible by the user.
     Rect visibleBounds = getVisibleSpriteBounds();
     x = MID(visibleBounds.x-image->width(), x, visibleBounds.x+visibleBounds.w-1);
@@ -1385,6 +1382,10 @@ void Editor::pasteImage(const Image* image, int x, int y)
       x = visibleBounds.x + visibleBounds.w/2 - image->width()/2;
       y = visibleBounds.y + visibleBounds.h/2 - image->height()/2;
     }
+
+    // We limit the image inside the sprite's bounds.
+    x = MID(0, x, sprite->width() - image->width());
+    y = MID(0, y, sprite->height() - image->height());
   }
 
   PixelsMovementPtr pixelsMovement(

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list