-
Notifications
You must be signed in to change notification settings - Fork 806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CGD2D] Draw primitives with Porter-Duff blend modes #1389
Comments
rajsesh
changed the title
[CGD2D] Draw primitives with blend modes (composite only).
[CGD2D] Draw primitives with blend modes (composite only, porter-def and clear).
Nov 18, 2016
Still have some open issues here that need to be sorted out. May not be required for merge back to develop. |
DHowett-MSFT
changed the title
[CGD2D] Draw primitives with blend modes (composite only, porter-def and clear).
[CGD2D] Draw primitives with Porter-Duff blend modes
Mar 2, 2017
DHowett-MSFT
pushed a commit
that referenced
this issue
Mar 15, 2017
This pull request adds support for blending to CGContext. There are a number of caveats. * `kCGBlendModeClear` is not supported. * The *Source In*, *Destination In*, *Source Out*, *Destination Atop*, and *Source Copy* blend modes cannot be used properly without transparency layers. Their use per-primitive will result in unusual artifacts. * `kCGBlendModePlusDarker` is not supported (and was not supported in the original Cairo implementation). Some blend modes (the ones without Source/Destination) in the name require a full buffer read-back and compose operation. This is unavoidable. This change unfortunately _does_ include a rewrite of the CGD2D rendering stack. Instead of adding yet another nesting level of command lists and layers, I switched it to a scaffold/commit stack. Depending on various conditions, operations will be queued up, started in order, and committed in reverse order. A great many of those operations involve creating command lists and layers and blending them or otherwise composing them. There is a not-insignificant performance penalty in certain cases: | before after delta | CoreText__CTLineDrawComplete 742.51 716.11 -3.5546% faster | | CoreText__CTLineDrawGroup 292,909 307,828 5.0934% slower | | CoreText__CTLineDrawSingle 233.43 280.05 19.9746% slower | times in μs. While 19% seems like a lot, it's only 47μs/operation; an application running at 60fps requires its rendering operations complete in ~16000μs. It's not _significant_, but it is a cost taken per operation. I believe there is opportunity for improvement; specifically, I had to compromise on allocations to achieve the desired effects of polymorphism in the new render operation stack. Fixes #1389.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Direct2D supports a subset of CG's blend modes as direct composition modes, and a subset of CG's porter-duff blend modes with its blend effect.
The blend effect, however, requires a full target readback and recompose.
The scope of this issue is to support only the basic non-blend-effect composition modes for 1611.
The text was updated successfully, but these errors were encountered: