| Index: cc/playback/drawing_display_item.cc
|
| diff --git a/cc/playback/drawing_display_item.cc b/cc/playback/drawing_display_item.cc
|
| index f314608f74818dd4d2f3df7f484b9fe2b2b0d53f..05935778582c5d8d11b716610cac185db21816d5 100644
|
| --- a/cc/playback/drawing_display_item.cc
|
| +++ b/cc/playback/drawing_display_item.cc
|
| @@ -21,29 +21,7 @@
|
|
|
| namespace cc {
|
|
|
| -DrawingDisplayItem::DrawingDisplayItem() {}
|
| -
|
| -DrawingDisplayItem::DrawingDisplayItem(skia::RefPtr<SkPicture> picture) {
|
| - SetNew(std::move(picture));
|
| -}
|
| -
|
| -DrawingDisplayItem::DrawingDisplayItem(const proto::DisplayItem& proto) {
|
| - DCHECK_EQ(proto::DisplayItem::Type_Drawing, proto.type());
|
| -
|
| - skia::RefPtr<SkPicture> picture;
|
| - const proto::DrawingDisplayItem& details = proto.drawing_item();
|
| - if (details.has_picture()) {
|
| - SkMemoryStream stream(details.picture().data(), details.picture().size());
|
| -
|
| - // TODO(dtrainor, nyquist): Add an image decoder.
|
| - picture = skia::AdoptRef(SkPicture::CreateFromStream(&stream, nullptr));
|
| - }
|
| -
|
| - SetNew(std::move(picture));
|
| -}
|
| -
|
| -DrawingDisplayItem::DrawingDisplayItem(const DrawingDisplayItem& item) {
|
| - item.CloneTo(this);
|
| +DrawingDisplayItem::DrawingDisplayItem() {
|
| }
|
|
|
| DrawingDisplayItem::~DrawingDisplayItem() {
|
| @@ -51,6 +29,9 @@
|
|
|
| void DrawingDisplayItem::SetNew(skia::RefPtr<SkPicture> picture) {
|
| picture_ = std::move(picture);
|
| + DisplayItem::SetNew(picture_->suitableForGpuRasterization(NULL),
|
| + picture_->approximateOpCount(),
|
| + SkPictureUtils::ApproximateBytesUsed(picture_.get()));
|
| }
|
|
|
| void DrawingDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
|
| @@ -70,6 +51,21 @@
|
| details->set_picture(data->data(), data->size());
|
| }
|
| }
|
| +}
|
| +
|
| +void DrawingDisplayItem::FromProtobuf(const proto::DisplayItem& proto) {
|
| + DCHECK_EQ(proto::DisplayItem::Type_Drawing, proto.type());
|
| +
|
| + skia::RefPtr<SkPicture> picture;
|
| + const proto::DrawingDisplayItem& details = proto.drawing_item();
|
| + if (details.has_picture()) {
|
| + SkMemoryStream stream(details.picture().data(), details.picture().size());
|
| +
|
| + // TODO(dtrainor, nyquist): Add an image decoder.
|
| + picture = skia::AdoptRef(SkPicture::CreateFromStream(&stream, nullptr));
|
| + }
|
| +
|
| + SetNew(std::move(picture));
|
| }
|
|
|
| void DrawingDisplayItem::Raster(SkCanvas* canvas,
|
| @@ -123,16 +119,4 @@
|
| item->SetNew(picture_);
|
| }
|
|
|
| -size_t DrawingDisplayItem::ExternalMemoryUsage() const {
|
| - return SkPictureUtils::ApproximateBytesUsed(picture_.get());
|
| -}
|
| -
|
| -int DrawingDisplayItem::ApproximateOpCount() const {
|
| - return picture_->approximateOpCount();
|
| -}
|
| -
|
| -bool DrawingDisplayItem::IsSuitableForGpuRasterization() const {
|
| - return picture_->suitableForGpuRasterization(NULL);
|
| -}
|
| -
|
| } // namespace cc
|
|
|