Merge branch 'main' into beta

This commit is contained in:
David Capello 2022-03-31 19:34:38 -03:00
commit 66d74688e2
5 changed files with 12 additions and 41 deletions

View File

@ -30,13 +30,6 @@ set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/laf/cmake/cxx
# Aseprite project
project(aseprite C CXX)
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
# As we compile with CMAKE_OSX_DEPLOYMENT_TARGET=10.9, we have to
# explicitly say that we want to use libc++ instead of the GNU
# libstdc++
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
# Check repository status
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/laf/CMakeLists.txt)
message(FATAL_ERROR "Your Aseprite repository is incomplete, initialize submodules using:\n git submodule update --init --recursive")

2
laf

@ -1 +1 @@
Subproject commit ba02ed3e24974e8cd60ddccdac9dc3a5fa3bd6d7
Subproject commit d562448222c1990719f860246b5b3bcc3d2e1aa0

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2020 Igara Studio S.A.
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -390,18 +390,13 @@ public:
return;
token.set_progress(0.2f + 0.2f * i / samples.size());
if (sample.isLinked()) {
++i;
continue;
}
if (sample.isEmpty()) {
sample.setInTextureBounds(gfx::Rect(0, 0, 0, 0));
++i;
continue;
}
if (m_mergeDups) {
if (m_mergeDups || sample.isLinked()) {
doc::ImageBufferPtr sampleBuf = std::make_shared<doc::ImageBuffer>();
doc::ImageRef sampleRender(sample.createRender(sampleBuf));
auto it = duplicates.find(sampleRender);
@ -527,8 +522,7 @@ public:
token.set_progress_range(0.2f, 0.3f);
token.set_progress(float(i) / samples.size());
if (sample.isLinked() ||
sample.isEmpty()) {
if (sample.isEmpty()) {
++i;
continue;
}
@ -609,7 +603,6 @@ void DocExporter::reset()
m_listLayers = false;
m_listSlices = false;
m_documents.clear();
m_tagDelta.clear();
}
void DocExporter::setDocImageBuffer(const doc::ImageBufferPtr& docBuf)
@ -912,6 +905,7 @@ void DocExporter::captureSamples(Samples& samples,
}
// Re-use linked samples
bool alreadyTrimmed = false;
if (link && m_mergeDuplicates) {
for (const Sample& other : samples) {
if (token.canceled())
@ -923,7 +917,9 @@ void DocExporter::captureSamples(Samples& samples,
ASSERT(!other.isLinked());
sample.setLinked();
sample.setTrimmedBounds(other.trimmedBounds());
sample.setSharedBounds(other.sharedBounds());
alreadyTrimmed = true;
done = true;
break;
}
@ -933,7 +929,6 @@ void DocExporter::captureSamples(Samples& samples,
ASSERT(done || (!done && tag));
}
bool alreadyTrimmed = false;
if (!done && (m_ignoreEmptyCels || m_trimCels)) {
// Ignore empty cels
if (layer && layer->isImage() && !cel && m_ignoreEmptyCels)
@ -969,15 +964,8 @@ void DocExporter::captureSamples(Samples& samples,
// Should we ignore this empty frame? (i.e. don't include
// the frame in the sprite sheet)
if (m_ignoreEmptyCels) {
for (Tag* tag : sprite->tags()) {
auto& delta = m_tagDelta[tag->id()];
if (frame < tag->fromFrame()) --delta.first;
if (frame <= tag->toFrame()) --delta.second;
}
if (m_ignoreEmptyCels)
continue;
}
// Create an entry with Size(1, 1) for this completely
// trimmed frame anyway so we conserve the frame information
@ -1349,13 +1337,9 @@ void DocExporter::createDataFile(const Samples& samples,
else
os << ",";
std::pair<int, int> delta(0, 0);
if (!m_tagDelta.empty())
delta = m_tagDelta[tag->id()];
os << "\n { \"name\": \"" << escape_for_json(tag->name()) << "\","
<< " \"from\": " << (tag->fromFrame()+delta.first) << ","
<< " \"to\": " << (tag->toFrame()+delta.second) << ","
<< " \"from\": " << (tag->fromFrame()) << ","
<< " \"to\": " << (tag->toFrame()) << ","
" \"direction\": \"" << escape_for_json(convert_anidir_to_string(tag->aniDir())) << "\"";
os << tag->userData() << " }";
}

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2019-2022 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -21,7 +21,6 @@
#include "gfx/rect.h"
#include <iosfwd>
#include <map>
#include <string>
#include <utility>
#include <vector>
@ -163,11 +162,6 @@ namespace app {
bool m_listSlices;
Items m_documents;
// Displacement for each tag from/to frames in case we export
// them. It's used in case we trim frames outside tags and they
// will not be exported at all in the final result.
std::map<doc::ObjectId, std::pair<int, int> > m_tagDelta;
// Buffers used
doc::ImageBufferPtr m_docBuf;
doc::ImageBufferPtr m_sampleBuf;

View File

@ -115,7 +115,7 @@ app::Color Color_new(lua_State* L, int index)
int a = 255;
if (lua_getfield(L, index, "alpha") != LUA_TNIL)
a = lua_tointeger(L, -1);
color = app::Color::fromHsv(lua_tonumber(L, -2),
color = app::Color::fromHsl(lua_tonumber(L, -2),
lua_tonumber(L, -3),
lua_tonumber(L, -4), a);
lua_pop(L, 4);