[webkit-changes] [WebKit/WebKit] 19a225: Row byte count is not available in GraphicsContext...

Kimmo Kinnunen noreply at github.com
Thu Jun 1 07:33:33 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 19a2252db08cadac7ce04a570c7d4be1db253245
      https://github.com/WebKit/WebKit/commit/19a2252db08cadac7ce04a570c7d4be1db253245
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M Source/WTF/wtf/StdLibExtras.h
    M Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.h
    M Source/WebCore/platform/graphics/GraphicsContextGL.cpp
    M Source/WebCore/platform/graphics/GraphicsContextGL.h
    M Source/bmalloc/bmalloc/Algorithm.h
    M Tools/TestWebKitAPI/CMakeLists.txt
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    R Tools/TestWebKitAPI/Tests/WTF/StdLibExtras.cpp
    A Tools/TestWebKitAPI/Tests/WTF/StdLibExtrasTests.cpp

  Log Message:
  -----------
  Row byte count is not available in GraphicsContextGL::computeImageSizeBytes
https://bugs.webkit.org/show_bug.cgi?id=257452
rdar://109969560

Reviewed by Dan Glastonbury.

GraphicsContextGL::computeImageSizeInBytes would return the image size
but not the count of row bytes. The row bytes are needed for GPUP side
implementation where the GPUP is queried for tightly packed image
and then the image data is expanded by WP to the client buffer.

Rename to computeImageSize.

Simplify the computation by using Checked all the way to the end.
The idea of Checked is that the intermediate values do not need to be
checked.

Return a struct instead of numerous output variables. These were
error-prone, as they were written even though the function would return
error.

Remove the unused paddingInBytes, which was not used.
Add row bytes variables.

Add checked variant of roundUpToMultipleOfNonPowerOfTwo.
Add unchecked variant, for consistency.
Fix overflow in bmalloc::roundUpToMultipleOfNonPowerOfTwo and
untemplatize, as the template parameter could not be anything else than
size_t.

* Source/WTF/wtf/StdLibExtras.h:
(WTF::roundUpToMultipleOfNonPowerOfTwo):
* Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::readPixels):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::readPixels):
(WebCore::WebGLRenderingContextBase::validateImageFormatAndType):
(WebCore::WebGLRenderingContextBase::validateTexFuncData):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.h:
* Source/WebCore/platform/graphics/GraphicsContextGL.cpp:
(WebCore::GraphicsContextGL::computeImageSize):
(WebCore::GraphicsContextGL::packImageData):
(WebCore::GraphicsContextGL::extractPixelBuffer):
(WebCore::GraphicsContextGL::extractTextureData):
(WebCore::GraphicsContextGL::computeImageSizeInBytes): Deleted.
* Source/WebCore/platform/graphics/GraphicsContextGL.h:
* Source/bmalloc/bmalloc/Algorithm.h:
(bmalloc::roundUpToMultipleOfNonPowerOfTwo):
* Tools/TestWebKitAPI/Tests/WTF/StdLibExtras.cpp:
(TestWebKitAPI::TEST):

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




More information about the webkit-changes mailing list