mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-26 12:35:33 +00:00
Simplify DocumentApi::clearMask(): we just need the "cel" param
This commit is contained in:
parent
4e6e50194e
commit
77a66c1b87
@ -99,8 +99,7 @@ void ClearCommand::onExecute(Context* context)
|
||||
{
|
||||
UndoTransaction undoTransaction(writer.context(), "Clear");
|
||||
DocumentApi api = document->getApi();
|
||||
api.clearMask(writer.layer(), writer.cel(),
|
||||
app_get_color_to_clear_layer(writer.layer()));
|
||||
api.clearMask(writer.cel());
|
||||
if (visibleMask)
|
||||
api.deselectMask();
|
||||
|
||||
|
@ -1200,16 +1200,17 @@ void DocumentApi::clearImage(Image* image, color_t bgcolor)
|
||||
}
|
||||
|
||||
// Clears the mask region in the current sprite with the specified background color.
|
||||
void DocumentApi::clearMask(Layer* layer, Cel* cel, color_t bgcolor)
|
||||
void DocumentApi::clearMask(Cel* cel)
|
||||
{
|
||||
ASSERT(cel);
|
||||
ASSERT(layer == cel->layer());
|
||||
|
||||
Image* image = (cel ? cel->image(): NULL);
|
||||
if (!image)
|
||||
return;
|
||||
|
||||
Layer* layer = cel->layer();
|
||||
Mask* mask = m_document->mask();
|
||||
color_t bgcolor = bgColor(layer);
|
||||
|
||||
// If the mask is empty or is not visible then we have to clear the
|
||||
// entire image in the cel.
|
||||
@ -1222,7 +1223,7 @@ void DocumentApi::clearMask(Layer* layer, Cel* cel, color_t bgcolor)
|
||||
// associated image).
|
||||
else {
|
||||
ASSERT(layer->isImage());
|
||||
removeCel(static_cast<LayerImage*>(layer), cel);
|
||||
removeCel(cel);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -115,7 +115,7 @@ namespace app {
|
||||
|
||||
// Image API
|
||||
void clearImage(Image* image, color_t bgcolor);
|
||||
void clearMask(Layer* layer, Cel* cel, color_t bgcolor);
|
||||
void clearMask(Cel* cel);
|
||||
void flipImage(Image* image, const gfx::Rect& bounds, raster::algorithm::FlipType flipType);
|
||||
void flipImageWithMask(Image* image, const Mask* mask, raster::algorithm::FlipType flipType, color_t bgcolor);
|
||||
void pasteImage(Sprite* sprite, Cel* cel, const Image* src_image, int x, int y, int opacity);
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "app/ui/editor/pixels_movement.h"
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/document.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/modules/gui.h"
|
||||
@ -119,8 +118,7 @@ void PixelsMovement::cutMask()
|
||||
{
|
||||
ContextWriter writer(m_reader);
|
||||
if (writer.cel())
|
||||
m_document->getApi().clearMask(m_layer, writer.cel(),
|
||||
app_get_color_to_clear_layer(m_layer));
|
||||
m_document->getApi().clearMask(writer.cel());
|
||||
}
|
||||
|
||||
copyMask();
|
||||
|
@ -193,8 +193,7 @@ void clipboard::cut(ContextWriter& writer)
|
||||
UndoTransaction undoTransaction(writer.context(), "Cut");
|
||||
DocumentApi api(writer.document()->getApi());
|
||||
|
||||
api.clearMask(writer.layer(), writer.cel(),
|
||||
app_get_color_to_clear_layer(writer.layer()));
|
||||
api.clearMask(writer.cel());
|
||||
api.deselectMask();
|
||||
|
||||
undoTransaction.commit();
|
||||
|
Loading…
x
Reference in New Issue
Block a user