| 400 | } |
| 401 | |
| 402 | static void AdjustMainCompositionParam(pag::VectorComposition* newComposition, |
| 403 | pag::VideoComposition* composition, |
| 404 | std::vector<pag::Composition*>& compositions) { |
| 405 | if (compositions.size() != 1) { |
| 406 | return; |
| 407 | } |
| 408 | auto sequence = composition->sequences[0]; |
| 409 | auto factorWidth = static_cast<double>(sequence->width) / composition->width; |
| 410 | auto factorHeight = static_cast<double>(sequence->height) / composition->height; |
| 411 | auto factorSize = std::max(factorWidth, factorHeight); |
| 412 | newComposition->width = static_cast<int>(floor(newComposition->width * factorSize)); |
| 413 | newComposition->height = static_cast<int>(floor(newComposition->height * factorSize)); |
| 414 | |
| 415 | auto& transform = newComposition->layers[0]->transform; |
| 416 | transform->anchorPoint->value.x *= factorSize; |
| 417 | transform->anchorPoint->value.y *= factorSize; |
| 418 | transform->position->value.x *= factorSize; |
| 419 | transform->position->value.y *= factorSize; |
| 420 | |
| 421 | composition->width = sequence->width; |
| 422 | composition->height = sequence->height; |
| 423 | composition->frameRate = sequence->frameRate; |
| 424 | composition->duration = static_cast<pag::Frame>(sequence->frames.size()); |
| 425 | newComposition->frameRate = sequence->frameRate; |
| 426 | newComposition->duration = static_cast<pag::Frame>(sequence->frames.size()); |
| 427 | } |
| 428 | |
| 429 | static void RebuildVideoComposition(std::shared_ptr<PAGExportSession> session, |
| 430 | pag::VideoComposition* composition, |
no test coverage detected