From 4e2488534fa9c6988a880fcd8b831063a15ee822 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 23 Sep 2024 15:04:11 -0300 Subject: [PATCH 1/5] Don't show GPU checkbox in preferences dialog This option is only available in ENABLE_DEVMODE, regression from 31c80a5e0c8724635eff173a64b88604de595367. --- src/app/commands/cmd_options.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/commands/cmd_options.cpp b/src/app/commands/cmd_options.cpp index f8db29bbf..83154d0be 100644 --- a/src/app/commands/cmd_options.cpp +++ b/src/app/commands/cmd_options.cpp @@ -375,11 +375,13 @@ public: uiWindows()->setSelectedItem(multipleWindows()->isSelected() ? 1: 0); }); -#ifndef ENABLE_DEVMODE // TODO enable this on Release when Aseprite supports - // GPU-acceleration properly +#ifdef ENABLE_DEVMODE // TODO enable this on Release when Aseprite supports + // GPU-acceleration properly if (!os::instance()->hasCapability(os::Capabilities::GpuAccelerationSwitch)) - gpuAcceleration()->setVisible(false); #endif + { + gpuAcceleration()->setVisible(false); + } // If the platform does support native menus, we show the option, // in other case, the option doesn't make sense for this platform. @@ -635,9 +637,11 @@ public: // Scaling selectScalingItems(); +#ifdef ENABLE_DEVMODE if (os::instance()->hasCapability(os::Capabilities::GpuAccelerationSwitch)) { gpuAcceleration()->setSelected(m_pref.general.gpuAcceleration()); } +#endif if (os::instance()->menus()) showMenuBar()->setSelected(m_pref.general.showMenuBar()); @@ -904,11 +908,13 @@ public: reset_screen = true; } +#ifdef ENABLE_DEVMODE const bool newGpuAccel = gpuAcceleration()->isSelected(); if (newGpuAccel != m_pref.general.gpuAcceleration()) { m_pref.general.gpuAcceleration(newGpuAccel); reset_screen = true; } +#endif if (os::instance()->menus() && m_pref.general.showMenuBar() != showMenuBar()->isSelected()) { From a975873f7ae38988d4cc2f20dc10e12ec08f3bbd Mon Sep 17 00:00:00 2001 From: Christian Kaiser Date: Tue, 24 Sep 2024 01:06:09 -0300 Subject: [PATCH 2/5] Fix Sentry wrapper compilation --- src/app/sentry_wrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/sentry_wrapper.cpp b/src/app/sentry_wrapper.cpp index 30e7838d9..3545f362a 100644 --- a/src/app/sentry_wrapper.cpp +++ b/src/app/sentry_wrapper.cpp @@ -109,7 +109,7 @@ bool Sentry::areThereCrashesToReport() // At least one .dmp file in the completed/ directory means that // there was at least one crash in the past (this is for macOS). - if (!base::join_path(m_dbdir, "completed"), base::ItemType::Files, "*.dmp").empty()) + if (!base::list_files(base::join_path(m_dbdir, "completed"), base::ItemType::Files, "*.dmp").empty()) return true; // In case that "last_crash" doesn't exist we can check for some From e5faac07b59b8def5d67d8f957f842146964a770 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 3 Oct 2024 12:42:26 -0300 Subject: [PATCH 3/5] Fix regression breaking linked cels on "Merge Down" (fix #4685) --- src/app/cmd/flatten_layers.cpp | 17 ++++++++++++++++- tests/scripts/merge_down_bugs.lua | 24 +++++++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/app/cmd/flatten_layers.cpp b/src/app/cmd/flatten_layers.cpp index d2e42515a..147f748be 100644 --- a/src/app/cmd/flatten_layers.cpp +++ b/src/app/cmd/flatten_layers.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019-2022 Igara Studio S.A. +// Copyright (C) 2019-2024 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -35,6 +35,8 @@ #include "doc/sprite.h" #include "render/render.h" +#include + namespace app { namespace cmd { @@ -128,11 +130,24 @@ void FlattenLayers::onExecute() RestoreVisibleLayers restore; restore.showSelectedLayers(sprite, layers); + const LayerList visibleLayers = sprite->allVisibleLayers(); + // Map draw area to image coords const gfx::ClipF area_to_image(0, 0, area); // Copy all frames to the background. for (frame_t frame(0); frametotalFrames(); ++frame) { + // If the flatLayer is the only cel in this frame, we can skip + // this frame to keep existing links in the flatLayer. + const bool anotherCelExists = + std::any_of(visibleLayers.begin(), + visibleLayers.end(), + [flatLayer, frame](const Layer* other) { + return (flatLayer != other && other->cel(frame)); + }); + if (!anotherCelExists) + continue; + // Clear the image and render this frame. clear_image(image.get(), bgcolor); render.renderSprite(image.get(), sprite, frame, area_to_image); diff --git a/tests/scripts/merge_down_bugs.lua b/tests/scripts/merge_down_bugs.lua index 6930cfa2b..537d396e7 100644 --- a/tests/scripts/merge_down_bugs.lua +++ b/tests/scripts/merge_down_bugs.lua @@ -1,4 +1,4 @@ --- Copyright (C) 2019 Igara Studio S.A. +-- Copyright (C) 2019-2024 Igara Studio S.A. -- -- This file is released under the terms of the MIT license. -- Read LICENSE.txt for more information. @@ -46,3 +46,25 @@ do local after = s.cels[1].image assert(before:isEqual(after)) end + +-- Check that linked cels are not broken (regression in issue #4685) +-- We create two layers, the bottom one with 4 linked frames, and the +-- top one with one cel at 2nd frame, when we merge them, the +-- resulting layer should have frame 1, 3, and 4 linked. +do + local s = Sprite(32, 32) + app.useTool{ color=Color(255, 0, 0), points={ {0,0}, {32,32} } } + app.layer.isContinuous = true + app.command.NewFrame{ content=cellinked } + app.command.NewFrame{ content=cellinked } + app.command.NewFrame{ content=cellinked } + s:newLayer() + app.frame = 2 + app.useTool{ color=Color(0, 0, 255), points={ {32,0}, {0,32} } } + app.command.MergeDownLayer() + local cels = app.layer.cels + -- Check that frame 1, 3, and 4 have the same image (linked cels) + assert(cels[1].image ~= cels[2].image) + assert(cels[1].image == cels[3].image) + assert(cels[1].image == cels[4].image) +end From ff520c14d21106589fd048bb9214e2660a3fda84 Mon Sep 17 00:00:00 2001 From: Gaspar Capello Date: Fri, 4 Oct 2024 10:37:28 -0300 Subject: [PATCH 4/5] Fix transparency issue with new color criterias (fix #4686) Prior to this fix, the following particular conditions caused an incorrect conversion of an opaque color to a transparent color during RGBA->Indexed conversion: - RGBA image with black color (#000000 a=255) painted on the canvas - The black color is absent from the palette. - The mask color is present in the palette - Converts the sprite to indexed color mode using Sprite > Color Mode > More Options - Select Advanced Options, select a Color Best Fit Criteria other than Default (for example CIELAB) and press OK - The original black color becomes the mask color. --- src/doc/rgbmap_base.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rgbmap_base.cpp b/src/doc/rgbmap_base.cpp index 53d97256d..e0c28bd9e 100644 --- a/src/doc/rgbmap_base.cpp +++ b/src/doc/rgbmap_base.cpp @@ -120,7 +120,7 @@ int RgbMapBase::findBestfit(int r, int g, int b, int a, const double aDiff = double(a - rgba_geta(rgb)) / 128.0; double diff = xDiff * xDiff + yDiff * yDiff + zDiff * zDiff + aDiff * aDiff; - if (diff < lowest) { + if (diff < lowest && i != mask_index) { lowest = diff; bestfit = i; } From 384813421cc30f5da7472c0792b4ab1bdb388597 Mon Sep 17 00:00:00 2001 From: David Capello Date: Sun, 6 Oct 2024 20:41:08 -0300 Subject: [PATCH 5/5] [lua] Update scripting API version to 29 This should have been changed for v1.3.9. --- src/app/script/api_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/script/api_version.h b/src/app/script/api_version.h index a9684b278..2c46870dd 100644 --- a/src/app/script/api_version.h +++ b/src/app/script/api_version.h @@ -10,6 +10,6 @@ // Increment this value if the scripting API is modified between two // released Aseprite versions. -#define API_VERSION 28 +#define API_VERSION 29 #endif