Bug 227538
| 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: | |||
          Kimmo Kinnunen
          
          
          
          
        
        
      Use vImage for WebGL toDataURL image y-flip
Came up in bug 223920 review
    | Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. | 
          Kimmo Kinnunen
          
          
          
          
        
        
      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
          
          
          
          
        
        
      Came up in bug 156129 review.
    
          Sam Weinig
          
          
          
          
        
        
      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
          
          
          
          
        
        
      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
          
          
          
          
        
        
      (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
          
          
          
          
        
        
      <rdar://problem/80279046>