NatronGitHub / Natron

Open-source video compositing software. Node-graph based. Similar in functionalities to Adobe After Effects and Nuke by The Foundry.
http://NatronGitHub.github.io
GNU General Public License v2.0
4.64k stars 338 forks source link

Refactor RenderScale #920

Closed acolwell closed 1 year ago

acolwell commented 1 year ago

Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. Additionally, make sure you've done all of these things:

PR Description

What type of PR is this? (Check one of the boxes below)

What does this pull request do?

This change refactors RenderScale so that much of the code that uses it is much simpler. It also makes it much more explicit that Natron does not actually allow/support the x & y scale to be different from each other. Functionally this should be equivalent to the existing code and no new functionality was added.

Have you tested your changes (if applicable)? If so, how?

Yes. I've tested this locally with a few project files. The unit tests all pass locally and in the GitHub Actions.

Futher details of this pull request

This came about mainly from me trying to understand why mipmapLevels and RenderScales were being passed around to different APIs and sometimes both were passed together. There also appeared to be more conversions to/from mipmapLevel then actual use of the doubles so it seemed to make sense to just convert the underlying representation to the mipmapLevel. I suspect further simplifications can be made in follow up changes and some usage of RenderScale can go away or be replaced with the equivalent mipmapLevel parameter. This change was just intended to leave the existing abstraction in place, but make the API more explicit and constrained.