mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-30 04:20:23 +00:00
Always show transformation preview on Preview window
Fix regression from cd5bf499eab932061b10a8f0a22d6781e099c909
This commit is contained in:
parent
cd5bf499ea
commit
d073ecd9d1
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2020 Igara Studio S.A.
|
||||
// Copyright (C) 2020-2024 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -16,12 +16,14 @@
|
||||
namespace app {
|
||||
|
||||
ExtraCel::ExtraCel()
|
||||
: m_type(render::ExtraType::NONE)
|
||||
: m_purpose(Purpose::Unknown)
|
||||
, m_type(render::ExtraType::NONE)
|
||||
, m_blendMode(doc::BlendMode::NORMAL)
|
||||
{
|
||||
}
|
||||
|
||||
void ExtraCel::create(const TilemapMode tilemapMode,
|
||||
void ExtraCel::create(Purpose purpose,
|
||||
const TilemapMode tilemapMode,
|
||||
doc::Sprite* sprite,
|
||||
const gfx::Rect& bounds,
|
||||
const gfx::Size& imageSize,
|
||||
@ -30,6 +32,8 @@ void ExtraCel::create(const TilemapMode tilemapMode,
|
||||
{
|
||||
ASSERT(sprite);
|
||||
|
||||
m_purpose = purpose;
|
||||
|
||||
doc::PixelFormat pixelFormat;
|
||||
if (tilemapMode == TilemapMode::Tiles)
|
||||
pixelFormat = doc::IMAGE_TILEMAP;
|
||||
@ -60,6 +64,7 @@ void ExtraCel::create(const TilemapMode tilemapMode,
|
||||
|
||||
void ExtraCel::reset()
|
||||
{
|
||||
m_purpose = Purpose::Unknown;
|
||||
m_type = render::ExtraType::NONE;
|
||||
m_image.reset();
|
||||
m_cel.reset();
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2019-2020 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
|
||||
@ -29,9 +29,16 @@ namespace app {
|
||||
|
||||
class ExtraCel {
|
||||
public:
|
||||
enum class Purpose {
|
||||
Unknown,
|
||||
BrushPreview,
|
||||
TransformationPreview,
|
||||
};
|
||||
|
||||
ExtraCel();
|
||||
|
||||
void create(const TilemapMode tilemapMode,
|
||||
void create(Purpose purpose,
|
||||
const TilemapMode tilemapMode,
|
||||
doc::Sprite* sprite,
|
||||
const gfx::Rect& bounds,
|
||||
const gfx::Size& imageSize,
|
||||
@ -39,6 +46,8 @@ namespace app {
|
||||
const int opacity);
|
||||
void reset();
|
||||
|
||||
Purpose purpose() const { return m_purpose; }
|
||||
|
||||
render::ExtraType type() const { return m_type; }
|
||||
void setType(render::ExtraType type) { m_type = type; }
|
||||
|
||||
@ -49,6 +58,7 @@ namespace app {
|
||||
void setBlendMode(doc::BlendMode mode) { m_blendMode = mode; }
|
||||
|
||||
private:
|
||||
Purpose m_purpose;
|
||||
render::ExtraType m_type;
|
||||
std::unique_ptr<doc::Cel> m_cel;
|
||||
doc::ImageRef m_image;
|
||||
|
@ -351,6 +351,7 @@ void BrushPreview::show(const gfx::Point& screenPos)
|
||||
m_extraCel.reset(new ExtraCel);
|
||||
|
||||
m_extraCel->create(
|
||||
ExtraCel::Purpose::BrushPreview,
|
||||
tilemapMode,
|
||||
document->sprite(),
|
||||
extraCelBoundsInCanvas,
|
||||
|
@ -705,8 +705,16 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& sprite
|
||||
ExtraCelRef extraCel = m_document->extraCel();
|
||||
if (extraCel &&
|
||||
extraCel->type() != render::ExtraType::NONE &&
|
||||
(!m_docView->isPreview() ||
|
||||
m_docPref.show.brushPreviewInPreview())) {
|
||||
// We render the extra cel if:
|
||||
(// 1) it doesn't contains the brush preview (e.g. the user
|
||||
// is transforming the selection),
|
||||
extraCel->purpose() != ExtraCel::Purpose::BrushPreview
|
||||
// 2) we are drawing the brush preview in a regular editor,
|
||||
|| !m_docView->isPreview()
|
||||
// 3) we are drawing the brush preview in a preview editor
|
||||
// and preferences (brushPreviewInPreview) says that we
|
||||
// should do that.
|
||||
|| m_docPref.show.brushPreviewInPreview())) {
|
||||
m_renderEngine->setExtraImage(extraCel->type(),
|
||||
extraCel->cel(),
|
||||
extraCel->image(),
|
||||
|
@ -1156,6 +1156,7 @@ void PixelsMovement::redrawExtraImage(Transformation* transformation)
|
||||
}
|
||||
|
||||
m_extraCel->create(
|
||||
ExtraCel::Purpose::TransformationPreview,
|
||||
m_site.tilemapMode(),
|
||||
m_document->sprite(),
|
||||
bounds,
|
||||
|
Loading…
x
Reference in New Issue
Block a user