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

Unified Diff: Source/core/rendering/RenderLayer.cpp

Issue 14793008: Extract the SVG Filter Reference implementation out of the FilterEffectRenderer into its own type (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix copyrights Created 7 years, 6 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 | « Source/core/rendering/FilterEffectRenderer.cpp ('k') | Source/core/rendering/svg/ReferenceFilterBuilder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderLayer.cpp
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index 568ec4325ca7a17e61fad7d469a296879bd292b0..f062f1e295d3d4a0d5c002ec39a8ff0d8f40a12d 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -76,6 +76,8 @@
#include "core/platform/graphics/FloatPoint3D.h"
#include "core/platform/graphics/FloatRect.h"
#include "core/platform/graphics/GraphicsContextStateSaver.h"
+#include "core/platform/graphics/filters/ReferenceFilter.h"
+#include "core/platform/graphics/filters/SourceGraphic.h"
#include "core/platform/graphics/filters/custom/CustomFilterGlobalContext.h"
#include "core/platform/graphics/filters/custom/CustomFilterOperation.h"
#include "core/platform/graphics/filters/custom/CustomFilterValidatedProgram.h"
@@ -100,6 +102,7 @@
#include "core/rendering/RenderScrollbarPart.h"
#include "core/rendering/RenderTreeAsText.h"
#include "core/rendering/RenderView.h"
+#include "core/rendering/svg/ReferenceFilterBuilder.h"
#include "core/rendering/svg/RenderSVGResourceClipper.h"
#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/StdLibExtras.h>
@@ -6046,13 +6049,6 @@ void RenderLayer::updateFilters(const RenderStyle* oldStyle, const RenderStyle*
if (shouldUpdateFilters)
backing()->updateFilters(renderer()->style());
updateOrRemoveFilterEffectRenderer();
- // FIXME: Accelerated SVG reference filters still rely on FilterEffectRenderer to build the filter graph.
- // Thus, we have to call updateFilters again, after we have a FilterEffectRenderer.
- // FilterEffectRenderer is intended to render software filters and shouldn't be needed for accelerated filters.
- // We should extract the SVG graph building functionality out of FilterEffectRenderer, and it should happen in RenderLayer::computeFilterOperations.
- // https://bugs.webkit.org/show_bug.cgi?id=114051
- if (shouldUpdateFilters && newStyle->filter().hasReferenceFilter())
- backing()->updateFilters(renderer()->style());
}
void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle)
@@ -6245,6 +6241,22 @@ bool RenderLayer::isCSSCustomFilterEnabled() const
FilterOperations RenderLayer::computeFilterOperations(const RenderStyle* style)
{
const FilterOperations& filters = style->filter();
+ if (filters.hasReferenceFilter()) {
+ for (size_t i = 0; i < filters.size(); ++i) {
+ FilterOperation* filterOperation = filters.operations().at(i).get();
+ if (filterOperation->getOperationType() != FilterOperation::REFERENCE)
+ continue;
+ ReferenceFilterOperation* referenceOperation = static_cast<ReferenceFilterOperation*>(filterOperation);
+ // FIXME: Cache the ReferenceFilter if it didn't change.
+ RefPtr<ReferenceFilter> referenceFilter = ReferenceFilter::create();
+ float zoom = style->effectiveZoom();
+ referenceFilter->setFilterResolution(FloatSize(zoom, zoom));
+ referenceFilter->setLastEffect(ReferenceFilterBuilder::build(referenceFilter.get(), renderer(), referenceFilter->sourceGraphic(),
+ referenceOperation));
+ referenceOperation->setFilter(referenceFilter.release());
+ }
+ }
+
if (!filters.hasCustomFilter())
return filters;
@@ -6310,14 +6322,7 @@ void RenderLayer::updateOrRemoveFilterEffectRenderer()
if (RenderLayerFilterInfo* filterInfo = this->filterInfo())
filterInfo->setRenderer(0);
- // FIXME: Accelerated SVG reference filters shouldn't rely on FilterEffectRenderer to build the filter graph.
- // https://bugs.webkit.org/show_bug.cgi?id=114051
-
- // Early-return only if we *don't* have reference filters.
- // For reference filters, we still want the FilterEffect graph built
- // for us, even if we're composited.
- if (!renderer()->style()->filter().hasReferenceFilter())
- return;
+ return;
}
RenderLayerFilterInfo* filterInfo = ensureFilterInfo();
« no previous file with comments | « Source/core/rendering/FilterEffectRenderer.cpp ('k') | Source/core/rendering/svg/ReferenceFilterBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698