| 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 "core/paint/RoundedInnerRectClipper.h" | 5 #include "core/paint/RoundedInnerRectClipper.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutObject.h" | 7 #include "core/layout/LayoutObject.h" |
| 8 #include "core/paint/PaintInfo.h" | 8 #include "core/paint/PaintInfo.h" |
| 9 #include "platform/graphics/paint/ClipDisplayItem.h" | 9 #include "platform/graphics/paint/ClipDisplayItem.h" |
| 10 #include "platform/graphics/paint/PaintController.h" | 10 #include "platform/graphics/paint/PaintController.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 RoundedInnerRectClipper::RoundedInnerRectClipper(const LayoutObject& layoutObjec
t, const PaintInfo& paintInfo, const LayoutRect& rect, const FloatRoundedRect& c
lipRect, RoundedInnerRectClipperBehavior behavior) | 14 RoundedInnerRectClipper::RoundedInnerRectClipper(const LayoutObject& layoutObjec
t, const PaintInfo& paintInfo, const LayoutRect& rect, const FloatRoundedRect& c
lipRect, RoundedInnerRectClipperBehavior behavior) |
| 15 : m_layoutObject(layoutObject) | 15 : m_layoutObject(layoutObject) |
| 16 , m_paintInfo(paintInfo) | 16 , m_paintInfo(paintInfo) |
| 17 , m_usePaintController(behavior == ApplyToDisplayList) | 17 , m_usePaintController(behavior == ApplyToDisplayList) |
| 18 , m_clipType(m_usePaintController ? m_paintInfo.displayItemTypeForClipping()
: DisplayItem::ClipBoxPaintPhaseFirst) | 18 , m_clipType(m_usePaintController ? m_paintInfo.displayItemTypeForClipping()
: DisplayItem::kClipBoxPaintPhaseFirst) |
| 19 { | 19 { |
| 20 Vector<FloatRoundedRect> roundedRectClips; | 20 Vector<FloatRoundedRect> roundedRectClips; |
| 21 if (clipRect.isRenderable()) { | 21 if (clipRect.isRenderable()) { |
| 22 roundedRectClips.append(clipRect); | 22 roundedRectClips.append(clipRect); |
| 23 } else { | 23 } else { |
| 24 // We create a rounded rect for each of the corners and clip it, while m
aking sure we clip opposing corners together. | 24 // We create a rounded rect for each of the corners and clip it, while m
aking sure we clip opposing corners together. |
| 25 if (!clipRect.getRadii().topLeft().isEmpty() || !clipRect.getRadii().bot
tomRight().isEmpty()) { | 25 if (!clipRect.getRadii().topLeft().isEmpty() || !clipRect.getRadii().bot
tomRight().isEmpty()) { |
| 26 FloatRect topCorner(clipRect.rect().x(), clipRect.rect().y(), rect.m
axX() - clipRect.rect().x(), rect.maxY() - clipRect.rect().y()); | 26 FloatRect topCorner(clipRect.rect().x(), clipRect.rect().y(), rect.m
axX() - clipRect.rect().x(), rect.maxY() - clipRect.rect().y()); |
| 27 FloatRoundedRect::Radii topCornerRadii; | 27 FloatRoundedRect::Radii topCornerRadii; |
| 28 topCornerRadii.setTopLeft(clipRect.getRadii().topLeft()); | 28 topCornerRadii.setTopLeft(clipRect.getRadii().topLeft()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_clipType); | 60 DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_clipType); |
| 61 if (m_usePaintController) { | 61 if (m_usePaintController) { |
| 62 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>(m_l
ayoutObject, endType); | 62 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>(m_l
ayoutObject, endType); |
| 63 } else { | 63 } else { |
| 64 EndClipDisplayItem endClipDisplayItem(m_layoutObject, endType); | 64 EndClipDisplayItem endClipDisplayItem(m_layoutObject, endType); |
| 65 endClipDisplayItem.replay(m_paintInfo.context); | 65 endClipDisplayItem.replay(m_paintInfo.context); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace blink | 69 } // namespace blink |
| OLD | NEW |