<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>227538</bug_id>
          
          <creation_ts>2021-06-30 11:00:32 -0700</creation_ts>
          <short_desc>Use vImage for WebGL toDataURL image y-flip</short_desc>
          <delta_ts>2021-07-07 11:01:18 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebGL</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>ASSIGNED</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=156129</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>227539</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kimmo Kinnunen">kkinnunen</reporter>
          <assigned_to name="Kimmo Kinnunen">kkinnunen</assigned_to>
          <cc>dino</cc>
    
    <cc>kbr</cc>
    
    <cc>kkinnunen</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>sam</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1773816</commentid>
    <comment_count>0</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2021-06-30 11:00:32 -0700</bug_when>
    <thetext>Use vImage for WebGL toDataURL image y-flip

Came up in bug 223920 review</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1773817</commentid>
    <comment_count>1</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2021-06-30 11:01:35 -0700</bug_when>
    <thetext>Sam, do you have a suggestion how to expose this through the layers so that it&apos;s consistent with PixelBufferConversion.h API</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1773858</commentid>
    <comment_count>2</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2021-06-30 12:43:17 -0700</bug_when>
    <thetext>Came up in bug 156129 review.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1774157</commentid>
    <comment_count>3</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2021-07-01 10:32:02 -0700</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1774175</commentid>
    <comment_count>4</comment_count>
    <who name="Said Abou-Hallawa">sabouhallawa</who>
    <bug_when>2021-07-01 11:14:14 -0700</bug_when>
    <thetext>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-&gt;yFlipped();
    return std::nullopt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1774213</commentid>
    <comment_count>5</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2021-07-01 12:36:51 -0700</bug_when>
    <thetext>(In reply to Said Abou-Hallawa from comment #4)
&gt; Or you add the following function to PixelBuffer:
&gt; 
&gt;     PixelBuffer yFlipped() const;
&gt; 
&gt; And the code in
&gt; GraphicsContextGLOpenGL::paintRenderingResultsToPixelBuffer() can look like
&gt; this:
&gt; 
&gt;     if (auto results = readRenderingResultsForPainting())
&gt;         return results-&gt;yFlipped();
&gt;     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).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1775338</commentid>
    <comment_count>6</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-07-07 11:01:18 -0700</bug_when>
    <thetext>&lt;rdar://problem/80279046&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>