Bug 227538

Summary: Use vImage for WebGL toDataURL image y-flip
Product: WebKit Reporter: Kimmo Kinnunen <kkinnunen>
Component: WebGLAssignee: 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:    

Kimmo Kinnunen
Reported 2021-06-30 11:00:32 PDT
Use vImage for WebGL toDataURL image y-flip Came up in bug 223920 review
Attachments
Kimmo Kinnunen
Comment 1 2021-06-30 11:01:35 PDT
Sam, do you have a suggestion how to expose this through the layers so that it's consistent with PixelBufferConversion.h API
Said Abou-Hallawa
Comment 2 2021-06-30 12:43:17 PDT
Came up in bug 156129 review.
Sam Weinig
Comment 3 2021-07-01 10:32:02 PDT
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.
Said Abou-Hallawa
Comment 4 2021-07-01 11:14:14 PDT
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;
Sam Weinig
Comment 5 2021-07-01 12:36:51 PDT
(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).
Radar WebKit Bug Importer
Comment 6 2021-07-07 11:01:18 PDT
Note You need to log in before you can comment on or make changes to this bug.