Remove bgcolor param from DocumentApi::backgroundFromLayer()

This commit is contained in:
David Capello 2014-09-12 01:58:33 -03:00
parent 972b2f8ff7
commit 4e6e50194e
3 changed files with 7 additions and 17 deletions

View File

@ -20,7 +20,6 @@
#include "config.h"
#endif
#include "app/color_utils.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document_api.h"
@ -68,19 +67,10 @@ void BackgroundFromLayerCommand::onExecute(Context* context)
Document* document(writer.document());
Sprite* sprite(writer.sprite());
raster::color_t bgcolor =
color_utils::color_for_target(
context->settings()->getBgColor(),
ColorTarget(
ColorTarget::BackgroundLayer,
sprite->pixelFormat(),
sprite->transparentColor()));
{
UndoTransaction undo_transaction(writer.context(), "Background from Layer");
document->getApi().backgroundFromLayer(
static_cast<LayerImage*>(writer.layer()),
bgcolor);
static_cast<LayerImage*>(writer.layer()));
undo_transaction.commit();
}

View File

@ -950,7 +950,7 @@ void DocumentApi::displaceLayers(Layer* layer, int dx, int dy)
}
}
void DocumentApi::backgroundFromLayer(LayerImage* layer, color_t bgcolor)
void DocumentApi::backgroundFromLayer(LayerImage* layer)
{
ASSERT(layer);
ASSERT(layer->isImage());
@ -960,6 +960,7 @@ void DocumentApi::backgroundFromLayer(LayerImage* layer, color_t bgcolor)
ASSERT(layer->sprite()->backgroundLayer() == NULL);
Sprite* sprite = layer->sprite();
color_t bgcolor = bgColor();
// create a temporary image to draw each frame of the new
// `Background' layer
@ -980,10 +981,9 @@ void DocumentApi::backgroundFromLayer(LayerImage* layer, color_t bgcolor)
clear_image(bg_image, bgcolor);
composite_image(bg_image, cel_image,
cel->x(),
cel->y(),
MID(0, cel->opacity(), 255),
layer->getBlendMode());
cel->x(), cel->y(),
MID(0, cel->opacity(), 255),
layer->getBlendMode());
// now we have to copy the new image (bg_image) to the cel...
setCelPosition(sprite, cel, 0, 0);

View File

@ -101,7 +101,7 @@ namespace app {
void restackLayerBefore(Layer* layer, Layer* beforeThis);
void cropLayer(Layer* layer, int x, int y, int w, int h, color_t bgcolor);
void displaceLayers(Layer* layer, int dx, int dy);
void backgroundFromLayer(LayerImage* layer, color_t bgcolor);
void backgroundFromLayer(LayerImage* layer);
void layerFromBackground(Layer* layer);
void flattenLayers(Sprite* sprite, color_t bgcolor);
void duplicateLayerAfter(Layer* sourceLayer, Layer* afterLayer);