Commit 56a5ec3f authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Use GetPaintRecord in SVGFilterRecordingContext

This cuts out one of the middle steps as well as the additional clip to
|bounds|. We will be clipping the results of the filter anyway, so
hopefully this extra clip step doesn't matter too much. When the full
'filter' syntax is supported on SVG content we won't be able to use the
filter region clip in this way anyway.

Bug: 109224

Change-Id: I8cf8799c8c0992b763291f57759ad7d83f98d258
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2096448Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#748716}
parent 24848952
...@@ -32,19 +32,15 @@ GraphicsContext* SVGFilterRecordingContext::BeginContent() { ...@@ -32,19 +32,15 @@ GraphicsContext* SVGFilterRecordingContext::BeginContent() {
return context_.get(); return context_.get();
} }
sk_sp<PaintRecord> SVGFilterRecordingContext::EndContent( sk_sp<PaintRecord> SVGFilterRecordingContext::EndContent() {
const FloatRect& bounds) {
// Use the context that contains the filtered content. // Use the context that contains the filtered content.
DCHECK(paint_controller_); DCHECK(paint_controller_);
DCHECK(context_); DCHECK(context_);
context_->BeginRecording(bounds);
paint_controller_->CommitNewDisplayItems(); paint_controller_->CommitNewDisplayItems();
sk_sp<PaintRecord> content =
paint_controller_->GetPaintArtifact().GetPaintRecord(
initial_context_.GetPaintController().CurrentPaintChunkProperties());
paint_controller_->GetPaintArtifact().Replay(
*context_,
initial_context_.GetPaintController().CurrentPaintChunkProperties());
sk_sp<PaintRecord> content = context_->EndRecording();
// Content is cached by the source graphic so temporaries can be freed. // Content is cached by the source graphic so temporaries can be freed.
paint_controller_ = nullptr; paint_controller_ = nullptr;
context_ = nullptr; context_ = nullptr;
...@@ -54,7 +50,7 @@ sk_sp<PaintRecord> SVGFilterRecordingContext::EndContent( ...@@ -54,7 +50,7 @@ sk_sp<PaintRecord> SVGFilterRecordingContext::EndContent(
void SVGFilterRecordingContext::Abort() { void SVGFilterRecordingContext::Abort() {
if (!paint_controller_) if (!paint_controller_)
return; return;
EndContent(FloatRect()); EndContent();
} }
static void PaintFilteredContent(GraphicsContext& context, static void PaintFilteredContent(GraphicsContext& context,
...@@ -155,7 +151,7 @@ void SVGFilterPainter::FinishEffect( ...@@ -155,7 +151,7 @@ void SVGFilterPainter::FinishEffect(
FloatRect bounds = filter->FilterRegion(); FloatRect bounds = filter->FilterRegion();
if (filter_data->state_ == FilterData::kRecordingContent) { if (filter_data->state_ == FilterData::kRecordingContent) {
DCHECK(filter->GetSourceGraphic()); DCHECK(filter->GetSourceGraphic());
sk_sp<PaintRecord> content = recording_context.EndContent(bounds); sk_sp<PaintRecord> content = recording_context.EndContent();
paint_filter_builder::BuildSourceGraphic(filter->GetSourceGraphic(), paint_filter_builder::BuildSourceGraphic(filter->GetSourceGraphic(),
std::move(content), bounds); std::move(content), bounds);
filter_data->state_ = FilterData::kReadyToPaint; filter_data->state_ = FilterData::kReadyToPaint;
......
...@@ -25,7 +25,7 @@ class SVGFilterRecordingContext { ...@@ -25,7 +25,7 @@ class SVGFilterRecordingContext {
: initial_context_(initial_context) {} : initial_context_(initial_context) {}
GraphicsContext* BeginContent(); GraphicsContext* BeginContent();
sk_sp<PaintRecord> EndContent(const FloatRect&); sk_sp<PaintRecord> EndContent();
void Abort(); void Abort();
GraphicsContext& PaintingContext() const { return initial_context_; } GraphicsContext& PaintingContext() const { return initial_context_; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment