[webkit-changes] [WebKit/WebKit] 19fb3b: SVG text with gradient fill is rendered very slow
Said Abou-Hallawa
noreply at github.com
Mon Jan 13 01:00:50 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 19fb3bc3aa27a28183dbc388d1ba5df1cbb2feb6
https://github.com/WebKit/WebKit/commit/19fb3bc3aa27a28183dbc388d1ba5df1cbb2feb6
Author: Said Abou-Hallawa <said at apple.com>
Date: 2025-01-13 (Mon, 13 Jan 2025)
Changed paths:
M LayoutTests/imported/blink/svg/text/obb-paintserver.html
M LayoutTests/imported/mozilla/svg/text-scale-02.svg
M LayoutTests/imported/mozilla/svg/text/simple-fill-gradient.svg
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResource.cpp
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResource.h
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceGradient.cpp
M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceGradient.h
Log Message:
-----------
SVG text with gradient fill is rendered very slow
https://bugs.webkit.org/show_bug.cgi?id=285799#
rdar://73203473
Reviewed by Simon Fraser.
Refactor applying the SVG gradient resource into two appliers: one for text
(TextGradientClipper) and the other for PathOrShape (PathOrShapeGradientApplier).
TextGradientClipper draws the text into a mask ImageBuffer. Then GraphicsContext
is clipped to this ImageBuffer before the targetRect is filled with gradient.
PathOrShapeGradientApplier fills or strokes the path (or the shape) with the
gradient resource.
Add the new text applier TextGradientCompositor which draws the text into a
transparency layer with SourceIn. Then it fills the targetRect with the gradient
into another transparency layer with SourceOver. Then these two layers are
composited to GraphicsContext.
TextGradientCompositor will be used for all cases except when rendering to a
PDFDocument because PDF context does not support some CompositeOperation. In this
case TextGradientClipper will be used to draw the text.
* LayoutTests/imported/blink/svg/text/obb-paintserver.html:
* LayoutTests/imported/mozilla/svg/text-scale-02.svg:
* LayoutTests/imported/mozilla/svg/text/simple-fill-gradient.svg:
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResource.cpp:
(WebCore::LegacyRenderSVGResource::fillAndStrokePathOrShape):
(WebCore::LegacyRenderSVGResource::fillAndStrokePathOrShape const): Deleted.
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResource.h:
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceGradient.cpp:
(WebCore::LegacyRenderSVGResourceGradient::gradientDataForRenderer):
(WebCore::applyGradientResource):
(WebCore::PathOrShapeGradientApplier::applyResource):
(WebCore::PathOrShapeGradientApplier::postApplyResource):
(WebCore::calculateGradientGeometry):
(WebCore::calculateGradientUserspaceTransform):
(WebCore::TextGradientClipper::applyResource):
(WebCore::TextGradientClipper::postApplyResource):
(WebCore::TextGradientCompositor::applyResource):
(WebCore::TextGradientCompositor::postApplyResource):
(WebCore::LegacyRenderSVGResourceGradient::applyResource):
(WebCore::LegacyRenderSVGResourceGradient::postApplyResource):
(WebCore::createMaskAndSwapContextForTextGradient): Deleted.
(WebCore::clipToTextMask): Deleted.
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceGradient.h:
Canonical link: https://commits.webkit.org/288788@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list