| Summary: | SVG images drawn onto display-p3 canvas are flattened to sRGB | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Cameron McCormack (:heycam) <heycam> | ||||||||
| Component: | Canvas | Assignee: | Cameron McCormack (:heycam) <heycam> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Normal | CC: | cdumez, changseok, clopez, dino, eric.carlson, esprehn+autocc, ews-watchlist, fmalita, glenn, gyuyoung.kim, jer.noble, pdr, philipj, sabouhallawa, schenney, sergio, simon.fraser, webkit-bug-importer, youennf | ||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||
| Version: | WebKit Local Build | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| See Also: |
https://github.com/web-platform-tests/wpt/pull/31108 https://bugs.webkit.org/show_bug.cgi?id=227748 |
||||||||||
| Bug Depends on: | |||||||||||
| Bug Blocks: | 225140 | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Cameron McCormack (:heycam)
2021-09-30 22:03:16 PDT
We draw the SVG image into a NativeImage so it can be sent to the GPU process. Created attachment 439822 [details]
Patch
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess Comment on attachment 439822 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=439822&action=review > Source/WebCore/platform/graphics/GraphicsContext.h:433 > + virtual ImageDrawResult drawImageForCanvas(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&, DestinationColorSpace canvasColorSpace); Not a fan of "for canvas" down here in GraphicsContext. Can we just an std::optional<DestinationColorSpace> to an existing function? > Source/WebCore/svg/graphics/SVGImage.h:102 > + ImageDrawResult drawForCanvas(GraphicsContext&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&, DestinationColorSpace) final; > + ImageDrawResult drawAsNativeImage(GraphicsContext&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&, DestinationColorSpace); > ImageDrawResult drawForContainer(GraphicsContext&, const FloatSize containerSize, float containerZoom, const URL& initialFragmentURL, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }); > + ImageDrawResult drawForContainerInternal(GraphicsContext&, const FloatSize containerSize, float containerZoom, const URL& initialFragmentURL, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions&, DestinationColorSpace); > + ImageDrawResult drawInternal(GraphicsContext&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&, DestinationColorSpace); > + ImageDrawResult drawForCanvasForContainer(GraphicsContext&, const FloatSize containerSize, float containerZoom, const URL& initialFragmentURL, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions&, DestinationColorSpace); That's quite a bit of proliferation too. Can std::optional<DestinationColorSpace> help? (In reply to Simon Fraser (smfr) from comment #5) > Can we just an std::optional<DestinationColorSpace> to an existing function? That was my first thought. There were many subclasses to add that to. Maybe that's better than adding the separate functions here. Created attachment 439920 [details]
Patch with Image::draw / GraphicsContext::drawImage argument
There's a version of the patch with a std::optional<DestinationColorSpace> argument. And I could be convinced not to make it optional (or std::optional<>) so that all drawImage/draw callers have to pass in an intermediate color space. Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/31108 Created attachment 440139 [details]
Patch
Committed r283531 (242497@main): <https://commits.webkit.org/242497@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 440139 [details]. |