-
-
Notifications
You must be signed in to change notification settings - Fork 791
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
Use Skia for 2D canvas, SVG, CSS borders, etc. #1024
Merged
awesomekling
merged 17 commits into
LadybirdBrowser:master
from
awesomekling:new_painter
Aug 20, 2024
Merged
Use Skia for 2D canvas, SVG, CSS borders, etc. #1024
awesomekling
merged 17 commits into
LadybirdBrowser:master
from
awesomekling:new_painter
Aug 20, 2024
Conversation
This file contains 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
awesomekling
force-pushed
the
new_painter
branch
from
August 10, 2024 09:49
6fd3847
to
3b80beb
Compare
4 tasks
awesomekling
force-pushed
the
new_painter
branch
12 times, most recently
from
August 19, 2024 12:00
0fbc789
to
fa33155
Compare
This new painter is written with a virtual interface from the start, and we begin with a Skia backend. This patch adds enough to support our basic 2D HTML canvas usecase.
This thing is essentially a wrapper around an SkPath, although we do some indirection via a PathImpl class to keep the door open for alternative rasterizer/path backends in the future. We also update the 2D canvas code, since that was the only code that used Painter+DeprecatedPath, and this allows us to just drop that code instead of temporarily supporting it until the next commit.
SVG and and CSS border rendering now sits on top of SkPath instead of the old Gfx::DeprecatedPath. Due to an imperceptible (255, 255, 255) vs (255, 254, 255) color diff in one ref test, I changed that test to not depend on border rendering for a positive result, since that was incidental.
We're not quite ready to remove the old OpenType implementation yet, but let's carve off some unused stuff.
Now that the underlying Gfx::Painter is being transformed as we go, we don't need to pre-emptively transform geometry before painting it.
This ensures that any internal state maintained by the painter gets synchronized appropriately.
The CRC2D path should be unaffected by the CRC2D transform changing. To achieve this, we transform the path to compensate whenever the CRC2D transform is changed.
This allows us to get identical metrics on macOS and Linux. Without this, Skia will use CoreText on macOS and give us slightly different text metrics. That causes layout tests to be slightly different on different platforms, which is a huge headache. So let's not do that. You can now launch Ladybird and headless-browser with --force-fontconfig to load fonts through fontconfig. Tests run in this mode by default.
awesomekling
force-pushed
the
new_painter
branch
from
August 19, 2024 18:40
fa33155
to
cd6e700
Compare
This was referenced Aug 20, 2024
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.
This PR renames
Gfx::Painter
andGfx::Path
toDeprecatedPainter
andDeprecatedPath
respectively.We then introduce new
Gfx::Painter
andGfx::Path
classes that sit on top of Skia. They both have virtual internals, to keep the door open for using other rasterizers.2D canvas, SVG and CSS code that uses path rendering is moved on top of the new classes, giving us a solid performance boost.
Finally, we yeet a bunch of now-unused code from LibGfx. We still need some of the OpenType font code for text layout, but that will eventually go as well.