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
This commit is contained in:
Ojan Vafai 2015-01-14 18:58:27 -08:00
parent 3b4eb72066
commit eb68343228
6 changed files with 25 additions and 94 deletions

View File

@ -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

View File

@ -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> 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> 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

View File

@ -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);
}

View File

@ -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;

View File

@ -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)
{
}

View File

@ -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;