| 178 | } |
| 179 | |
| 180 | static void AdjustTrackMatteLayer(std::shared_ptr<PAGExportSession> session) { |
| 181 | pag::ID maxID = 0; |
| 182 | std::vector<pag::Layer*> trackMatteLayers = {}; |
| 183 | for (auto& composition : session->compositions) { |
| 184 | if (composition->type() == pag::CompositionType::Vector) { |
| 185 | auto vectorComposition = static_cast<pag::VectorComposition*>(composition); |
| 186 | for (size_t i = 0; i < vectorComposition->layers.size(); i++) { |
| 187 | auto layer = vectorComposition->layers[i]; |
| 188 | maxID = std::max(maxID, layer->id); |
| 189 | if (layer->trackMatteLayer != nullptr && i > 0) { |
| 190 | trackMatteLayers.push_back(layer->trackMatteLayer); |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | } |
| 195 | for (auto layer : trackMatteLayers) { |
| 196 | maxID += 1; |
| 197 | auto itemIter = session->itemHandleMap.find(layer->id); |
| 198 | if (itemIter != session->itemHandleMap.end()) { |
| 199 | session->itemHandleMap[maxID] = itemIter->second; |
| 200 | } |
| 201 | layer->id = maxID; |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | PAGExport::PAGExport(const PAGExportConfigParam& configParam) |
| 206 | : itemHandle(configParam.activeItemHandle), |
no test coverage detected