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 "core/paint/FilterPainter.h" | 5 #include "core/paint/FilterPainter.h" |
6 | 6 |
7 #include "core/paint/FilterEffectBuilder.h" | 7 #include "core/paint/FilterEffectBuilder.h" |
8 #include "core/paint/LayerClipRecorder.h" | 8 #include "core/paint/LayerClipRecorder.h" |
9 #include "core/paint/PaintLayer.h" | 9 #include "core/paint/PaintLayer.h" |
10 #include "platform/RuntimeEnabledFeatures.h" | 10 #include "platform/RuntimeEnabledFeatures.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // done it above, and doing it later will defeat the outsets. | 55 // done it above, and doing it later will defeat the outsets. |
56 paintingInfo.clipToDirtyRect = false; | 56 paintingInfo.clipToDirtyRect = false; |
57 | 57 |
58 if (clipRect.rect() != paintingInfo.paintDirtyRect || clipRect.hasRadius())
{ | 58 if (clipRect.rect() != paintingInfo.paintDirtyRect || clipRect.hasRadius())
{ |
59 m_clipRecorder = adoptPtr(new LayerClipRecorder(context, *layer.layoutOb
ject(), DisplayItem::ClipLayerFilter, clipRect, &paintingInfo, LayoutPoint(), pa
intFlags)); | 59 m_clipRecorder = adoptPtr(new LayerClipRecorder(context, *layer.layoutOb
ject(), DisplayItem::ClipLayerFilter, clipRect, &paintingInfo, LayoutPoint(), pa
intFlags)); |
60 } | 60 } |
61 | 61 |
62 ASSERT(m_layoutObject); | 62 ASSERT(m_layoutObject); |
63 if (!context.paintController().displayItemConstructionIsDisabled()) { | 63 if (!context.paintController().displayItemConstructionIsDisabled()) { |
64 FilterOperations filterOperations(layer.computeFilterOperations(m_layout
Object->styleRef())); | 64 FilterOperations filterOperations(layer.computeFilterOperations(m_layout
Object->styleRef())); |
65 OwnPtr<CompositorFilterOperations> compositorFilterOperations = adoptPtr
(CompositorFactory::current().createFilterOperations()); | 65 OwnPtr<CompositorFilterOperations> compositorFilterOperations = Composit
orFactory::current().createFilterOperations(); |
66 builder.buildFilterOperations(filterOperations, compositorFilterOperatio
ns.get()); | 66 builder.buildFilterOperations(filterOperations, compositorFilterOperatio
ns.get()); |
67 // FIXME: It's possible to have empty CompositorFilterOperations here ev
en | 67 // FIXME: It's possible to have empty CompositorFilterOperations here ev
en |
68 // though the SkImageFilter produced above is non-null, since the | 68 // though the SkImageFilter produced above is non-null, since the |
69 // layer's FilterEffectBuilder can have a stale representation of | 69 // layer's FilterEffectBuilder can have a stale representation of |
70 // the layer's filter. See crbug.com/502026. | 70 // the layer's filter. See crbug.com/502026. |
71 if (compositorFilterOperations->isEmpty()) | 71 if (compositorFilterOperations->isEmpty()) |
72 return; | 72 return; |
73 LayoutRect visualBounds(rootRelativeBounds); | 73 LayoutRect visualBounds(rootRelativeBounds); |
74 if (layer.enclosingPaginationLayer()) { | 74 if (layer.enclosingPaginationLayer()) { |
75 // Filters are set up before pagination, so we need to make the boun
ding box visual on our own. | 75 // Filters are set up before pagination, so we need to make the boun
ding box visual on our own. |
76 visualBounds.moveBy(-offsetFromRoot); | 76 visualBounds.moveBy(-offsetFromRoot); |
77 layer.convertFromFlowThreadToVisualBoundingBoxInAncestor(paintingInf
o.rootLayer, visualBounds); | 77 layer.convertFromFlowThreadToVisualBoundingBoxInAncestor(paintingInf
o.rootLayer, visualBounds); |
78 } | 78 } |
79 context.paintController().createAndAppend<BeginFilterDisplayItem>(*m_lay
outObject, imageFilter, FloatRect(visualBounds), compositorFilterOperations.rele
ase()); | 79 context.paintController().createAndAppend<BeginFilterDisplayItem>(*m_lay
outObject, imageFilter, FloatRect(visualBounds), compositorFilterOperations.rele
ase()); |
80 } | 80 } |
81 | 81 |
82 m_filterInProgress = true; | 82 m_filterInProgress = true; |
83 } | 83 } |
84 | 84 |
85 FilterPainter::~FilterPainter() | 85 FilterPainter::~FilterPainter() |
86 { | 86 { |
87 if (!m_filterInProgress) | 87 if (!m_filterInProgress) |
88 return; | 88 return; |
89 | 89 |
90 m_context.paintController().endItem<EndFilterDisplayItem>(*m_layoutObject); | 90 m_context.paintController().endItem<EndFilterDisplayItem>(*m_layoutObject); |
91 } | 91 } |
92 | 92 |
93 } // namespace blink | 93 } // namespace blink |
OLD | NEW |