From 6d30f274f44adef05d84220e19cd7f60ebb4b14e Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 28 Jun 2022 14:01:27 -0300 Subject: [PATCH 1/7] [msvc] Fix problem using invalid min/max bounds in std::clamp There is an assert() in the std::clamp() impl on MSVC that checks if the min/max values are valid. --- src/app/ui/timeline/timeline.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/ui/timeline/timeline.cpp b/src/app/ui/timeline/timeline.cpp index bafdad592..dc66ae87c 100644 --- a/src/app/ui/timeline/timeline.cpp +++ b/src/app/ui/timeline/timeline.cpp @@ -4253,7 +4253,10 @@ void Timeline::setLayerCollapsedFlag(const layer_t l, const bool state) int Timeline::separatorX() const { - return std::clamp(m_separator_x, headerBoxWidth(), bounds().w-guiscale()); + return std::clamp(m_separator_x, + headerBoxWidth(), + std::max(bounds().w-guiscale(), + headerBoxWidth())); } void Timeline::setSeparatorX(int newValue) From aaf779e39903f69461a89128624d8dbfa0309032 Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 28 Jun 2022 14:02:33 -0300 Subject: [PATCH 2/7] Update laf module --- laf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laf b/laf index 395a74c99..a361cb538 160000 --- a/laf +++ b/laf @@ -1 +1 @@ -Subproject commit 395a74c990f4df3889df0b7e140998ba68ea49af +Subproject commit a361cb538e8ea7bfa74ad9ce488d3318a3db3bc2 From 0aeacd46de2319d0f160114303ea2302878cd02a Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 28 Jun 2022 14:33:12 -0300 Subject: [PATCH 3/7] Disable ccache on Windows (fix #3404) --- .github/workflows/build.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 227cf6d90..721c08c64 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,10 +36,16 @@ jobs: - name: Generating Makefiles shell: bash run: | + if [[ "${{ runner.os }}" == "Windows" ]] ; then + export enable_ccache=off + else + export enable_ccache=on + fi cmake -S . -B build -G Ninja \ -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \ -DENABLE_TESTS=ON \ - -DENABLE_UI=${{ matrix.enable_ui }} + -DENABLE_UI=${{ matrix.enable_ui }} \ + -DENABLE_CCACHE=$enable_ccache - name: Compiling shell: bash run: | From 3adfe13b7ee47e6d21229852a7b1a10b09c92061 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 23 Jun 2022 16:24:17 -0300 Subject: [PATCH 4/7] Add RelWithDebInfo and Debug build types to GitHub actions --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 721c08c64..2b157e346 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,11 +7,11 @@ jobs: fail-fast: false matrix: os: [windows-latest, macos-latest, ubuntu-latest] - build_type: [debug] + build_type: [RelWithDebInfo, Debug] enable_ui: [off] include: - os: ubuntu-latest - build_type: debug + build_type: Debug enable_ui: on steps: - uses: actions/checkout@v2 @@ -42,6 +42,7 @@ jobs: export enable_ccache=on fi cmake -S . -B build -G Ninja \ + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \ -DENABLE_TESTS=ON \ -DENABLE_UI=${{ matrix.enable_ui }} \ From 3d0b5d809cfa1c7f4dd4a7b93419419daff03274 Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 28 Jun 2022 15:17:29 -0300 Subject: [PATCH 5/7] Fix bug in move_or_copy_palette_colors() accessing out-of-range index --- src/app/util/pal_ops.cpp | 4 ++-- src/doc/palette_picks.h | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/app/util/pal_ops.cpp b/src/app/util/pal_ops.cpp index 4bd7a53a8..7f1723f8a 100644 --- a/src/app/util/pal_ops.cpp +++ b/src/app/util/pal_ops.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019 Igara Studio S.A. +// Copyright (C) 2019-2022 Igara Studio S.A. // // This program is distributed under the terms of // the End-User License Agreement for Aseprite. @@ -27,8 +27,8 @@ void move_or_copy_palette_colors( if (beforeIndex >= palette.size()) { palette.resize(beforeIndex); // TODO is need to resize the // palette? why not "const Palette& palette" - picks.resize(palette.size()); } + picks.resize(palette.size()); palette.copyColorsTo(&newPalette); doc::Remap remap(palette.size()); diff --git a/src/doc/palette_picks.h b/src/doc/palette_picks.h index 8bd2bc343..771fc1cd1 100644 --- a/src/doc/palette_picks.h +++ b/src/doc/palette_picks.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (c) 2019 Igara Studio S.A. +// Copyright (c) 2019-2022 Igara Studio S.A. // Copyright (c) 2001-2017 David Capello // // This file is released under the terms of the MIT license. @@ -9,6 +9,7 @@ #define DOC_PALETTE_PICKS_H_INCLUDED #pragma once +#include "base/debug.h" #include "doc/color.h" #include @@ -36,8 +37,15 @@ namespace doc { const_iterator begin() const { return m_items.begin(); } const_iterator end() const { return m_items.end(); } - const_reference operator[](int idx) const { return m_items[idx]; } - reference operator[](int idx) { return m_items[idx]; } + const_reference operator[](int idx) const { + ASSERT(idx >= 0 && idx < int(m_items.size())); + return m_items[idx]; + } + + reference operator[](int idx) { + ASSERT(idx >= 0 && idx < int(m_items.size())); + return m_items[idx]; + } void resize(int n) { m_items.resize(n, false); From 1f5e4cfc4f03c835010100c6011b220270b53dbe Mon Sep 17 00:00:00 2001 From: Gaspar Capello Date: Thu, 23 Jun 2022 15:52:51 -0300 Subject: [PATCH 6/7] Add '{title}' and '{layer}' functionality to the Export dialog (fix aseprite/aseprite#3363) Also Add '{title}' functionality to CLI dialog on sprite-sheet file name --- src/app/commands/cmd_save_file.cpp | 7 ++++++- src/app/doc_exporter.cpp | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/commands/cmd_save_file.cpp b/src/app/commands/cmd_save_file.cpp index 92bf030bb..ef5d18498 100644 --- a/src/app/commands/cmd_save_file.cpp +++ b/src/app/commands/cmd_save_file.cpp @@ -23,6 +23,7 @@ #include "app/file/gif_format.h" #include "app/file/png_format.h" #include "app/file_selector.h" +#include "app/filename_formatter.h" #include "app/i18n/strings.h" #include "app/job.h" #include "app/modules/gui.h" @@ -390,7 +391,11 @@ void SaveFileCopyAsCommand::onExecute(Context* context) if (!result) return; - outputFilename = win.outputFilenameValue(); + FilenameInfo fnInfo; + fnInfo + .filename(context->activeDocument()->name()) + .layerName(win.layersValue()); + outputFilename = filename_formatter(win.outputFilenameValue(), fnInfo); if (askOverwrite && base::is_file(outputFilename)) { diff --git a/src/app/doc_exporter.cpp b/src/app/doc_exporter.cpp index 5385394ef..fe3120025 100644 --- a/src/app/doc_exporter.cpp +++ b/src/app/doc_exporter.cpp @@ -689,6 +689,11 @@ Doc* DocExporter::exportSheet(Context* ctx, base::task_token& token) // Save the image files. if (!m_textureFilename.empty()) { DX_TRACE("DocExporter::exportSheet", m_textureFilename); + // filename_formatter usage to include {title} key word on CLI. + FilenameInfo fnInfo; + fnInfo.filename(ctx->activeDocument()->name()); + m_textureFilename = filename_formatter(m_textureFilename.c_str(), fnInfo); + textureDocument->setFilename(m_textureFilename.c_str()); int ret = save_document(ctx, textureDocument.get()); if (ret == 0) From 306e13dfad8a0b6b4bee5c07c3b04c2626ca1153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Capello?= Date: Mon, 27 Jun 2022 11:05:35 -0300 Subject: [PATCH 7/7] Clear the exported images with its mask color instead of 0 (fix #3391) --- src/app/doc_exporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/doc_exporter.cpp b/src/app/doc_exporter.cpp index fe3120025..032e14729 100644 --- a/src/app/doc_exporter.cpp +++ b/src/app/doc_exporter.cpp @@ -1151,7 +1151,7 @@ void DocExporter::renderTexture(Context* ctx, Image* textureImage, base::task_token& token) const { - textureImage->clear(0); + textureImage->clear(textureImage->maskColor()); int i = 0; for (const auto& sample : samples) {