| Index: cc/playback/clip_display_item.cc
|
| diff --git a/cc/playback/clip_display_item.cc b/cc/playback/clip_display_item.cc
|
| index 96a2df8edb91f27c38be35292c8550b045e674ec..d89566c1e0d685a327e4a4e97bc05c791f38f2e2 100644
|
| --- a/cc/playback/clip_display_item.cc
|
| +++ b/cc/playback/clip_display_item.cc
|
| @@ -17,13 +17,36 @@
|
|
|
| namespace cc {
|
|
|
| -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) {
|
| +ClipDisplayItem::~ClipDisplayItem() {
|
| +}
|
| +
|
| +void ClipDisplayItem::SetNew(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);
|
| +}
|
| +
|
| +void ClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
|
| + proto->set_type(proto::DisplayItem::Type_Clip);
|
| +
|
| + proto::ClipDisplayItem* details = proto->mutable_clip_item();
|
| + RectToProto(clip_rect_, details->mutable_clip_rect());
|
| + DCHECK_EQ(0, details->rounded_rects_size());
|
| + for (const auto& rrect : rounded_clip_rects_) {
|
| + SkRRectToProto(rrect, details->add_rounded_rects());
|
| + }
|
| +}
|
| +
|
| +void ClipDisplayItem::FromProtobuf(const proto::DisplayItem& proto) {
|
| DCHECK_EQ(proto::DisplayItem::Type_Clip, proto.type());
|
|
|
| const proto::ClipDisplayItem& details = proto.clip_item();
|
| @@ -34,25 +57,6 @@
|
| rounded_clip_rects.push_back(ProtoToSkRRect(details.rounded_rects(i)));
|
| }
|
| SetNew(clip_rect, rounded_clip_rects);
|
| -}
|
| -
|
| -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;
|
| -}
|
| -
|
| -ClipDisplayItem::~ClipDisplayItem() {}
|
| -
|
| -void ClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
|
| - proto->set_type(proto::DisplayItem::Type_Clip);
|
| -
|
| - proto::ClipDisplayItem* details = proto->mutable_clip_item();
|
| - RectToProto(clip_rect_, details->mutable_clip_rect());
|
| - DCHECK_EQ(0, details->rounded_rects_size());
|
| - for (const auto& rrect : rounded_clip_rects_) {
|
| - SkRRectToProto(rrect, details->add_rounded_rects());
|
| - }
|
| }
|
|
|
| void ClipDisplayItem::Raster(SkCanvas* canvas,
|
| @@ -100,14 +104,9 @@
|
| array->AppendString(value);
|
| }
|
|
|
| -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() {
|
| + DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */,
|
| + 0 /* external_memory_usage */);
|
| }
|
|
|
| EndClipDisplayItem::~EndClipDisplayItem() {
|
| @@ -115,6 +114,10 @@
|
|
|
| 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,
|
| @@ -130,8 +133,4 @@
|
| visual_rect.ToString().c_str()));
|
| }
|
|
|
| -size_t EndClipDisplayItem::ExternalMemoryUsage() const {
|
| - return 0;
|
| -}
|
| -
|
| } // namespace cc
|
|
|