Fixed Undoable::background_from_layer when the layer to be converted to background has empty cels.

This commit is contained in:
David Capello 2009-11-18 15:24:02 +00:00
parent e4dd1905fb
commit 0e0dacb158

View File

@ -468,6 +468,22 @@ void Undoable::background_from_layer(LayerImage* layer, int bgcolor)
}
}
// Fill all empty cels with a flat-image filled with bgcolor
for (int frame=0; frame<m_sprite->frames; frame++) {
Cel* cel = layer->get_cel(frame);
if (!cel) {
Image* cel_image = image_new(m_sprite->imgtype, m_sprite->w, m_sprite->h);
image_clear(cel_image, bgcolor);
// Add the new image in the stock
int image_index = add_image_in_stock(cel_image);
// Create the new cel and add it to the new background layer
cel = cel_new(frame, image_index);
add_cel(layer, cel);
}
}
configure_layer_as_background(layer);
}