Index: cc/playback/clip_display_item.cc |
diff --git a/cc/playback/clip_display_item.cc b/cc/playback/clip_display_item.cc |
index d89566c1e0d685a327e4a4e97bc05c791f38f2e2..96a2df8edb91f27c38be35292c8550b045e674ec 100644 |
--- a/cc/playback/clip_display_item.cc |
+++ b/cc/playback/clip_display_item.cc |
@@ -17,24 +17,33 @@ |
namespace cc { |
-ClipDisplayItem::ClipDisplayItem() { |
+ClipDisplayItem::ClipDisplayItem( |
+ const gfx::Rect& clip_rect, |
+ const std::vector<SkRRect>& rounded_clip_rects) { |
+ SetNew(clip_rect, rounded_clip_rects); |
} |
-ClipDisplayItem::~ClipDisplayItem() { |
+ClipDisplayItem::ClipDisplayItem(const proto::DisplayItem& proto) { |
+ DCHECK_EQ(proto::DisplayItem::Type_Clip, proto.type()); |
+ |
+ const proto::ClipDisplayItem& details = proto.clip_item(); |
+ gfx::Rect clip_rect = ProtoToRect(details.clip_rect()); |
+ std::vector<SkRRect> rounded_clip_rects; |
+ rounded_clip_rects.reserve(details.rounded_rects_size()); |
+ for (int i = 0; i < details.rounded_rects_size(); i++) { |
+ rounded_clip_rects.push_back(ProtoToSkRRect(details.rounded_rects(i))); |
+ } |
+ SetNew(clip_rect, rounded_clip_rects); |
} |
-void ClipDisplayItem::SetNew(gfx::Rect clip_rect, |
+void ClipDisplayItem::SetNew(const gfx::Rect& clip_rect, |
const std::vector<SkRRect>& rounded_clip_rects) { |
clip_rect_ = clip_rect; |
rounded_clip_rects_ = rounded_clip_rects; |
- |
- size_t external_memory_usage = |
- rounded_clip_rects_.capacity() * sizeof(rounded_clip_rects_[0]); |
- |
- DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */, |
- external_memory_usage); |
} |
+ClipDisplayItem::~ClipDisplayItem() {} |
+ |
void ClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { |
proto->set_type(proto::DisplayItem::Type_Clip); |
@@ -46,19 +55,6 @@ void ClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { |
} |
} |
-void ClipDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { |
- DCHECK_EQ(proto::DisplayItem::Type_Clip, proto.type()); |
- |
- const proto::ClipDisplayItem& details = proto.clip_item(); |
- gfx::Rect clip_rect = ProtoToRect(details.clip_rect()); |
- std::vector<SkRRect> rounded_clip_rects; |
- rounded_clip_rects.reserve(details.rounded_rects_size()); |
- for (int i = 0; i < details.rounded_rects_size(); i++) { |
- rounded_clip_rects.push_back(ProtoToSkRRect(details.rounded_rects(i))); |
- } |
- SetNew(clip_rect, rounded_clip_rects); |
-} |
- |
void ClipDisplayItem::Raster(SkCanvas* canvas, |
const gfx::Rect& canvas_target_playback_rect, |
SkPicture::AbortCallback* callback) const { |
@@ -104,9 +100,14 @@ void ClipDisplayItem::AsValueInto(const gfx::Rect& visual_rect, |
array->AppendString(value); |
} |
-EndClipDisplayItem::EndClipDisplayItem() { |
- DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */, |
- 0 /* external_memory_usage */); |
+size_t ClipDisplayItem::ExternalMemoryUsage() const { |
+ return rounded_clip_rects_.capacity() * sizeof(rounded_clip_rects_[0]); |
+} |
+ |
+EndClipDisplayItem::EndClipDisplayItem() {} |
+ |
+EndClipDisplayItem::EndClipDisplayItem(const proto::DisplayItem& proto) { |
+ DCHECK_EQ(proto::DisplayItem::Type_EndClip, proto.type()); |
} |
EndClipDisplayItem::~EndClipDisplayItem() { |
@@ -116,10 +117,6 @@ void EndClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { |
proto->set_type(proto::DisplayItem::Type_EndClip); |
} |
-void EndClipDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { |
- DCHECK_EQ(proto::DisplayItem::Type_EndClip, proto.type()); |
-} |
- |
void EndClipDisplayItem::Raster(SkCanvas* canvas, |
const gfx::Rect& canvas_target_playback_rect, |
SkPicture::AbortCallback* callback) const { |
@@ -133,4 +130,8 @@ void EndClipDisplayItem::AsValueInto( |
visual_rect.ToString().c_str())); |
} |
+size_t EndClipDisplayItem::ExternalMemoryUsage() const { |
+ return 0; |
+} |
+ |
} // namespace cc |