[webkit-changes] [WebKit/WebKit] b5117f: ImageBuffer::copyImage is redundant, should use co...

Kimmo Kinnunen noreply at github.com
Fri Sep 29 03:20:54 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b5117f4636f67c6f8f8efb3f4a6ca1ce0914866d
      https://github.com/WebKit/WebKit/commit/b5117f4636f67c6f8f8efb3f4a6ca1ce0914866d
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2023-09-29 (Fri, 29 Sep 2023)

  Changed paths:
    M Source/WebCore/html/CustomPaintCanvas.cpp
    M Source/WebCore/html/CustomPaintCanvas.h
    M Source/WebCore/html/HTMLCanvasElement.cpp
    M Source/WebCore/html/ImageBitmap.cpp
    M Source/WebCore/html/OffscreenCanvas.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.h
    M Source/WebCore/platform/graphics/GraphicsContext.cpp
    M Source/WebCore/platform/graphics/GraphicsContextGL.cpp
    M Source/WebCore/platform/graphics/ImageBuffer.cpp
    M Source/WebCore/platform/graphics/ImageBuffer.h
    M Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp
    M Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp
    M Source/WebCore/platform/graphics/texmap/BitmapTexture.h
    M Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp
    M Source/WebCore/platform/graphics/texmap/BitmapTextureGL.h
    M Source/WebCore/platform/graphics/texmap/TextureMapperTile.cpp
    M Source/WebCore/platform/mediastream/mac/MockRealtimeVideoSourceMac.mm

  Log Message:
  -----------
  ImageBuffer::copyImage is redundant, should use copyNativeImage instead
https://bugs.webkit.org/show_bug.cgi?id=261944
rdar://115891269

Reviewed by Matt Woodrow.

Remove ImageBuffer::copyImaage(). WebCore::Image is higher level
type. Callers should call sinkIntoNativeImage and then convert the
NativeImage into Image, if needed. Note: most callers should use
NativeImage, as that is the lowest level source image.

These are identical:
copyImage(CopyBackingStore, PreserveResolution::Yes) -> copyNativeImage()
copyImage(DontCopyBackingStore, PreserveResolution::No) + scale 1
 -> createNativeImageReference()

Other variants wouldn't have corresponding NativeImage call, but they
do not exist.

This is work towards simplifying ImageBuffer by making it operate
with NativeImage as its primary primitive image source.

* Source/WebCore/html/CustomPaintCanvas.cpp:
(WebCore::CustomPaintCanvas::copiedImage const):
Fix an issue where the code would nullptr deref if Context2D call
would try to reset the transform to default.
The idea of CanvasBase::baseTransform() is that it would return the
transform to be set, but this cannot happen because ImageBuffer has not
been created at the time of the call. The transform reset is recorded.

* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::copiedImage const):
* Source/WebCore/html/ImageBitmap.cpp:
(WebCore::ImageBitmap::createCompletionHandler):
* Source/WebCore/html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::copiedImage const):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::texImageSource):
(WebCore::WebGLRenderingContextBase::drawImageIntoBuffer):
(WebCore::WebGLRenderingContextBase::videoFrameToImage):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.h:
* Source/WebCore/platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawPattern):
* Source/WebCore/platform/graphics/GraphicsContextGL.cpp:
(WebCore::GraphicsContextGL::videoFrameToImage):
* Source/WebCore/platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::copyImage const): Deleted.
* Source/WebCore/platform/graphics/ImageBuffer.h:
* Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
(Nicosia::CairoOperationRecorder::drawImageBuffer):
(Nicosia::CairoOperationRecorder::drawFilteredImageBuffer):
(Nicosia::CairoOperationRecorder::clipToImageBuffer):
* Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp:
(WebCore::BitmapTexture::updateContents):
* Source/WebCore/platform/graphics/texmap/BitmapTexture.h:
* Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp:
(WebCore::BitmapTextureGL::updateContents):
* Source/WebCore/platform/graphics/texmap/BitmapTextureGL.h:
* Source/WebCore/platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
(WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer):

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




More information about the webkit-changes mailing list