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

Side by Side Diff: Source/platform/graphics/paint/ClipDisplayItem.cpp

Issue 815933006: Change all uses of the RoundedRect class to use FloatRoundedRect instead. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 12 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 | Annotate | Revision Log
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 "platform/graphics/paint/ClipDisplayItem.h" 6 #include "platform/graphics/paint/ClipDisplayItem.h"
7 7
8 #include "platform/geometry/RoundedRect.h" 8 #include "platform/geometry/FloatRoundedRect.h"
9 #include "platform/graphics/GraphicsContext.h" 9 #include "platform/graphics/GraphicsContext.h"
10 #include "public/platform/WebDisplayItemList.h" 10 #include "public/platform/WebDisplayItemList.h"
11 #include "third_party/skia/include/core/SkScalar.h" 11 #include "third_party/skia/include/core/SkScalar.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 void ClipDisplayItem::replay(GraphicsContext* context) 15 void ClipDisplayItem::replay(GraphicsContext* context)
16 { 16 {
17 context->save(); 17 context->save();
18 context->clipRect(m_clipRect, NotAntiAliased, m_operation); 18 context->clipRect(m_clipRect, NotAntiAliased, m_operation);
19 for (RoundedRect roundedRect : m_roundedRectClips) 19 for (FloatRoundedRect roundedRect : m_roundedRectClips)
20 context->clipRoundedRect(roundedRect, m_operation); 20 context->clipRoundedRect(roundedRect, m_operation);
21 } 21 }
22 22
23 void ClipDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* list) const 23 void ClipDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* 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 RoundedRect::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()));
31 skRadii[SkRRect::kUpperRight_Corner].set(SkIntToScalar(rectRadii.topRigh t().width()), 31 skRadii[SkRRect::kUpperRight_Corner].set(SkIntToScalar(rectRadii.topRigh t().width()),
32 SkIntToScalar(rectRadii.topRight().height())); 32 SkIntToScalar(rectRadii.topRight().height()));
33 skRadii[SkRRect::kLowerRight_Corner].set(SkIntToScalar(rectRadii.bottomR ight().width()), 33 skRadii[SkRRect::kLowerRight_Corner].set(SkIntToScalar(rectRadii.bottomR ight().width()),
34 SkIntToScalar(rectRadii.bottomRight().height())); 34 SkIntToScalar(rectRadii.bottomRight().height()));
35 skRadii[SkRRect::kLowerLeft_Corner].set(SkIntToScalar(rectRadii.bottomLe ft().width()), 35 skRadii[SkRRect::kLowerLeft_Corner].set(SkIntToScalar(rectRadii.bottomLe ft().width()),
36 SkIntToScalar(rectRadii.bottomLeft().height())); 36 SkIntToScalar(rectRadii.bottomLeft().height()));
37 SkRRect skRoundedRect; 37 SkRRect skRoundedRect;
(...skipping 17 matching lines...) Expand all
55 #ifndef NDEBUG 55 #ifndef NDEBUG
56 void ClipDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& stringBuil der) const 56 void ClipDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& stringBuil der) const
57 { 57 {
58 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); 58 DisplayItem::dumpPropertiesAsDebugString(stringBuilder);
59 stringBuilder.append(WTF::String::format(", clipRect: [%d,%d,%d,%d]", 59 stringBuilder.append(WTF::String::format(", clipRect: [%d,%d,%d,%d]",
60 m_clipRect.x(), m_clipRect.y(), m_clipRect.width(), m_clipRect.height()) ); 60 m_clipRect.x(), m_clipRect.y(), m_clipRect.width(), m_clipRect.height()) );
61 } 61 }
62 #endif 62 #endif
63 63
64 } // namespace blink 64 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/paint/ClipDisplayItem.h ('k') | Source/platform/graphics/paint/ClipRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698