Don't access Preferences instance from dio::DecodeDelegate impl

This commit is contained in:
David Capello 2023-02-14 12:12:57 -03:00
parent a5a1d22705
commit eee79f5520
3 changed files with 11 additions and 9 deletions

View File

@ -14,7 +14,6 @@
#include "app/file/file.h"
#include "app/file/file_format.h"
#include "app/file/format_options.h"
#include "app/pref/preferences.h"
#include "base/cfile.h"
#include "base/exception.h"
#include "base/file_handle.h"
@ -65,7 +64,7 @@ public:
}
doc::color_t defaultSliceColor() override {
auto color = Preferences::instance().slices.defaultColor();
auto color = m_fop->config().defaultSliceColor;
return doc::rgba(color.getRed(),
color.getGreen(),
color.getBlue(),

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2022 Igara Studio S.A.
// Copyright (C) 2018-2023 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -260,6 +260,7 @@ namespace app {
bool hasEmbeddedGridBounds() const { return m_embeddedGridBounds; }
bool newBlend() const { return m_config.newBlend; }
const FileOpConfig& config() const { return m_config; }
private:
FileOp(); // Undefined

View File

@ -16,13 +16,15 @@ namespace app {
void FileOpConfig::fillFromPreferences()
{
preserveColorProfile = Preferences::instance().color.manage();
filesWithProfile = Preferences::instance().color.filesWithProfile();
missingProfile = Preferences::instance().color.missingProfile();
newBlend = Preferences::instance().experimental.newBlend();
defaultSliceColor = Preferences::instance().slices.defaultColor();
auto& pref = Preferences::instance();
preserveColorProfile = pref.color.manage();
filesWithProfile = pref.color.filesWithProfile();
missingProfile = pref.color.missingProfile();
newBlend = pref.experimental.newBlend();
defaultSliceColor = pref.slices.defaultColor();
workingCS = get_working_rgb_space_from_preferences();
rgbMapAlgorithm = Preferences::instance().quantization.rgbmapAlgorithm();
rgbMapAlgorithm = pref.quantization.rgbmapAlgorithm();
}
} // namespace app