Bug 227538 - Use vImage for WebGL toDataURL image y-flip
Summary: Use vImage for WebGL toDataURL image y-flip
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kimmo Kinnunen
URL:
Keywords: InRadar
Depends on: 227539
Blocks:
  Show dependency treegraph
 
Reported: 2021-06-30 11:00 PDT by Kimmo Kinnunen
Modified: 2021-07-07 11:01 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kimmo Kinnunen 2021-06-30 11:00:32 PDT
Use vImage for WebGL toDataURL image y-flip

Came up in bug 223920 review
Comment 1 Kimmo Kinnunen 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
Comment 2 Said Abou-Hallawa 2021-06-30 12:43:17 PDT
Came up in bug 156129 review.
Comment 3 Sam Weinig 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.
Comment 4 Said Abou-Hallawa 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;
Comment 5 Sam Weinig 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).
Comment 6 Radar WebKit Bug Importer 2021-07-07 11:01:18 PDT
<rdar://problem/80279046>