Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b005d0812158d04e151bbd671e718228adedbd40
      
https://github.com/WebKit/WebKit/commit/b005d0812158d04e151bbd671e718228adedbd40
  Author: Gerald Squelart <[email protected]>
  Date:   2026-07-31 (Fri, 31 Jul 2026)

  Changed paths:
    M Source/WebCore/html/HTMLCanvasElement.cpp
    M Source/WebCore/html/ImageData.cpp
    M Source/WebCore/html/ImageData.h
    M Source/WebCore/html/ImageDataArray.cpp
    M Source/WebCore/html/ImageDataArray.h
    M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp

  Log Message:
  -----------
  Make ImageData work with non-Typed ArrayPixelBuffer
https://bugs.webkit.org/show_bug.cgi?id=320622
rdar://183589141

Reviewed by Mike Wyrzykowski.

Creating an `ImageData` from an `ArrayPixelBuffer` had to be done
through a concrete `TypedArrayPixelBuffer` (`Byte`- or `Float16`-),
which would become more cumbersome in the near future as HDR-capable
float16 buffers are added in more places, usually as generic non-`Typed`
`ArrayPixelBuffer` interface.

So this patch replaces groups of `Typed`-only `ImageData::create()`
functions with more generic `ArrayPixelBuffer` ones.
Under the covers, ImageDataArray was already referencing a generic
JSC::ArrayBufferView anyway, so this shouldn't introduce extra work.

A couple of callers had to explicitly convert their current
`Ref<ByteArrayPixelBuffer>` to a `Ref<ArrayPixelBuffer>` to avoid
ambiguous calls; but it's only temporary as eventually these users will
transition to float16-capable `ArrayPixelBuffer`s.

Covered by existing tests.

* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getImageData):
* Source/WebCore/html/ImageData.cpp:
(WebCore::ImageData::create):
* Source/WebCore/html/ImageData.h:
(WebCore::ImageData::create):
* Source/WebCore/html/ImageDataArray.cpp:
* Source/WebCore/html/ImageDataArray.h:
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::makeImageDataIfContentsCached const):
(WebCore::CanvasRenderingContext2DBase::getImageData const):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to