From eb68343228cffedb5e7b74fe444bfce364f917f7 Mon Sep 17 00:00:00 2001 From: Ojan Vafai Date: Wed, 14 Jan 2015 18:58:27 -0800 Subject: [PATCH] Remove deferredfiltersenabled settings. I have no idea what this setting does, but I just mechanically removed it since it's always set to true. R=abarth@chromium.org Review URL: https://codereview.chromium.org/848243002 --- engine/core/frame/Settings.in | 2 - .../core/rendering/FilterEffectRenderer.cpp | 66 ++++--------------- engine/core/rendering/RenderLayer.cpp | 44 ++++--------- engine/public/web/WebSettings.h | 1 - engine/web/WebSettingsImpl.cpp | 5 -- engine/web/WebSettingsImpl.h | 1 - 6 files changed, 25 insertions(+), 94 deletions(-) diff --git a/engine/core/frame/Settings.in b/engine/core/frame/Settings.in index 9eb80b2b050..6088c0c1061 100644 --- a/engine/core/frame/Settings.in +++ b/engine/core/frame/Settings.in @@ -42,8 +42,6 @@ defaultFixedFontSize type=int, initial=0, invalidate=Style javaScriptCanAccessClipboard initial=false shouldClearDocumentBackground initial=true -deferredFiltersEnabled initial=true - containerCullingEnabled initial=false # FIXME: This should really be disabled by default as it makes platforms that diff --git a/engine/core/rendering/FilterEffectRenderer.cpp b/engine/core/rendering/FilterEffectRenderer.cpp index 25b1f56f8f1..18408ab20a4 100644 --- a/engine/core/rendering/FilterEffectRenderer.cpp +++ b/engine/core/rendering/FilterEffectRenderer.cpp @@ -335,67 +335,29 @@ GraphicsContext* FilterEffectRendererHelper::beginFilterEffect(GraphicsContext* ASSERT(m_renderLayer); FilterEffectRenderer* filter = m_renderLayer->filterRenderer(); - if (m_renderLayer->renderer()->document().settings()->deferredFiltersEnabled()) { - SkiaImageFilterBuilder builder(context); - RefPtr imageFilter = builder.build(filter->lastEffect().get(), ColorSpaceDeviceRGB); - if (!imageFilter) { - m_haveFilterEffect = false; - return context; - } - m_savedGraphicsContext = context; - context->save(); - FloatRect boundaries = mapImageFilterRect(imageFilter.get(), m_filterBoxRect); - context->translate(m_filterBoxRect.x(), m_filterBoxRect.y()); - boundaries.move(-m_filterBoxRect.x(), -m_filterBoxRect.y()); - context->beginLayer(1, CompositeSourceOver, &boundaries, ColorFilterNone, imageFilter.get()); - context->translate(-m_filterBoxRect.x(), -m_filterBoxRect.y()); - return context; - } - filter->allocateBackingStoreIfNeeded(); - // Paint into the context that represents the SourceGraphic of the filter. - GraphicsContext* sourceGraphicsContext = filter->inputContext(); - if (!sourceGraphicsContext || !FilterEffect::isFilterSizeValid(filter->absoluteFilterRegion())) { - // Disable the filters and continue. + SkiaImageFilterBuilder builder(context); + RefPtr imageFilter = builder.build(filter->lastEffect().get(), ColorSpaceDeviceRGB); + if (!imageFilter) { m_haveFilterEffect = false; return context; } - m_savedGraphicsContext = context; - - // Translate the context so that the contents of the layer is captuterd in the offscreen memory buffer. - sourceGraphicsContext->save(); - // FIXME: can we just use sourceImageRect for everything, and get rid of - // m_paintInvalidationRect? - FloatPoint offset = filter->sourceImageRect().location(); - sourceGraphicsContext->translate(-offset.x(), -offset.y()); - sourceGraphicsContext->clearRect(m_paintInvalidationRect); - sourceGraphicsContext->clip(m_paintInvalidationRect); - - return sourceGraphicsContext; + context->save(); + FloatRect boundaries = mapImageFilterRect(imageFilter.get(), m_filterBoxRect); + context->translate(m_filterBoxRect.x(), m_filterBoxRect.y()); + boundaries.move(-m_filterBoxRect.x(), -m_filterBoxRect.y()); + context->beginLayer(1, CompositeSourceOver, &boundaries, ColorFilterNone, imageFilter.get()); + context->translate(-m_filterBoxRect.x(), -m_filterBoxRect.y()); + return context; } GraphicsContext* FilterEffectRendererHelper::applyFilterEffect() { ASSERT(m_haveFilterEffect && m_renderLayer->filterRenderer()); - FilterEffectRenderer* filter = m_renderLayer->filterRenderer(); - - if (m_renderLayer->renderer()->document().settings()->deferredFiltersEnabled()) { - GraphicsContext* context = m_savedGraphicsContext; - context->endLayer(); - context->restore(); - return context; - } - - filter->inputContext()->restore(); - - filter->apply(); - - // Get the filtered output and draw it in place. - m_savedGraphicsContext->drawImageBuffer(filter->output(), filter->outputRect()); - - filter->clearIntermediateResults(); - - return m_savedGraphicsContext; + GraphicsContext* context = m_savedGraphicsContext; + context->endLayer(); + context->restore(); + return context; } } // namespace blink diff --git a/engine/core/rendering/RenderLayer.cpp b/engine/core/rendering/RenderLayer.cpp index f56e1457b64..12a0ab701c1 100644 --- a/engine/core/rendering/RenderLayer.cpp +++ b/engine/core/rendering/RenderLayer.cpp @@ -987,7 +987,6 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti } LayerPaintingInfo localPaintingInfo(paintingInfo); - bool deferredFiltersEnabled = renderer()->document().settings()->deferredFiltersEnabled(); FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilters()); LayoutRect layerBounds; @@ -1010,7 +1009,6 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti rootRelativeBounds = physicalBoundingBoxIncludingReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); if (filterPainter.prepareFilterEffect(this, rootRelativeBounds, paintingInfo.paintDirtyRect)) { - // Rewire the old context to a memory buffer, so that we can capture the contents of the layer. // NOTE: We saved the old context in the "transparencyLayerContext" local variable, to be able to start a transparency layer // on the original context and avoid duplicating "beginFilterEffect" after each transparency layer call. Also, note that @@ -1018,37 +1016,22 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti // With deferred filters, we don't need a separate context, but we do need to do transparency and clipping before starting // filter processing. // FIXME: when the legacy path is removed, remove the transparencyLayerContext as well. - if (deferredFiltersEnabled) { - if (haveTransparency) { - // If we have a filter and transparency, we have to eagerly start a transparency layer here, rather than risk a child layer lazily starts one after filter processing. - beginTransparencyLayers(context, localPaintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation); - } - // We'll handle clipping to the dirty rect before filter rasterization. - // Filter processing will automatically expand the clip rect and the offscreen to accommodate any filter outsets. - // FIXME: It is incorrect to just clip to the damageRect here once multiple fragments are involved. - clipToRect(localPaintingInfo, context, backgroundRect); - // Subsequent code should not clip to the dirty rect, since we've already - // done it above, and doing it later will defeat the outsets. - localPaintingInfo.clipToDirtyRect = false; + if (haveTransparency) { + // If we have a filter and transparency, we have to eagerly start a transparency layer here, rather than risk a child layer lazily starts one after filter processing. + beginTransparencyLayers(context, localPaintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation); } + // We'll handle clipping to the dirty rect before filter rasterization. + // Filter processing will automatically expand the clip rect and the offscreen to accommodate any filter outsets. + // FIXME: It is incorrect to just clip to the damageRect here once multiple fragments are involved. + clipToRect(localPaintingInfo, context, backgroundRect); + // Subsequent code should not clip to the dirty rect, since we've already + // done it above, and doing it later will defeat the outsets. + localPaintingInfo.clipToDirtyRect = false; + context = filterPainter.beginFilterEffect(context); - - // Check that we didn't fail to allocate the graphics context for the offscreen buffer. - if (filterPainter.hasStartedFilterEffect() && !deferredFiltersEnabled) { - localPaintingInfo.paintDirtyRect = filterPainter.paintInvalidationRect(); - // If the filter needs the full source image, we need to avoid using the clip rectangles. - // Otherwise, if for example this layer has overflow:hidden, a drop shadow will not compute correctly. - // Note that we will still apply the clipping on the final rendering of the filter. - localPaintingInfo.clipToDirtyRect = !filterRenderer()->hasFilterThatMovesPixels(); - } } } - if (filterPainter.hasStartedFilterEffect() && haveTransparency && !deferredFiltersEnabled) { - // If we have a filter and transparency, we have to eagerly start a transparency layer here, rather than risk a child layer lazily starts one with the wrong context. - beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation); - } - // If this layer's renderer is a child of the paintingRoot, we render unconditionally, which // is done by passing a nil paintingRoot down to our renderer (as if no paintingRoot was ever set). // Else, our renderer tree may or may not contain the painting root, so we pass that root along @@ -1078,11 +1061,6 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti paintOverflowControls(context, localPaintingInfo, layerLocation, backgroundRect); if (filterPainter.hasStartedFilterEffect()) { - // Apply the correct clipping (ie. overflow: hidden). - // FIXME: It is incorrect to just clip to the damageRect here once multiple fragments are involved. - if (!deferredFiltersEnabled) - clipToRect(localPaintingInfo, transparencyLayerContext, backgroundRect); - context = filterPainter.applyFilterEffect(); restoreClip(transparencyLayerContext, localPaintingInfo.paintDirtyRect, backgroundRect); } diff --git a/engine/public/web/WebSettings.h b/engine/public/web/WebSettings.h index 7985e8bb2d5..b30a589ad54 100644 --- a/engine/public/web/WebSettings.h +++ b/engine/public/web/WebSettings.h @@ -101,7 +101,6 @@ public: virtual void setDefaultTextEncodingName(const WebString&) = 0; virtual void setDefaultVideoPosterURL(const WebString&) = 0; void setDeferred2dCanvasEnabled(bool) { } // temporary stub - virtual void setDeferredFiltersEnabled(bool) = 0; virtual void setDeferredImageDecodingEnabled(bool) = 0; virtual void setDeviceSupportsMouse(bool) = 0; virtual void setDeviceSupportsTouch(bool) = 0; diff --git a/engine/web/WebSettingsImpl.cpp b/engine/web/WebSettingsImpl.cpp index a3f58f05b17..986b9e5602f 100644 --- a/engine/web/WebSettingsImpl.cpp +++ b/engine/web/WebSettingsImpl.cpp @@ -280,11 +280,6 @@ void WebSettingsImpl::setDeferredImageDecodingEnabled(bool enabled) m_deferredImageDecodingEnabled = enabled; } -void WebSettingsImpl::setDeferredFiltersEnabled(bool enabled) -{ - m_settings->setDeferredFiltersEnabled(enabled); -} - void WebSettingsImpl::setPreferCompositingToLCDTextEnabled(bool enabled) { } diff --git a/engine/web/WebSettingsImpl.h b/engine/web/WebSettingsImpl.h index 1ecbbe253c7..9c03213ef8e 100644 --- a/engine/web/WebSettingsImpl.h +++ b/engine/web/WebSettingsImpl.h @@ -60,7 +60,6 @@ public: virtual void setDefaultFontSize(int) override; virtual void setDefaultTextEncodingName(const WebString&) override; virtual void setDefaultVideoPosterURL(const WebString&) override; - virtual void setDeferredFiltersEnabled(bool) override; virtual void setDeferredImageDecodingEnabled(bool) override; virtual void setDeviceSupportsMouse(bool) override;