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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 proto::ClipDisplayItem* details = proto->mutable_clip_item(); | 55 proto::ClipDisplayItem* details = proto->mutable_clip_item(); |
56 RectToProto(clip_rect_, details->mutable_clip_rect()); | 56 RectToProto(clip_rect_, details->mutable_clip_rect()); |
57 DCHECK_EQ(0, details->rounded_rects_size()); | 57 DCHECK_EQ(0, details->rounded_rects_size()); |
58 for (const auto& rrect : rounded_clip_rects_) { | 58 for (const auto& rrect : rounded_clip_rects_) { |
59 SkRRectToProto(rrect, details->add_rounded_rects()); | 59 SkRRectToProto(rrect, details->add_rounded_rects()); |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 void ClipDisplayItem::Raster(SkCanvas* canvas, | 63 void ClipDisplayItem::Raster(SkCanvas* canvas, |
64 const gfx::Rect& canvas_target_playback_rect, | |
65 SkPicture::AbortCallback* callback) const { | 64 SkPicture::AbortCallback* callback) const { |
66 bool antialiased = true; | 65 bool antialiased = true; |
67 canvas->save(); | 66 canvas->save(); |
68 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(), | 67 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(), |
69 clip_rect_.width(), clip_rect_.height()), | 68 clip_rect_.width(), clip_rect_.height()), |
70 SkRegion::kIntersect_Op, antialiased); | 69 SkRegion::kIntersect_Op, antialiased); |
71 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { | 70 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { |
72 if (rounded_clip_rects_[i].isRect()) { | 71 if (rounded_clip_rects_[i].isRect()) { |
73 canvas->clipRect(rounded_clip_rects_[i].rect(), SkRegion::kIntersect_Op, | 72 canvas->clipRect(rounded_clip_rects_[i].rect(), SkRegion::kIntersect_Op, |
74 antialiased); | 73 antialiased); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 EndClipDisplayItem::~EndClipDisplayItem() { | 119 EndClipDisplayItem::~EndClipDisplayItem() { |
121 } | 120 } |
122 | 121 |
123 void EndClipDisplayItem::ToProtobuf( | 122 void EndClipDisplayItem::ToProtobuf( |
124 proto::DisplayItem* proto, | 123 proto::DisplayItem* proto, |
125 ImageSerializationProcessor* image_serialization_processor) const { | 124 ImageSerializationProcessor* image_serialization_processor) const { |
126 proto->set_type(proto::DisplayItem::Type_EndClip); | 125 proto->set_type(proto::DisplayItem::Type_EndClip); |
127 } | 126 } |
128 | 127 |
129 void EndClipDisplayItem::Raster(SkCanvas* canvas, | 128 void EndClipDisplayItem::Raster(SkCanvas* canvas, |
130 const gfx::Rect& canvas_target_playback_rect, | |
131 SkPicture::AbortCallback* callback) const { | 129 SkPicture::AbortCallback* callback) const { |
132 canvas->restore(); | 130 canvas->restore(); |
133 } | 131 } |
134 | 132 |
135 void EndClipDisplayItem::AsValueInto( | 133 void EndClipDisplayItem::AsValueInto( |
136 const gfx::Rect& visual_rect, | 134 const gfx::Rect& visual_rect, |
137 base::trace_event::TracedValue* array) const { | 135 base::trace_event::TracedValue* array) const { |
138 array->AppendString(base::StringPrintf("EndClipDisplayItem visualRect: [%s]", | 136 array->AppendString(base::StringPrintf("EndClipDisplayItem visualRect: [%s]", |
139 visual_rect.ToString().c_str())); | 137 visual_rect.ToString().c_str())); |
140 } | 138 } |
141 | 139 |
142 size_t EndClipDisplayItem::ExternalMemoryUsage() const { | 140 size_t EndClipDisplayItem::ExternalMemoryUsage() const { |
143 return 0; | 141 return 0; |
144 } | 142 } |
145 | 143 |
146 } // namespace cc | 144 } // namespace cc |
OLD | NEW |