Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: third_party/WebKit/Source/core/paint/FilterPainter.cpp

Issue 2335253002: Push CompositorFilterOperations creation out of GraphicsLayer (Closed)
Patch Set: The right FilterOperations Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // Subsequent code should not clip to the dirty rect, since we've already 45 // Subsequent code should not clip to the dirty rect, since we've already
46 // done it above, and doing it later will defeat the outsets. 46 // done it above, and doing it later will defeat the outsets.
47 paintingInfo.clipToDirtyRect = false; 47 paintingInfo.clipToDirtyRect = false;
48 48
49 DCHECK(m_layoutObject); 49 DCHECK(m_layoutObject);
50 50
51 if (clipRect.rect() != paintingInfo.paintDirtyRect || clipRect.hasRadius()) 51 if (clipRect.rect() != paintingInfo.paintDirtyRect || clipRect.hasRadius())
52 m_clipRecorder = wrapUnique(new LayerClipRecorder(context, *layer.layout Object(), DisplayItem::kClipLayerFilter, clipRect, &paintingInfo, LayoutPoint(), paintFlags)); 52 m_clipRecorder = wrapUnique(new LayerClipRecorder(context, *layer.layout Object(), DisplayItem::kClipLayerFilter, clipRect, &paintingInfo, LayoutPoint(), paintFlags));
53 53
54 if (!context.getPaintController().displayItemConstructionIsDisabled()) { 54 if (!context.getPaintController().displayItemConstructionIsDisabled()) {
55 FilterOperations filterOperations(layer.computeFilterOperations(m_layout Object->styleRef())); 55 CompositorFilterOperations compositorFilterOperations = layer.createComp ositorFilterOperationsForFilter(m_layoutObject->styleRef());
56 CompositorFilterOperations compositorFilterOperations;
57 SkiaImageFilterBuilder::buildFilterOperations(filterOperations, &composi torFilterOperations);
58 // FIXME: It's possible to have empty CompositorFilterOperations here ev en 56 // FIXME: It's possible to have empty CompositorFilterOperations here ev en
59 // though the SkImageFilter produced above is non-null, since the 57 // though the SkImageFilter produced above is non-null, since the
60 // layer's FilterEffectBuilder can have a stale representation of 58 // layer's FilterEffectBuilder can have a stale representation of
61 // the layer's filter. See crbug.com/502026. 59 // the layer's filter. See crbug.com/502026.
62 if (compositorFilterOperations.isEmpty()) 60 if (compositorFilterOperations.isEmpty())
63 return; 61 return;
64 LayoutRect visualBounds(layer.physicalBoundingBoxIncludingReflectionAndS tackingChildren(offsetFromRoot)); 62 LayoutRect visualBounds(layer.physicalBoundingBoxIncludingReflectionAndS tackingChildren(offsetFromRoot));
65 if (layer.enclosingPaginationLayer()) { 63 if (layer.enclosingPaginationLayer()) {
66 // Filters are set up before pagination, so we need to make the boun ding box visual on our own. 64 // Filters are set up before pagination, so we need to make the boun ding box visual on our own.
67 visualBounds.moveBy(-offsetFromRoot); 65 visualBounds.moveBy(-offsetFromRoot);
68 layer.convertFromFlowThreadToVisualBoundingBoxInAncestor(paintingInf o.rootLayer, visualBounds); 66 layer.convertFromFlowThreadToVisualBoundingBoxInAncestor(paintingInf o.rootLayer, visualBounds);
69 } 67 }
70 FloatPoint origin(offsetFromRoot); 68 FloatPoint origin(offsetFromRoot);
71 context.getPaintController().createAndAppend<BeginFilterDisplayItem>(*m_ layoutObject, std::move(imageFilter), FloatRect(visualBounds), origin, std::move (compositorFilterOperations)); 69 context.getPaintController().createAndAppend<BeginFilterDisplayItem>(*m_ layoutObject, std::move(imageFilter), FloatRect(visualBounds), origin, std::move (compositorFilterOperations));
72 } 70 }
73 71
74 m_filterInProgress = true; 72 m_filterInProgress = true;
75 } 73 }
76 74
77 FilterPainter::~FilterPainter() 75 FilterPainter::~FilterPainter()
78 { 76 {
79 if (!m_filterInProgress) 77 if (!m_filterInProgress)
80 return; 78 return;
81 79
82 m_context.getPaintController().endItem<EndFilterDisplayItem>(*m_layoutObject ); 80 m_context.getPaintController().endItem<EndFilterDisplayItem>(*m_layoutObject );
83 } 81 }
84 82
85 } // namespace blink 83 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698