Use the new Surface::applyScale()

This commit is contained in:
David Capello 2025-03-03 16:42:03 -03:00
parent be6d2251aa
commit da5909639b
3 changed files with 7 additions and 15 deletions

2
laf

@ -1 +1 @@
Subproject commit 65829107c838817987f3cf6374cc68c583e5d538 Subproject commit db9cb0de00067e34139c6f8ff4847cd572d68b31

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2018-2024 Igara Studio S.A. // Copyright (C) 2018-2025 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello // Copyright (C) 2001-2018 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
@ -514,7 +514,7 @@ os::SurfaceRef BrushPopup::createSurfaceForBrush(const BrushRef& origBrush,
if (image->pixelFormat() == IMAGE_BITMAP) if (image->pixelFormat() == IMAGE_BITMAP)
delete palette; delete palette;
surface->applyScale(guiscale()); surface = surface->applyScale(guiscale());
} }
else { else {
surface->clear(); surface->clear();

View File

@ -385,18 +385,10 @@ void SkinTheme::loadSheet()
if (!newSheet) if (!newSheet)
throw base::Exception("Error loading %s file", sheet_filename.c_str()); throw base::Exception("Error loading %s file", sheet_filename.c_str());
// TODO Change os::Surface::applyScale() to return a new surface, // Set the unscaled and scaled version of the sprite sheet.
// avoid loading two times the same file (even more, if there m_unscaledSheet = newSheet;
// is no scale to apply, m_unscaledSheet must reference the m_unscaledSheet->setImmutable();
// same m_sheet). m_sheet = newSheet->applyScale(guiscale());
m_unscaledSheet = system->loadRgbaSurface(sheet_filename.c_str());
// Replace the sprite sheet
if (m_sheet)
m_sheet.reset();
m_sheet = newSheet;
if (m_sheet)
m_sheet->applyScale(guiscale());
m_sheet->setImmutable(); m_sheet->setImmutable();
// Reset sprite sheet and font of all layer styles (to avoid // Reset sprite sheet and font of all layer styles (to avoid