OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/RoundedInnerRectClipper.h" | 6 #include "core/paint/RoundedInnerRectClipper.h" |
7 | 7 |
8 #include "core/layout/LayoutBox.h" | 8 #include "core/layout/LayoutBox.h" |
9 #include "core/paint/PaintInfo.h" | 9 #include "core/paint/PaintInfo.h" |
10 #include "platform/graphics/paint/ClipDisplayItem.h" | 10 #include "platform/graphics/paint/ClipDisplayItem.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 topCornerRadii.setTopRight(clipRect.radii().topRight()); | 41 topCornerRadii.setTopRight(clipRect.radii().topRight()); |
42 roundedRectClips->append(FloatRoundedRect(topCorner, topCornerRadii)
); | 42 roundedRectClips->append(FloatRoundedRect(topCorner, topCornerRadii)
); |
43 | 43 |
44 FloatRect bottomCorner(clipRect.rect().x(), rect.y().toFloat(), rect
.maxX() - clipRect.rect().x(), clipRect.rect().maxY() - rect.y().toFloat()); | 44 FloatRect bottomCorner(clipRect.rect().x(), rect.y().toFloat(), rect
.maxX() - clipRect.rect().x(), clipRect.rect().maxY() - rect.y().toFloat()); |
45 FloatRoundedRect::Radii bottomCornerRadii; | 45 FloatRoundedRect::Radii bottomCornerRadii; |
46 bottomCornerRadii.setBottomLeft(clipRect.radii().bottomLeft()); | 46 bottomCornerRadii.setBottomLeft(clipRect.radii().bottomLeft()); |
47 roundedRectClips->append(FloatRoundedRect(bottomCorner, bottomCorner
Radii)); | 47 roundedRectClips->append(FloatRoundedRect(bottomCorner, bottomCorner
Radii)); |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 OwnPtr<ClipDisplayItem> clipDisplayItem = ClipDisplayItem::create(layoutObje
ct, m_clipType, LayoutRect::infiniteIntRect(), roundedRectClips.release()); | |
52 if (m_useDisplayItemList) { | 51 if (m_useDisplayItemList) { |
53 ASSERT(m_paintInfo.context->displayItemList()); | 52 ASSERT(m_paintInfo.context->displayItemList()); |
54 if (m_paintInfo.context->displayItemList()->displayItemConstructionIsDis
abled()) | 53 if (m_paintInfo.context->displayItemList()->displayItemConstructionIsDis
abled()) |
55 return; | 54 return; |
56 m_paintInfo.context->displayItemList()->add(clipDisplayItem.release()); | 55 m_paintInfo.context->displayItemList()->createAndAppend<ClipDisplayItem>
(layoutObject, m_clipType, LayoutRect::infiniteIntRect(), roundedRectClips.relea
se()); |
57 } else { | 56 } else { |
58 clipDisplayItem->replay(*paintInfo.context); | 57 ClipDisplayItem clipDisplayItem(layoutObject, m_clipType, LayoutRect::in
finiteIntRect(), roundedRectClips.release()); |
| 58 clipDisplayItem.replay(*paintInfo.context); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 RoundedInnerRectClipper::~RoundedInnerRectClipper() | 62 RoundedInnerRectClipper::~RoundedInnerRectClipper() |
63 { | 63 { |
64 DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_clipType); | 64 DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_clipType); |
65 if (m_useDisplayItemList) { | 65 if (m_useDisplayItemList) { |
66 ASSERT(m_paintInfo.context->displayItemList()); | 66 ASSERT(m_paintInfo.context->displayItemList()); |
67 if (!m_paintInfo.context->displayItemList()->displayItemConstructionIsDi
sabled()) { | 67 if (!m_paintInfo.context->displayItemList()->displayItemConstructionIsDi
sabled()) { |
68 if (m_paintInfo.context->displayItemList()->lastDisplayItemIsNoopBeg
in()) | 68 if (m_paintInfo.context->displayItemList()->lastDisplayItemIsNoopBeg
in()) |
69 m_paintInfo.context->displayItemList()->removeLastDisplayItem(); | 69 m_paintInfo.context->displayItemList()->removeLastDisplayItem(); |
70 else | 70 else |
71 m_paintInfo.context->displayItemList()->add(EndClipDisplayItem::
create(m_layoutObject, endType)); | 71 m_paintInfo.context->displayItemList()->createAndAppend<EndClipD
isplayItem>(m_layoutObject, endType); |
72 } | 72 } |
73 } else { | 73 } else { |
74 EndClipDisplayItem endClipDisplayItem(m_layoutObject, endType); | 74 EndClipDisplayItem endClipDisplayItem(m_layoutObject, endType); |
75 endClipDisplayItem.replay(*m_paintInfo.context); | 75 endClipDisplayItem.replay(*m_paintInfo.context); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 } // namespace blink | 79 } // namespace blink |
OLD | NEW |