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

Side by Side Diff: Source/core/paint/LayerClipRecorder.cpp

Issue 1193433004: Blink-side contiguous allocation of display items. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Ready for review Created 5 years, 6 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 "config.h" 5 #include "config.h"
6 #include "core/paint/LayerClipRecorder.h" 6 #include "core/paint/LayerClipRecorder.h"
7 7
8 #include "core/layout/ClipRect.h" 8 #include "core/layout/ClipRect.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/paint/DeprecatedPaintLayer.h" 10 #include "core/paint/DeprecatedPaintLayer.h"
11 #include "platform/RuntimeEnabledFeatures.h" 11 #include "platform/RuntimeEnabledFeatures.h"
12 #include "platform/geometry/IntRect.h" 12 #include "platform/geometry/IntRect.h"
13 #include "platform/graphics/GraphicsContext.h" 13 #include "platform/graphics/GraphicsContext.h"
14 #include "platform/graphics/GraphicsLayer.h" 14 #include "platform/graphics/GraphicsLayer.h"
15 #include "platform/graphics/paint/ClipRecorder.h" 15 #include "platform/graphics/paint/ClipRecorder.h"
16 #include "platform/graphics/paint/DisplayItemList.h" 16 #include "platform/graphics/paint/DisplayItemList.h"
17 17
18 namespace blink { 18 namespace blink {
19 19
20 LayerClipRecorder::LayerClipRecorder(GraphicsContext& graphicsContext, const Lay outBoxModelObject& layoutObject, DisplayItem::Type clipType, const ClipRect& cli pRect, 20 LayerClipRecorder::LayerClipRecorder(GraphicsContext& graphicsContext, const Lay outBoxModelObject& layoutObject, DisplayItem::Type clipType, const ClipRect& cli pRect,
21 const DeprecatedPaintLayerPaintingInfo* localPaintingInfo, const LayoutPoint & fragmentOffset, PaintLayerFlags paintFlags, BorderRadiusClippingRule rule) 21 const DeprecatedPaintLayerPaintingInfo* localPaintingInfo, const LayoutPoint & fragmentOffset, PaintLayerFlags paintFlags, BorderRadiusClippingRule rule)
22 : m_graphicsContext(graphicsContext) 22 : m_graphicsContext(graphicsContext)
23 , m_layoutObject(layoutObject) 23 , m_layoutObject(layoutObject)
24 , m_clipType(clipType) 24 , m_clipType(clipType)
25 { 25 {
26 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect()); 26 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect());
27 OwnPtr<ClipDisplayItem> clipDisplayItem = ClipDisplayItem::create(layoutObje ct, clipType, snappedClipRect); 27 OwnPtr<Vector<FloatRoundedRect>> roundedRectClips;
28 if (localPaintingInfo && clipRect.hasRadius()) 28 if (localPaintingInfo && clipRect.hasRadius()) {
29 collectRoundedRectClips(*layoutObject.layer(), *localPaintingInfo, graph icsContext, fragmentOffset, paintFlags, rule, clipDisplayItem->roundedRectClips( )); 29 roundedRectClips = adoptPtr(new Vector<FloatRoundedRect>());
30 collectRoundedRectClips(*layoutObject.layer(), *localPaintingInfo, graph icsContext, fragmentOffset, paintFlags, rule, *roundedRectClips);
31 }
30 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) { 32 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) {
31 clipDisplayItem->replay(graphicsContext); 33 ClipDisplayItem clipDisplayItem(layoutObject, clipType, snappedClipRect, roundedRectClips.release());
34 clipDisplayItem.replay(graphicsContext);
32 } else { 35 } else {
33 ASSERT(m_graphicsContext.displayItemList()); 36 ASSERT(m_graphicsContext.displayItemList());
34 if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisabl ed()) 37 if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisabl ed())
35 return; 38 return;
36 m_graphicsContext.displayItemList()->add(clipDisplayItem.release()); 39 m_graphicsContext.displayItemList()->createAndAppendIfNeeded<ClipDisplay Item>(layoutObject, clipType, snappedClipRect, roundedRectClips.release());
37 } 40 }
38 } 41 }
39 42
40 static bool inContainingBlockChain(DeprecatedPaintLayer* startLayer, DeprecatedP aintLayer* endLayer) 43 static bool inContainingBlockChain(DeprecatedPaintLayer* startLayer, DeprecatedP aintLayer* endLayer)
41 { 44 {
42 if (startLayer == endLayer) 45 if (startLayer == endLayer)
43 return true; 46 return true;
44 47
45 LayoutView* view = startLayer->layoutObject()->view(); 48 LayoutView* view = startLayer->layoutObject()->view();
46 for (LayoutBlock* currentBlock = startLayer->layoutObject()->containingBlock (); currentBlock && currentBlock != view; currentBlock = currentBlock->containin gBlock()) { 49 for (LayoutBlock* currentBlock = startLayer->layoutObject()->containingBlock (); currentBlock && currentBlock != view; currentBlock = currentBlock->containin gBlock()) {
(...skipping 29 matching lines...) Expand all
76 } 79 }
77 } 80 }
78 81
79 LayerClipRecorder::~LayerClipRecorder() 82 LayerClipRecorder::~LayerClipRecorder()
80 { 83 {
81 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { 84 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
82 ASSERT(m_graphicsContext.displayItemList()); 85 ASSERT(m_graphicsContext.displayItemList());
83 if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisabl ed()) 86 if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisabl ed())
84 return; 87 return;
85 DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_clipTyp e); 88 DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_clipTyp e);
86 OwnPtr<EndClipDisplayItem> endClip = EndClipDisplayItem::create(m_layout Object, endType); 89 m_graphicsContext.displayItemList()->createAndAppendIfNeeded<EndClipDisp layItem>(m_layoutObject, endType);
87 m_graphicsContext.displayItemList()->add(endClip.release());
88 } else { 90 } else {
89 m_graphicsContext.restore(); 91 m_graphicsContext.restore();
90 } 92 }
91 } 93 }
92 94
93 } // namespace blink 95 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698