From 4e6e50194e2458dd4701ed15468cb697dffe8d68 Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 12 Sep 2014 01:58:33 -0300 Subject: [PATCH] Remove bgcolor param from DocumentApi::backgroundFromLayer() --- src/app/commands/cmd_background_from_layer.cpp | 12 +----------- src/app/document_api.cpp | 10 +++++----- src/app/document_api.h | 2 +- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/app/commands/cmd_background_from_layer.cpp b/src/app/commands/cmd_background_from_layer.cpp index 6317eedeb..bb916f46c 100644 --- a/src/app/commands/cmd_background_from_layer.cpp +++ b/src/app/commands/cmd_background_from_layer.cpp @@ -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(writer.layer()), - bgcolor); + static_cast(writer.layer())); undo_transaction.commit(); } diff --git a/src/app/document_api.cpp b/src/app/document_api.cpp index 1cb8dcdaa..a8e42216d 100644 --- a/src/app/document_api.cpp +++ b/src/app/document_api.cpp @@ -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); diff --git a/src/app/document_api.h b/src/app/document_api.h index 7165a22f8..3ecec6136 100644 --- a/src/app/document_api.h +++ b/src/app/document_api.h @@ -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);