// Aseprite Document Library // Copyright (c) 2023 Igara Studio S.A. // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "doc/render_plan.h" #include "doc/cel.h" #include "doc/layer.h" #include #include namespace doc { RenderPlan::RenderPlan() { } void RenderPlan::addLayer(const Layer* layer, const frame_t frame) { // We cannot add new layers after using processZIndexes()/modified // m_items array using z-indexes. ASSERT(m_processZIndex == true); ++m_order; // We can't read this layer if (!layer->isVisible()) return; if (layer->isGroup() && !m_composeGroups) { for (auto *const child : static_cast(layer)->layers()) { addLayer(child, frame); } } else { m_items.emplace_back(m_order, layer, layer->cel(frame)); } } void RenderPlan::processZIndexes() const { m_processZIndex = false; // If all cels has a z-index = 0, we can just use the m_items as it is bool noZIndex = true; for (int i=0; i