[webkit-changes] [WebKit/WebKit] 83d967: 2D Context get/putImageData cache copies cached im...

Kimmo Kinnunen noreply at github.com
Mon Nov 20 07:11:22 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 83d967c4920fe7d5eaeb957ddc5e2e236abce6a2
      https://github.com/WebKit/WebKit/commit/83d967c4920fe7d5eaeb957ddc5e2e236abce6a2
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2023-11-20 (Mon, 20 Nov 2023)

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

  Log Message:
  -----------
  2D Context get/putImageData cache copies cached image data twice
https://bugs.webkit.org/show_bug.cgi?id=264927
rdar://118497211

Reviewed by Cameron McCormack.

Store the PixelBuffer that was used for putImageData,
avoid copying the the ImageData redundantly.

Instead of copying during caching, copy with premultiply.
This way we omit one memcpy for caching and one premultiply for the real
putImageData.

To simplify the implementation, removes the conservative approach
where the caching would kick in at 3rd putImageData. Just cache
the first.

* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::cacheImageDataIfPossible):
(WebCore::CanvasRenderingContext2DBase::takeCachedImageDataIfPossible const):
(WebCore::CanvasRenderingContext2DBase::putImageData):
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h:

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




More information about the webkit-changes mailing list