OLD | NEW |
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 "platform/graphics/paint/ClipDisplayItem.h" | 5 #include "platform/graphics/paint/ClipDisplayItem.h" |
6 | 6 |
7 #include "platform/geometry/FloatRoundedRect.h" | 7 #include "platform/geometry/FloatRoundedRect.h" |
8 #include "platform/graphics/GraphicsContext.h" | 8 #include "platform/graphics/GraphicsContext.h" |
9 #include "public/platform/WebDisplayItemList.h" | 9 #include "public/platform/WebDisplayItemList.h" |
10 #include "third_party/skia/include/core/SkScalar.h" | 10 #include "third_party/skia/include/core/SkScalar.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 void ClipDisplayItem::replay(GraphicsContext& context) const | 14 void ClipDisplayItem::replay(GraphicsContext& context) const |
15 { | 15 { |
16 context.save(); | 16 context.save(); |
17 context.clipRect(m_clipRect, NotAntiAliased, SkRegion::kIntersect_Op); | 17 context.clipRect(m_clipRect, AntiAliased); |
18 | 18 |
19 for (const FloatRoundedRect& roundedRect : m_roundedRectClips) | 19 for (const FloatRoundedRect& roundedRect : m_roundedRectClips) |
20 context.clipRoundedRect(roundedRect, SkRegion::kIntersect_Op); | 20 context.clipRoundedRect(roundedRect); |
21 } | 21 } |
22 | 22 |
23 void ClipDisplayItem::appendToWebDisplayItemList(const IntRect& visualRect, WebD
isplayItemList* list) const | 23 void ClipDisplayItem::appendToWebDisplayItemList(const IntRect& visualRect, WebD
isplayItemList* list) const |
24 { | 24 { |
25 WebVector<SkRRect> webRoundedRects(m_roundedRectClips.size()); | 25 WebVector<SkRRect> webRoundedRects(m_roundedRectClips.size()); |
26 for (size_t i = 0; i < m_roundedRectClips.size(); ++i) { | 26 for (size_t i = 0; i < m_roundedRectClips.size(); ++i) { |
27 FloatRoundedRect::Radii rectRadii = m_roundedRectClips[i].radii(); | 27 FloatRoundedRect::Radii rectRadii = m_roundedRectClips[i].radii(); |
28 SkVector skRadii[4]; | 28 SkVector skRadii[4]; |
29 skRadii[SkRRect::kUpperLeft_Corner].set(SkIntToScalar(rectRadii.topLeft(
).width()), | 29 skRadii[SkRRect::kUpperLeft_Corner].set(SkIntToScalar(rectRadii.topLeft(
).width()), |
30 SkIntToScalar(rectRadii.topLeft().height())); | 30 SkIntToScalar(rectRadii.topLeft().height())); |
(...skipping 23 matching lines...) Expand all Loading... |
54 #ifndef NDEBUG | 54 #ifndef NDEBUG |
55 void ClipDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& stringBuil
der) const | 55 void ClipDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& stringBuil
der) const |
56 { | 56 { |
57 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); | 57 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); |
58 stringBuilder.append(WTF::String::format(", clipRect: [%d,%d,%d,%d]", | 58 stringBuilder.append(WTF::String::format(", clipRect: [%d,%d,%d,%d]", |
59 m_clipRect.x(), m_clipRect.y(), m_clipRect.width(), m_clipRect.height())
); | 59 m_clipRect.x(), m_clipRect.y(), m_clipRect.width(), m_clipRect.height())
); |
60 } | 60 } |
61 #endif | 61 #endif |
62 | 62 |
63 } // namespace blink | 63 } // namespace blink |
OLD | NEW |