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

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

Issue 2392443009: reflow comments in core/paint (Closed)
Patch Set: Created 4 years, 2 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 26 matching lines...) Expand all
37 return; 37 return;
38 38
39 DCHECK(layer.filterInfo()); 39 DCHECK(layer.filterInfo());
40 40
41 sk_sp<SkImageFilter> imageFilter = 41 sk_sp<SkImageFilter> imageFilter =
42 SkiaImageFilterBuilder::build(lastEffect, ColorSpaceDeviceRGB); 42 SkiaImageFilterBuilder::build(lastEffect, ColorSpaceDeviceRGB);
43 if (!imageFilter) 43 if (!imageFilter)
44 return; 44 return;
45 45
46 // We'll handle clipping to the dirty rect before filter rasterization. 46 // We'll handle clipping to the dirty rect before filter rasterization.
47 // Filter processing will automatically expand the clip rect and the offscreen to accommodate any filter outsets. 47 // Filter processing will automatically expand the clip rect and the offscreen
48 // FIXME: It is incorrect to just clip to the damageRect here once multiple fr agments are involved. 48 // to accommodate any filter outsets.
49 // FIXME: It is incorrect to just clip to the damageRect here once multiple
50 // fragments are involved.
49 51
50 // Subsequent code should not clip to the dirty rect, since we've already 52 // Subsequent code should not clip to the dirty rect, since we've already
51 // done it above, and doing it later will defeat the outsets. 53 // done it above, and doing it later will defeat the outsets.
52 paintingInfo.clipToDirtyRect = false; 54 paintingInfo.clipToDirtyRect = false;
53 55
54 DCHECK(m_layoutObject); 56 DCHECK(m_layoutObject);
55 57
56 if (clipRect.rect() != paintingInfo.paintDirtyRect || clipRect.hasRadius()) 58 if (clipRect.rect() != paintingInfo.paintDirtyRect || clipRect.hasRadius())
57 m_clipRecorder = wrapUnique(new LayerClipRecorder( 59 m_clipRecorder = wrapUnique(new LayerClipRecorder(
58 context, *layer.layoutObject(), DisplayItem::kClipLayerFilter, clipRect, 60 context, *layer.layoutObject(), DisplayItem::kClipLayerFilter, clipRect,
59 &paintingInfo, LayoutPoint(), paintFlags)); 61 &paintingInfo, LayoutPoint(), paintFlags));
60 62
61 if (!context.getPaintController().displayItemConstructionIsDisabled()) { 63 if (!context.getPaintController().displayItemConstructionIsDisabled()) {
62 CompositorFilterOperations compositorFilterOperations = 64 CompositorFilterOperations compositorFilterOperations =
63 layer.createCompositorFilterOperationsForFilter( 65 layer.createCompositorFilterOperationsForFilter(
64 m_layoutObject->styleRef()); 66 m_layoutObject->styleRef());
65 // FIXME: It's possible to have empty CompositorFilterOperations here even 67 // FIXME: It's possible to have empty CompositorFilterOperations here even
66 // though the SkImageFilter produced above is non-null, since the 68 // though the SkImageFilter produced above is non-null, since the
67 // layer's FilterEffectBuilder can have a stale representation of 69 // layer's FilterEffectBuilder can have a stale representation of
68 // the layer's filter. See crbug.com/502026. 70 // the layer's filter. See crbug.com/502026.
69 if (compositorFilterOperations.isEmpty()) 71 if (compositorFilterOperations.isEmpty())
70 return; 72 return;
71 LayoutRect visualBounds( 73 LayoutRect visualBounds(
72 layer.physicalBoundingBoxIncludingStackingChildren(offsetFromRoot)); 74 layer.physicalBoundingBoxIncludingStackingChildren(offsetFromRoot));
73 if (layer.enclosingPaginationLayer()) { 75 if (layer.enclosingPaginationLayer()) {
74 // Filters are set up before pagination, so we need to make the bounding b ox visual on our own. 76 // Filters are set up before pagination, so we need to make the bounding
77 // box visual on our own.
75 visualBounds.moveBy(-offsetFromRoot); 78 visualBounds.moveBy(-offsetFromRoot);
76 layer.convertFromFlowThreadToVisualBoundingBoxInAncestor( 79 layer.convertFromFlowThreadToVisualBoundingBoxInAncestor(
77 paintingInfo.rootLayer, visualBounds); 80 paintingInfo.rootLayer, visualBounds);
78 } 81 }
79 FloatPoint origin(offsetFromRoot); 82 FloatPoint origin(offsetFromRoot);
80 context.getPaintController().createAndAppend<BeginFilterDisplayItem>( 83 context.getPaintController().createAndAppend<BeginFilterDisplayItem>(
81 *m_layoutObject, std::move(imageFilter), FloatRect(visualBounds), 84 *m_layoutObject, std::move(imageFilter), FloatRect(visualBounds),
82 origin, std::move(compositorFilterOperations)); 85 origin, std::move(compositorFilterOperations));
83 } 86 }
84 87
85 m_filterInProgress = true; 88 m_filterInProgress = true;
86 } 89 }
87 90
88 FilterPainter::~FilterPainter() { 91 FilterPainter::~FilterPainter() {
89 if (!m_filterInProgress) 92 if (!m_filterInProgress)
90 return; 93 return;
91 94
92 m_context.getPaintController().endItem<EndFilterDisplayItem>(*m_layoutObject); 95 m_context.getPaintController().endItem<EndFilterDisplayItem>(*m_layoutObject);
93 } 96 }
94 97
95 } // namespace blink 98 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/FilterEffectBuilder.cpp ('k') | third_party/WebKit/Source/core/paint/FramePainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698