| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/FilterPainter.h" | 6 #include "core/paint/FilterPainter.h" |
| 7 | 7 |
| 8 #include "core/layout/FilterEffectRenderer.h" | |
| 9 #include "core/layout/LayoutView.h" | |
| 10 #include "core/paint/DeprecatedPaintLayer.h" | 8 #include "core/paint/DeprecatedPaintLayer.h" |
| 9 #include "core/paint/FilterEffectBuilder.h" |
| 11 #include "core/paint/LayerClipRecorder.h" | 10 #include "core/paint/LayerClipRecorder.h" |
| 12 #include "platform/RuntimeEnabledFeatures.h" | 11 #include "platform/RuntimeEnabledFeatures.h" |
| 13 #include "platform/graphics/GraphicsContext.h" | 12 #include "platform/graphics/GraphicsContext.h" |
| 14 #include "platform/graphics/GraphicsLayer.h" | 13 #include "platform/graphics/GraphicsLayer.h" |
| 15 #include "platform/graphics/filters/FilterEffect.h" | 14 #include "platform/graphics/filters/FilterEffect.h" |
| 16 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" | 15 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" |
| 17 #include "platform/graphics/paint/DisplayItemList.h" | 16 #include "platform/graphics/paint/DisplayItemList.h" |
| 18 #include "platform/graphics/paint/FilterDisplayItem.h" | 17 #include "platform/graphics/paint/FilterDisplayItem.h" |
| 19 #include "public/platform/Platform.h" | 18 #include "public/platform/Platform.h" |
| 20 #include "public/platform/WebCompositorSupport.h" | 19 #include "public/platform/WebCompositorSupport.h" |
| 21 #include "public/platform/WebFilterOperations.h" | 20 #include "public/platform/WebFilterOperations.h" |
| 22 | 21 |
| 23 namespace blink { | 22 namespace blink { |
| 24 | 23 |
| 25 FilterPainter::FilterPainter(DeprecatedPaintLayer& layer, GraphicsContext* conte
xt, const LayoutPoint& offsetFromRoot, const ClipRect& clipRect, DeprecatedPaint
LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, | 24 FilterPainter::FilterPainter(DeprecatedPaintLayer& layer, GraphicsContext* conte
xt, const LayoutPoint& offsetFromRoot, const ClipRect& clipRect, DeprecatedPaint
LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, |
| 26 LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed) | 25 LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed) |
| 27 : m_filterInProgress(false) | 26 : m_filterInProgress(false) |
| 28 , m_context(context) | 27 , m_context(context) |
| 29 , m_layoutObject(layer.layoutObject()) | 28 , m_layoutObject(layer.layoutObject()) |
| 30 { | 29 { |
| 31 if (!layer.filterRenderer() || !layer.paintsWithFilters()) | 30 if (!layer.filterEffectBuilder() || !layer.paintsWithFilters()) |
| 32 return; | 31 return; |
| 33 | 32 |
| 34 ASSERT(layer.filterInfo()); | 33 ASSERT(layer.filterInfo()); |
| 35 | 34 |
| 36 SkiaImageFilterBuilder builder(context); | 35 SkiaImageFilterBuilder builder(context); |
| 37 RefPtrWillBeRawPtr<FilterEffect> lastEffect = layer.filterRenderer()->lastEf
fect(); | 36 RefPtrWillBeRawPtr<FilterEffect> lastEffect = layer.filterEffectBuilder()->l
astEffect(); |
| 38 lastEffect->determineFilterPrimitiveSubregion(MapRectForward); | 37 lastEffect->determineFilterPrimitiveSubregion(MapRectForward); |
| 39 RefPtr<SkImageFilter> imageFilter = builder.build(lastEffect.get(), ColorSpa
ceDeviceRGB); | 38 RefPtr<SkImageFilter> imageFilter = builder.build(lastEffect.get(), ColorSpa
ceDeviceRGB); |
| 40 if (!imageFilter) | 39 if (!imageFilter) |
| 41 return; | 40 return; |
| 42 | 41 |
| 43 if (!rootRelativeBoundsComputed) { | 42 if (!rootRelativeBoundsComputed) { |
| 44 rootRelativeBounds = layer.physicalBoundingBoxIncludingReflectionAndStac
kingChildren(paintingInfo.rootLayer, offsetFromRoot); | 43 rootRelativeBounds = layer.physicalBoundingBoxIncludingReflectionAndStac
kingChildren(paintingInfo.rootLayer, offsetFromRoot); |
| 45 rootRelativeBoundsComputed = true; | 44 rootRelativeBoundsComputed = true; |
| 46 } | 45 } |
| 47 | 46 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 OwnPtr<EndFilterDisplayItem> endFilterDisplayItem = EndFilterDisplayItem::cr
eate(*m_layoutObject); | 82 OwnPtr<EndFilterDisplayItem> endFilterDisplayItem = EndFilterDisplayItem::cr
eate(*m_layoutObject); |
| 84 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 83 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 85 ASSERT(m_context->displayItemList()); | 84 ASSERT(m_context->displayItemList()); |
| 86 m_context->displayItemList()->add(endFilterDisplayItem.release()); | 85 m_context->displayItemList()->add(endFilterDisplayItem.release()); |
| 87 } else { | 86 } else { |
| 88 endFilterDisplayItem->replay(*m_context); | 87 endFilterDisplayItem->replay(*m_context); |
| 89 } | 88 } |
| 90 } | 89 } |
| 91 | 90 |
| 92 } // namespace blink | 91 } // namespace blink |
| OLD | NEW |