[webkit-changes] [WebKit/WebKit] ae8167: [WebGL] WebGL contexts drawn into canvas contexts ...

Dan Glastonbury noreply at github.com
Fri Jul 21 20:43:49 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ae8167890120f40300bca996c18227adc4ca1f9a
      https://github.com/WebKit/WebKit/commit/ae8167890120f40300bca996c18227adc4ca1f9a
  Author: Dan Glastonbury <djg at apple.com>
  Date:   2023-07-21 (Fri, 21 Jul 2023)

  Changed paths:
    A LayoutTests/fast/canvas/webgl/canvas-drawImage-expected.html
    A LayoutTests/fast/canvas/webgl/canvas-drawImage.html
    A LayoutTests/fast/canvas/webgl/canvas-getImageData-expected.html
    A LayoutTests/fast/canvas/webgl/canvas-getImageData.html
    M Source/WebCore/html/HTMLCanvasElement.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.h
    M Source/WebCore/platform/graphics/GraphicsContextGL.h
    M Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp
    M Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h
    M Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp

  Log Message:
  -----------
  [WebGL] WebGL contexts drawn into canvas contexts are upside-down when premultipliedAlpha is false
https://bugs.webkit.org/show_bug.cgi?id=259306
rdar://112472666

Reviewed by Mike Wyrzykowski and Dean Jackson.

After the changes in 262518 at main, the drawing buffer no longer needs to be
flipped before creating a native image to be used by drawImage.

GraphicsContextGL::paintRenderingResultsToPixelBuffer has been updated to take a
boolean specifying whether the image should be flipped when returning the
PixelBuffer. This is because the HTMLCanvasElement::getImageData() function,
used when using a canvas as a source to gl.texImage2D(), still requires the data
to be flipped.

Added new tests that exercise both code paths to catch any future regressions.

* LayoutTests/fast/canvas/webgl/canvas-drawImage-expected.html: Added.
* LayoutTests/fast/canvas/webgl/canvas-drawImage.html: Added.
* LayoutTests/fast/canvas/webgl/canvas-getImageData-expected.html: Added.
* LayoutTests/fast/canvas/webgl/canvas-getImageData.html: Added.
* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getImageData):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::paintRenderingResultsToPixelBuffer):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.h:
* Source/WebCore/platform/graphics/GraphicsContextGL.h:
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::paintRenderingResultsToPixelBuffer):
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h:
* Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
(WebCore::GraphicsContextGLCocoa::withDrawingBufferAsNativeImage):
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h:
(paintRenderingResultsToPixelBuffer):
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp:
(WebKit::RemoteGraphicsContextGLProxy::paintRenderingResultsToPixelBuffer):

Canonical link: https://commits.webkit.org/266225@main




More information about the webkit-changes mailing list