| 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 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 void ClipDisplayItem::SetNew(const gfx::Rect& clip_rect, | 42 void ClipDisplayItem::SetNew(const gfx::Rect& clip_rect, |
| 43 const std::vector<SkRRect>& rounded_clip_rects) { | 43 const std::vector<SkRRect>& rounded_clip_rects) { |
| 44 clip_rect_ = clip_rect; | 44 clip_rect_ = clip_rect; |
| 45 rounded_clip_rects_ = rounded_clip_rects; | 45 rounded_clip_rects_ = rounded_clip_rects; |
| 46 } | 46 } |
| 47 | 47 |
| 48 ClipDisplayItem::~ClipDisplayItem() {} | 48 ClipDisplayItem::~ClipDisplayItem() {} |
| 49 | 49 |
| 50 void ClipDisplayItem::ToProtobuf( | 50 void ClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { |
| 51 proto::DisplayItem* proto, | |
| 52 ImageSerializationProcessor* image_serialization_processor) const { | |
| 53 proto->set_type(proto::DisplayItem::Type_Clip); | 51 proto->set_type(proto::DisplayItem::Type_Clip); |
| 54 | 52 |
| 55 proto::ClipDisplayItem* details = proto->mutable_clip_item(); | 53 proto::ClipDisplayItem* details = proto->mutable_clip_item(); |
| 56 RectToProto(clip_rect_, details->mutable_clip_rect()); | 54 RectToProto(clip_rect_, details->mutable_clip_rect()); |
| 57 DCHECK_EQ(0, details->rounded_rects_size()); | 55 DCHECK_EQ(0, details->rounded_rects_size()); |
| 58 for (const auto& rrect : rounded_clip_rects_) { | 56 for (const auto& rrect : rounded_clip_rects_) { |
| 59 SkRRectToProto(rrect, details->add_rounded_rects()); | 57 SkRRectToProto(rrect, details->add_rounded_rects()); |
| 60 } | 58 } |
| 61 } | 59 } |
| 62 | 60 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 111 |
| 114 EndClipDisplayItem::EndClipDisplayItem() {} | 112 EndClipDisplayItem::EndClipDisplayItem() {} |
| 115 | 113 |
| 116 EndClipDisplayItem::EndClipDisplayItem(const proto::DisplayItem& proto) { | 114 EndClipDisplayItem::EndClipDisplayItem(const proto::DisplayItem& proto) { |
| 117 DCHECK_EQ(proto::DisplayItem::Type_EndClip, proto.type()); | 115 DCHECK_EQ(proto::DisplayItem::Type_EndClip, proto.type()); |
| 118 } | 116 } |
| 119 | 117 |
| 120 EndClipDisplayItem::~EndClipDisplayItem() { | 118 EndClipDisplayItem::~EndClipDisplayItem() { |
| 121 } | 119 } |
| 122 | 120 |
| 123 void EndClipDisplayItem::ToProtobuf( | 121 void EndClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { |
| 124 proto::DisplayItem* proto, | |
| 125 ImageSerializationProcessor* image_serialization_processor) const { | |
| 126 proto->set_type(proto::DisplayItem::Type_EndClip); | 122 proto->set_type(proto::DisplayItem::Type_EndClip); |
| 127 } | 123 } |
| 128 | 124 |
| 129 void EndClipDisplayItem::Raster(SkCanvas* canvas, | 125 void EndClipDisplayItem::Raster(SkCanvas* canvas, |
| 130 const gfx::Rect& canvas_target_playback_rect, | 126 const gfx::Rect& canvas_target_playback_rect, |
| 131 SkPicture::AbortCallback* callback) const { | 127 SkPicture::AbortCallback* callback) const { |
| 132 canvas->restore(); | 128 canvas->restore(); |
| 133 } | 129 } |
| 134 | 130 |
| 135 void EndClipDisplayItem::AsValueInto( | 131 void EndClipDisplayItem::AsValueInto( |
| 136 const gfx::Rect& visual_rect, | 132 const gfx::Rect& visual_rect, |
| 137 base::trace_event::TracedValue* array) const { | 133 base::trace_event::TracedValue* array) const { |
| 138 array->AppendString(base::StringPrintf("EndClipDisplayItem visualRect: [%s]", | 134 array->AppendString(base::StringPrintf("EndClipDisplayItem visualRect: [%s]", |
| 139 visual_rect.ToString().c_str())); | 135 visual_rect.ToString().c_str())); |
| 140 } | 136 } |
| 141 | 137 |
| 142 size_t EndClipDisplayItem::ExternalMemoryUsage() const { | 138 size_t EndClipDisplayItem::ExternalMemoryUsage() const { |
| 143 return 0; | 139 return 0; |
| 144 } | 140 } |
| 145 | 141 |
| 146 } // namespace cc | 142 } // namespace cc |
| OLD | NEW |