| Summary: | Use vImage for WebGL toDataURL image y-flip | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Kimmo Kinnunen <kkinnunen> |
| Component: | WebGL | Assignee: | Kimmo Kinnunen <kkinnunen> |
| Status: | ASSIGNED --- | ||
| Severity: | Normal | CC: | dino, kbr, kkinnunen, sabouhallawa, sam, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Local Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=156129 | ||
| Bug Depends on: | 227539 | ||
| Bug Blocks: | |||
|
Description
Kimmo Kinnunen
2021-06-30 11:00:32 PDT
Sam, do you have a suggestion how to expose this through the layers so that it's consistent with PixelBufferConversion.h API Came up in bug 156129 review. I think my best idea is that instead of flipping at all we should see if we can just pass the flipped PixelBuffer to data() and dataURL() (with some indication it is flipped, maybe a new FlippedPixelBuffer type) and have the code that actually encodes the data and use a custom CGDataProvider to feed the data row by row backwards. Or you add the following function to PixelBuffer:
PixelBuffer yFlipped() const;
And the code in GraphicsContextGLOpenGL::paintRenderingResultsToPixelBuffer() can look like this:
if (auto results = readRenderingResultsForPainting())
return results->yFlipped();
return std::nullopt;
(In reply to Said Abou-Hallawa from comment #4) > Or you add the following function to PixelBuffer: > > PixelBuffer yFlipped() const; > > And the code in > GraphicsContextGLOpenGL::paintRenderingResultsToPixelBuffer() can look like > this: > > if (auto results = readRenderingResultsForPainting()) > return results->yFlipped(); > return std::nullopt; I think rather than adding members to PixelBuffer, I would prefer a free function like in PixelBufferConversion.h that takes a PixelBufferConversionView (perhaps renamed to PixelBufferView). |