MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / duplicateLayerAfter

Method duplicateLayerAfter

src/app/document_api.cpp:460–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458}
459
460void DocumentApi::duplicateLayerAfter(Layer* sourceLayer, Layer* afterLayer)
461{
462 std::unique_ptr<LayerImage> newLayerPtr(new LayerImage(sourceLayer->sprite()));
463
464 m_document->copyLayerContent(sourceLayer, m_document, newLayerPtr.get());
465
466 newLayerPtr->setName(newLayerPtr->name() + " Copy");
467
468 addLayer(sourceLayer->parent(), newLayerPtr.get(), afterLayer);
469
470 // Release the pointer as it is owned by the sprite now.
471 newLayerPtr.release();
472}
473
474void DocumentApi::duplicateLayerBefore(Layer* sourceLayer, Layer* beforeLayer)
475{

Callers 2

drop_range_opFunction · 0.80
onExecuteMethod · 0.80

Calls 7

copyLayerContentMethod · 0.80
spriteMethod · 0.45
getMethod · 0.45
setNameMethod · 0.45
nameMethod · 0.45
parentMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected