[webkit-changes] [WebKit/WebKit] 5466cd: Avoid going back to the GPU process for canvas Ima...

Cameron McCormack noreply at github.com
Mon Aug 7 02:56:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5466cd2c24514bdeee05075d5a2eb35e8c146e40
      https://github.com/WebKit/WebKit/commit/5466cd2c24514bdeee05075d5a2eb35e8c146e40
  Author: Cameron McCormack <heycam at apple.com>
  Date:   2023-08-07 (Mon, 07 Aug 2023)

  Changed paths:
    A LayoutTests/fast/canvas/canvas-ImageData-cache-expected.txt
    A LayoutTests/fast/canvas/canvas-ImageData-cache.html
    A LayoutTests/fast/canvas/imageData-consistency-expected.txt
    A LayoutTests/fast/canvas/imageData-consistency.html
    A LayoutTests/platform/gtk/fast/canvas/imageData-consistency-expected.txt
    A LayoutTests/platform/wpe/fast/canvas/imageData-consistency-expected.txt
    M Source/WebCore/html/ImageData.cpp
    M Source/WebCore/html/ImageData.h
    M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
    M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h
    M Source/WebCore/platform/Timer.h

  Log Message:
  -----------
  Avoid going back to the GPU process for canvas ImageData when possible
https://bugs.webkit.org/show_bug.cgi?id=259436
rdar://problem/112746729

Reviewed by Cameron McCormack and Myles C. Maxfield.

On a 2D canvas, if a recent putImageData() was made with no other
intervening drawing commands, we can use its data to fulfill a
subsequent getImageData(). Start with some simple conditions for
ImageData size and drawing dimensions, which can be extended later if it
proves useful.

* LayoutTests/fast/canvas/canvas-ImageData-cache-expected.txt: Added.
* LayoutTests/fast/canvas/canvas-ImageData-cache.html: Added.
* Source/WebCore/html/ImageData.cpp:
(WebCore::ImageData::clone const):
* Source/WebCore/html/ImageData.h:
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::reset):
(WebCore::CanvasRenderingContext2DBase::didDraw):
(WebCore::CanvasRenderingContext2DBase::cacheImageDataIfPossible):
(WebCore::CanvasRenderingContext2DBase::takeCachedImageDataIfPossible const):
(WebCore::CanvasRenderingContext2DBase::getImageData const):
(WebCore::CanvasRenderingContext2DBase::putImageData):
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h:

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




More information about the webkit-changes mailing list