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