[aseprite] 40/51: pixly: dealing with cels smaller than the sprite

Tobias Hansen thansen at moszumanska.debian.org
Mon Jul 11 21:35:18 UTC 2016


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

thansen pushed a commit to branch master
in repository aseprite.

commit 99bd10dfbdb9d2579d57f0640db9526a988e6a2d
Author: Carlo 'zED' Caputo <carlo.caputo at gmail.com>
Date:   Mon Jul 4 15:27:36 2016 -0300

    pixly: dealing with cels smaller than the sprite
---
 src/app/file/pixly_format.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/app/file/pixly_format.cpp b/src/app/file/pixly_format.cpp
index b14e323..ff3790f 100644
--- a/src/app/file/pixly_format.cpp
+++ b/src/app/file/pixly_format.cpp
@@ -468,15 +468,19 @@ bool PixlyFormat::onSave(FileOp* fop)
       if (cel) {
         const Image* image = cel->image();
         if (image) {
+          int celX = cel->x();
+          int celY = cel->y();
+          int celWidth = image->width();
+          int celHeight = image->height();
 
-          for (y = 0; y < frameHeight; y++) {
+          for (y = 0; y < celHeight; y++) {
             /* RGB_ALPHA */
             uint32_t* src_address = (uint32_t*)image->getPixelAddress(0, y);
-            uint8_t* dst_address = rows_pointer[(height - 1) - y0 - (frameHeight - 1) + y] + (x0 * 4);
+            uint8_t* dst_address = rows_pointer[(height - 1) - y0 - (frameHeight - 1) + celY + y] + ((x0 + celX) * 4);
             int x;
             unsigned int c;
 
-            for (x=0; x<frameWidth; x++) {
+            for (x=0; x<celWidth; x++) {
               c = *(src_address++);
               *(dst_address++) = rgba_getr(c);
               *(dst_address++) = rgba_getg(c);

-- 
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