Implement recursive bezier curve subdivision algorithm #22
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.
This PR implements a recursive subdivision algorithm for Direct2D (d2d1.dll) which corrects the rendering of pen paths. Wine upstream does not support cubic beziers, only quadratic beziers. This algorithm subdivides cubic beziers into smaller segments which can be approximated using quadratic beziers.
The accuracy of the subdivison algorithm can be adjusted by changing various parameters, a middle-ground between accuracy and performance was chosen for now, leaning towards performance. There are no visual artifacts with the chosen values (as far as my own eye can see). In the future there will be some form of quality slider to allow the user to adjust this balance themselves. It would also be ideal to add an OpenCL implementation in the future for users who have it working.
In lieu of native code patching (planned for a future release), a binary copy of d2d1.dll will be included in the WineFix distribution archives to be placed next to Affinity.exe to be loaded through normal DLL shadowing.
Source code for the d2d1.dll has been isolated and new build scripts were created to build only d2d1.dll without needing the entire Wine source. This is under WineFix/lib/d2d1 and is the source code that will be used to build the copy of d2d1.dll which will be included in the release. The only relevant file that was changed to implement the subdivison algorithm is
geometry.c, any other changes are only to support the new build scripts in the isolated environment.Since this is a change in the Wine runner, I'll open PRs on ElementalWarrior Wine and GameDirection Wine forks to incorporate this higher up. I'll also consider upstreaming to wine-staging, but no promises.
Resolves #8