[CSS Filters] Drop-shadow and blur can avoid using full source image
authorachicu@adobe.com <achicu@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Apr 2012 17:37:41 +0000 (17:37 +0000)
committerachicu@adobe.com <achicu@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Apr 2012 17:37:41 +0000 (17:37 +0000)
commit3a998603dd1830d5bf918cba8759200102666620
treead5f6d0419359d3a670d8e28ba1b7413a7b20d30
parent42d75031d829ab1fa6cf6097be684a2175690961
[CSS Filters] Drop-shadow and blur can avoid using full source image
https://bugs.webkit.org/show_bug.cgi?id=81263

Reviewed by Dean Jackson.

Instead of using the full bounding box of the RenderLayer we now compute the exact rectangle that is needed to
compute filter inside the dirty rectangle on screen. That's easy to calculate by reversing the filter outsets.
Even if the element is completely offscreen, but its shadow is in the viewport, we can still compute the source
rectangle that needs to be drawn in order to update the shadow correctly.

No new tests, this change doesn't have visible results and the functionality should
already be covered by previous filter tests.

* rendering/FilterEffectRenderer.cpp:
(WebCore::FilterEffectRenderer::FilterEffectRenderer):
(WebCore::FilterEffectRenderer::build): Save the outsets of the filters, so that we can use them in computeSourceImageRectForDirtyRect.
(WebCore::FilterEffectRenderer::updateBackingStoreRect): Only allocate a new source image if the size of the source rectangle changed.
(WebCore::FilterEffectRenderer::allocateBackingStoreIfNeeded): There's no need to call clearIntermediateResults() in this function. We do that after
the filter is computed.
(WebCore::FilterEffectRenderer::computeSourceImageRectForDirtyRect):
(WebCore):
(WebCore::FilterEffectRendererHelper::prepareFilterEffect):
(WebCore::FilterEffectRendererHelper::beginFilterEffect):
* rendering/FilterEffectRenderer.h:
(FilterEffectRendererHelper):
(WebCore::FilterEffectRendererHelper::repaintRect):
(FilterEffectRenderer):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintLayerContents):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@114529 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/rendering/FilterEffectRenderer.cpp
Source/WebCore/rendering/FilterEffectRenderer.h
Source/WebCore/rendering/RenderLayer.cpp