diff --git a/src/app/file/pixly_format.cpp b/src/app/file/pixly_format.cpp index b14e32357..ff3790f7d 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