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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 RectToProto(clip_rect_, details->mutable_clip_rect()); | 53 RectToProto(clip_rect_, details->mutable_clip_rect()); |
54 DCHECK_EQ(0, details->rounded_rects_size()); | 54 DCHECK_EQ(0, details->rounded_rects_size()); |
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 bool antialiased = true; |
63 canvas->save(); | 64 canvas->save(); |
64 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(), | 65 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(), |
65 clip_rect_.width(), clip_rect_.height())); | 66 clip_rect_.width(), clip_rect_.height()), |
| 67 SkRegion::kIntersect_Op, antialiased); |
66 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { | 68 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { |
67 if (rounded_clip_rects_[i].isRect()) { | 69 if (rounded_clip_rects_[i].isRect()) { |
68 canvas->clipRect(rounded_clip_rects_[i].rect()); | 70 canvas->clipRect(rounded_clip_rects_[i].rect(), SkRegion::kIntersect_Op, |
| 71 antialiased); |
69 } else { | 72 } else { |
70 bool antialiased = true; | |
71 canvas->clipRRect(rounded_clip_rects_[i], SkRegion::kIntersect_Op, | 73 canvas->clipRRect(rounded_clip_rects_[i], SkRegion::kIntersect_Op, |
72 antialiased); | 74 antialiased); |
73 } | 75 } |
74 } | 76 } |
75 } | 77 } |
76 | 78 |
77 void ClipDisplayItem::AsValueInto(const gfx::Rect& visual_rect, | 79 void ClipDisplayItem::AsValueInto(const gfx::Rect& visual_rect, |
78 base::trace_event::TracedValue* array) const { | 80 base::trace_event::TracedValue* array) const { |
79 std::string value = base::StringPrintf( | 81 std::string value = base::StringPrintf( |
80 "ClipDisplayItem rect: [%s] visualRect: [%s]", | 82 "ClipDisplayItem rect: [%s] visualRect: [%s]", |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 base::trace_event::TracedValue* array) const { | 132 base::trace_event::TracedValue* array) const { |
131 array->AppendString(base::StringPrintf("EndClipDisplayItem visualRect: [%s]", | 133 array->AppendString(base::StringPrintf("EndClipDisplayItem visualRect: [%s]", |
132 visual_rect.ToString().c_str())); | 134 visual_rect.ToString().c_str())); |
133 } | 135 } |
134 | 136 |
135 size_t EndClipDisplayItem::ExternalMemoryUsage() const { | 137 size_t EndClipDisplayItem::ExternalMemoryUsage() const { |
136 return 0; | 138 return 0; |
137 } | 139 } |
138 | 140 |
139 } // namespace cc | 141 } // namespace cc |
OLD | NEW |