[webkit-changes] [WebKit/WebKit] 5a02a2: Add the class FilterTargetSwitcher

Said Abou-Hallawa noreply at github.com
Thu Oct 20 14:29:22 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5a02a23fcd7776eb83e24787354df6daf79a79cc
      https://github.com/WebKit/WebKit/commit/5a02a23fcd7776eb83e24787354df6daf79a79cc
  Author: Said Abou-Hallawa <said at apple.com>
  Date:   2022-10-20 (Thu, 20 Oct 2022)

  Changed paths:
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/platform/graphics/filters/FilterTargetSwitcher.cpp
    A Source/WebCore/platform/graphics/filters/FilterTargetSwitcher.h

  Log Message:
  -----------
  Add the class FilterTargetSwitcher
https://bugs.webkit.org/show_bug.cgi?id=246822

Reviewed by Simon Fraser.

This class will manage applying a filter to a certain area of drawings with the
minimum changes in the existing code. All it needs is a set of callbacks in the
existing caller class. And the caller adds a line like this to the drawing
function:

	FilterTargetSwitcher targetSwitcher(*this, bounds);

The constructor of FilterTargetSwitcher will ask the client if there a filter to
apply or not. If there is a filter, it will switch the drawing to a temporary
ImageBuffer. The client has to make sure all the drawing code from now on will
use the context of this ImageBuffer. The destructor will apply the filter to the
temporary ImageBuffer and then composite filtered ImageBuffer back to the client
drawing context.

* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/graphics/filters/FilterTargetSwitcher.cpp: Added.
(WebCore::FilterTargetSwitcher::FilterTargetSwitcher):
(WebCore::FilterTargetSwitcher::~FilterTargetSwitcher):
(WebCore::FilterTargetSwitcher::drawingContext const):
(WebCore::FilterTargetSwitcher::outsets const):
* Source/WebCore/platform/graphics/filters/FilterTargetSwitcher.h: Added.

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




More information about the webkit-changes mailing list