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 "cc/playback/clip_display_item.h" | 5 #include "cc/playback/clip_display_item.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 for (const auto& rrect : rounded_clip_rects_) { | 55 for (const auto& rrect : rounded_clip_rects_) { |
56 SkRRectToProto(rrect, details->add_rounded_rects()); | 56 SkRRectToProto(rrect, details->add_rounded_rects()); |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 void ClipDisplayItem::Raster(SkCanvas* canvas, | 60 void ClipDisplayItem::Raster(SkCanvas* canvas, |
61 const gfx::Rect& canvas_target_playback_rect, | 61 const gfx::Rect& canvas_target_playback_rect, |
62 SkPicture::AbortCallback* callback) const { | 62 SkPicture::AbortCallback* callback) const { |
63 canvas->save(); | 63 canvas->save(); |
64 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(), | 64 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(), |
65 clip_rect_.width(), clip_rect_.height())); | 65 clip_rect_.width(), clip_rect_.height()), |
66 SkRegion::kIntersect_Op, true); | |
ajuma
2016/01/08 14:15:04
Please use a variable for the bool rather than jus
chrishtr
2016/01/12 23:43:14
Done
| |
66 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { | 67 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { |
67 if (rounded_clip_rects_[i].isRect()) { | 68 if (rounded_clip_rects_[i].isRect()) { |
68 canvas->clipRect(rounded_clip_rects_[i].rect()); | 69 canvas->clipRect(rounded_clip_rects_[i].rect(), SkRegion::kIntersect_Op, |
70 true); | |
69 } else { | 71 } else { |
70 bool antialiased = true; | 72 canvas->clipRRect(rounded_clip_rects_[i], SkRegion::kIntersect_Op, true); |
71 canvas->clipRRect(rounded_clip_rects_[i], SkRegion::kIntersect_Op, | |
72 antialiased); | |
73 } | 73 } |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 void ClipDisplayItem::AsValueInto(const gfx::Rect& visual_rect, | 77 void ClipDisplayItem::AsValueInto(const gfx::Rect& visual_rect, |
78 base::trace_event::TracedValue* array) const { | 78 base::trace_event::TracedValue* array) const { |
79 std::string value = base::StringPrintf( | 79 std::string value = base::StringPrintf( |
80 "ClipDisplayItem rect: [%s] visualRect: [%s]", | 80 "ClipDisplayItem rect: [%s] visualRect: [%s]", |
81 clip_rect_.ToString().c_str(), visual_rect.ToString().c_str()); | 81 clip_rect_.ToString().c_str(), visual_rect.ToString().c_str()); |
82 for (const SkRRect& rounded_rect : rounded_clip_rects_) { | 82 for (const SkRRect& rounded_rect : rounded_clip_rects_) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 base::trace_event::TracedValue* array) const { | 130 base::trace_event::TracedValue* array) const { |
131 array->AppendString(base::StringPrintf("EndClipDisplayItem visualRect: [%s]", | 131 array->AppendString(base::StringPrintf("EndClipDisplayItem visualRect: [%s]", |
132 visual_rect.ToString().c_str())); | 132 visual_rect.ToString().c_str())); |
133 } | 133 } |
134 | 134 |
135 size_t EndClipDisplayItem::ExternalMemoryUsage() const { | 135 size_t EndClipDisplayItem::ExternalMemoryUsage() const { |
136 return 0; | 136 return 0; |
137 } | 137 } |
138 | 138 |
139 } // namespace cc | 139 } // namespace cc |
OLD | NEW |