mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-15 20:42:40 +00:00
Remove DocumentApi::setPixelFormat() member function
This commit is contained in:
parent
16aeae0833
commit
5c07f86a66
@ -9,10 +9,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
|
#include "app/cmd/set_pixel_format.h"
|
||||||
#include "app/commands/command.h"
|
#include "app/commands/command.h"
|
||||||
#include "app/commands/params.h"
|
#include "app/commands/params.h"
|
||||||
#include "app/context_access.h"
|
#include "app/context_access.h"
|
||||||
#include "app/document_api.h"
|
|
||||||
#include "app/modules/editors.h"
|
#include "app/modules/editors.h"
|
||||||
#include "app/modules/gui.h"
|
#include "app/modules/gui.h"
|
||||||
#include "app/modules/palettes.h"
|
#include "app/modules/palettes.h"
|
||||||
@ -367,13 +367,17 @@ void ChangePixelFormatCommand::onExecute(Context* context)
|
|||||||
m_dithering = window.ditheringAlgorithm();
|
m_dithering = window.ditheringAlgorithm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No conversion needed
|
||||||
|
if (context->activeDocument()->sprite()->pixelFormat() == m_format)
|
||||||
|
return;
|
||||||
|
|
||||||
{
|
{
|
||||||
ContextWriter writer(context);
|
ContextWriter writer(context);
|
||||||
Transaction transaction(writer.context(), "Color Mode Change");
|
Transaction transaction(writer.context(), "Color Mode Change");
|
||||||
Document* document(writer.document());
|
Document* document(writer.document());
|
||||||
Sprite* sprite(writer.sprite());
|
Sprite* sprite(writer.sprite());
|
||||||
|
|
||||||
document->getApi(transaction).setPixelFormat(sprite, m_format, m_dithering);
|
transaction.execute(new cmd::SetPixelFormat(sprite, m_format, m_dithering));
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
#include "app/cmd/set_mask.h"
|
#include "app/cmd/set_mask.h"
|
||||||
#include "app/cmd/set_mask_position.h"
|
#include "app/cmd/set_mask_position.h"
|
||||||
#include "app/cmd/set_palette.h"
|
#include "app/cmd/set_palette.h"
|
||||||
#include "app/cmd/set_pixel_format.h"
|
|
||||||
#include "app/cmd/set_slice_key.h"
|
#include "app/cmd/set_slice_key.h"
|
||||||
#include "app/cmd/set_sprite_size.h"
|
#include "app/cmd/set_sprite_size.h"
|
||||||
#include "app/cmd/set_total_frames.h"
|
#include "app/cmd/set_total_frames.h"
|
||||||
@ -55,8 +54,8 @@
|
|||||||
#include "doc/frame_tag.h"
|
#include "doc/frame_tag.h"
|
||||||
#include "doc/frame_tags.h"
|
#include "doc/frame_tags.h"
|
||||||
#include "doc/mask.h"
|
#include "doc/mask.h"
|
||||||
|
#include "doc/palette.h"
|
||||||
#include "doc/slice.h"
|
#include "doc/slice.h"
|
||||||
#include "render/quantization.h"
|
|
||||||
#include "render/render.h"
|
#include "render/render.h"
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -181,16 +180,6 @@ void DocumentApi::trimSprite(Sprite* sprite)
|
|||||||
cropSprite(sprite, bounds);
|
cropSprite(sprite, bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DocumentApi::setPixelFormat(Sprite* sprite,
|
|
||||||
const PixelFormat newFormat,
|
|
||||||
const render::DitheringAlgorithm dithering)
|
|
||||||
{
|
|
||||||
if (sprite->pixelFormat() == newFormat)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_transaction.execute(new cmd::SetPixelFormat(sprite, newFormat, dithering));
|
|
||||||
}
|
|
||||||
|
|
||||||
void DocumentApi::addFrame(Sprite* sprite, frame_t newFrame)
|
void DocumentApi::addFrame(Sprite* sprite, frame_t newFrame)
|
||||||
{
|
{
|
||||||
copyFrame(sprite, newFrame-1, newFrame);
|
copyFrame(sprite, newFrame-1, newFrame);
|
||||||
|
@ -12,9 +12,7 @@
|
|||||||
#include "doc/color.h"
|
#include "doc/color.h"
|
||||||
#include "doc/frame.h"
|
#include "doc/frame.h"
|
||||||
#include "doc/image_ref.h"
|
#include "doc/image_ref.h"
|
||||||
#include "doc/pixel_format.h"
|
|
||||||
#include "gfx/rect.h"
|
#include "gfx/rect.h"
|
||||||
#include "render/dithering_algorithm.h"
|
|
||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
class Cel;
|
class Cel;
|
||||||
@ -46,9 +44,6 @@ namespace app {
|
|||||||
void setSpriteTransparentColor(Sprite* sprite, color_t maskColor);
|
void setSpriteTransparentColor(Sprite* sprite, color_t maskColor);
|
||||||
void cropSprite(Sprite* sprite, const gfx::Rect& bounds);
|
void cropSprite(Sprite* sprite, const gfx::Rect& bounds);
|
||||||
void trimSprite(Sprite* sprite);
|
void trimSprite(Sprite* sprite);
|
||||||
void setPixelFormat(Sprite* sprite,
|
|
||||||
const PixelFormat newFormat,
|
|
||||||
const render::DitheringAlgorithm dithering);
|
|
||||||
|
|
||||||
// Frames API
|
// Frames API
|
||||||
void addFrame(Sprite* sprite, frame_t newFrame);
|
void addFrame(Sprite* sprite, frame_t newFrame);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user