Merge branch 'main' into beta

This commit is contained in:
David Capello 2022-10-11 18:50:09 -03:00
commit a5ac9ada27
5 changed files with 28 additions and 19 deletions

2
laf

@ -1 +1 @@
Subproject commit 81622fcbb9e4a0edc14a02250c387bd6fa878708
Subproject commit f14a6a5f33b77b9d5363075bde5ab328219cfd92

View File

@ -679,7 +679,8 @@ FileOp* FileOp::createSaveDocumentOperation(const Context* context,
.outerTagName(outerTag ? outerTag->name(): "")
.frame(outputFrame)
.tagFrame(innerTag ? frame - innerTag->fromFrame():
outputFrame);
outputFrame)
.duration(spr->frameDuration(frame));
fop->m_seq.filename_list.push_back(
filename_formatter(fn_format, fnInfo));

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -112,12 +113,12 @@ std::string filename_formatter(
base::replace_string(output, "{layer}", info.layerName());
base::replace_string(output, "{group}", info.groupName());
base::replace_string(output, "{slice}", info.sliceName());
base::replace_string(output, "{duration}", std::to_string(info.duration()));
if (replaceFrame) {
base::replace_string(output, "{tag}", info.innerTagName());
base::replace_string(output, "{innertag}", info.innerTagName());
base::replace_string(output, "{outertag}", info.outerTagName());
base::replace_string(output, "{duration}", std::to_string(info.duration()));
replace_frame("{frame", info.frame(), output);
replace_frame("{tagframe", info.tagFrame(), output);
}

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2022 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -14,8 +15,6 @@ namespace app {
class FilenameInfo {
public:
FilenameInfo() : m_frame(-1), m_tagFrame(-1) { }
const std::string& filename() const { return m_filename; }
const std::string& layerName() const { return m_layerName; }
const std::string& groupName() const { return m_groupName; }
@ -78,9 +77,9 @@ namespace app {
std::string m_innerTagName;
std::string m_outerTagName;
std::string m_sliceName;
int m_frame;
int m_tagFrame;
int m_duration;
int m_frame = -1;
int m_tagFrame = -1;
int m_duration = 0;
};
// Returns the information inside {frame} tag.

View File

@ -91,17 +91,25 @@ ImageRef shift_image_with_mask(const Cel* cel,
ImageRef imageToShift(Image::create(compImage->pixelFormat(), maskedBounds.w, maskedBounds.h));
imageToShift->copy(compImage.get(), gfx::Clip(0, 0, maskedBounds));
// Shiftting the masked area of the COMPOUND IMAGE (compImage).
int initialX = maskedBounds.x;
int initialY = maskedBounds.y;
int finalX = maskedBounds.x2();
int finalY = maskedBounds.y2();
for (int y=initialY; y<finalY; ++y) {
for (int x=initialX; x<finalX; ++x) {
put_pixel(compImage.get(),
initialX + (maskedBounds.w + dx + x-initialX) % maskedBounds.w,
initialY + (maskedBounds.h + dy + y-initialY) % maskedBounds.h,
get_pixel(imageToShift.get(), x - initialX, y - initialY));
// Shifting the masked area of the COMPOUND IMAGE (compImage).
const int xInitial = maskedBounds.x;
const int yInitial = maskedBounds.y;
const int wMask = maskedBounds.w;
const int hMask = maskedBounds.h;
for (int y=0; y<hMask; ++y) {
for (int x=0; x<wMask; ++x) {
// Use floor modulo (Euclidean remainder).
// Shifts are broken out and stored in separate variables
// to make them easier to recognize and change in the event
// that rem_eucl is implemented formally in the future.
const int xShift = ((dx + x) % wMask + wMask) % wMask;
const int yShift = ((dy + y) % hMask + hMask) % hMask;
put_pixel(
compImage.get(),
xInitial + xShift,
yInitial + yShift,
get_pixel(imageToShift.get(), x, y));
}
}