🐛 Clear the transform effect's scratch canvas between frames - #363
Merged
Merged
Conversation
The scratch canvas is only reset when the target is resized, so on a steady-size movie it is never cleared. drawImage composites source-over, so the previous transformed frame survived wherever the current one was transparent and was copied back onto the target, leaving a trail behind a moving layer. Clear it before compositing, resetting the transform to identity first so the clear is not mapped through the last frame's matrix. That reset replaces the one at the end of apply, whose arguments were in the wrong order: setTransform(1, 0, 0, 0, 1, 0) has d = 0, so it was degenerate rather than identity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #286.
The scratch canvas the effect composites through is only reset when the target is resized, so on a steady-size movie it's never cleared.
drawImagecomposites source-over, so the previous transformed frame survives wherever the current one is transparent and gets copied back onto the target — the trail @keiddzz reported.This clears the scratch canvas before compositing, resetting the transform to identity first so the clear isn't mapped through the last frame's matrix. That reset replaces the one that was at the end of
apply, whose arguments were in the wrong order:setTransform(1, 0, 0, 0, 1, 0)hasd = 0, so it was degenerate rather than identity.Added a unit test that applies the effect over two frames and asserts the old position is empty — it fails on master and passes here. I also reproduced @keiddzz's setup end to end (an
Imagelayer with a keyframed matrix, rendered across four frames) and confirmed the trail is gone. Existing unit, smoke and integration suites all pass.