Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(689)

Unified Diff: third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp

Issue 2367463002: Fold DisplayItem creation into paintFilteredContent in SVGFilterPainter (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp b/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp
index 624f8ad26e8facd4851c21cde395bb3cacd46f80..efc7eecef769a3e5876e59c9ca5162c60703fd04 100644
--- a/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/SVGFilterPainter.cpp
@@ -52,7 +52,13 @@ void SVGFilterRecordingContext::endContent(FilterData* filterData)
static void paintFilteredContent(GraphicsContext& context, const LayoutObject& object, FilterData* filterData)
{
- DCHECK_EQ(filterData->m_state, FilterData::ReadyToPaint);
+ if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, object, DisplayItem::kSVGFilter))
+ return;
+
+ FloatRect filterBounds = filterData ? filterData->lastEffect->getFilter()->filterRegion() : FloatRect();
+ LayoutObjectDrawingRecorder recorder(context, object, DisplayItem::kSVGFilter, filterBounds);
+ if (!filterData || filterData->m_state != FilterData::ReadyToPaint)
+ return;
DCHECK(filterData->lastEffect->getFilter()->getSourceGraphic());
filterData->m_state = FilterData::PaintingFilter;
@@ -64,8 +70,7 @@ static void paintFilteredContent(GraphicsContext& context, const LayoutObject& o
// Clip drawing of filtered image to the minimum required paint rect.
context.clipRect(lastEffect->mapRect(object.strokeBoundingBox()));
- FloatRect boundaries = lastEffect->getFilter()->filterRegion();
- context.beginLayer(1, SkXfermode::kSrcOver_Mode, &boundaries, ColorFilterNone, std::move(imageFilter));
+ context.beginLayer(1, SkXfermode::kSrcOver_Mode, &filterBounds, ColorFilterNone, std::move(imageFilter));
context.endLayer();
context.restore();
@@ -125,15 +130,7 @@ void SVGFilterPainter::finishEffect(const LayoutObject& object, SVGFilterRecordi
if (filterData->m_state == FilterData::RecordingContentCycleDetected)
filterData->m_state = FilterData::RecordingContent;
}
-
- GraphicsContext& context = recordingContext.paintingContext();
- if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, object, DisplayItem::kSVGFilter))
- return;
-
- FloatRect filterRegion = filterData ? filterData->lastEffect->getFilter()->filterRegion() : FloatRect();
- LayoutObjectDrawingRecorder recorder(context, object, DisplayItem::kSVGFilter, filterRegion);
- if (filterData && filterData->m_state == FilterData::ReadyToPaint)
- paintFilteredContent(context, object, filterData);
+ paintFilteredContent(recordingContext.paintingContext(), object, filterData);
}
} // namespace blink
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698