Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: cc/playback/transform_display_item.cc

Issue 1407793002: Add protobuf serialization to DisplayItemList (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blimp_display2
Patch Set: Rebased Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/playback/transform_display_item.cc
diff --git a/cc/playback/transform_display_item.cc b/cc/playback/transform_display_item.cc
index b52f138a53840bd23ebdc6ebc3bc756ac7ed5e56..86ba6dec2bd769810efab0b86cfea113802a33c0 100644
--- a/cc/playback/transform_display_item.cc
+++ b/cc/playback/transform_display_item.cc
@@ -6,6 +6,8 @@
#include "base/strings/stringprintf.h"
#include "base/trace_event/trace_event_argument.h"
+#include "cc/proto/display_item.pb.h"
+#include "cc/proto/gfx_conversions.h"
#include "third_party/skia/include/core/SkCanvas.h"
namespace cc {
@@ -24,6 +26,22 @@ void TransformDisplayItem::SetNew(const gfx::Transform& transform) {
0 /* external_memory_usage */);
}
+void TransformDisplayItem::ToProtobuf(proto::DisplayItem* proto) {
+ proto->set_type(proto::DisplayItem::Type_Transform);
+
+ proto::TransformDisplayItem* details = proto->mutable_details_transform();
+ TransformToProto(transform_, details->mutable_transform());
+}
+
+void TransformDisplayItem::FromProtobuf(const proto::DisplayItem& proto) {
+ DCHECK_EQ(proto::DisplayItem::Type_Transform, proto.type());
+
+ const proto::TransformDisplayItem& details = proto.details_transform();
+ gfx::Transform transform = ProtoToTransform(details.transform());
+
+ SetNew(transform);
+}
+
void TransformDisplayItem::Raster(SkCanvas* canvas,
const gfx::Rect& canvas_target_playback_rect,
SkPicture::AbortCallback* callback) const {
@@ -53,6 +71,14 @@ EndTransformDisplayItem::EndTransformDisplayItem() {
EndTransformDisplayItem::~EndTransformDisplayItem() {
}
+void EndTransformDisplayItem::ToProtobuf(proto::DisplayItem* proto) {
+ proto->set_type(proto::DisplayItem::Type_EndTransform);
+}
+
+void EndTransformDisplayItem::FromProtobuf(const proto::DisplayItem& proto) {
+ DCHECK_EQ(proto::DisplayItem::Type_EndTransform, proto.type());
+}
+
void EndTransformDisplayItem::Raster(
SkCanvas* canvas,
const gfx::Rect& canvas_target_playback_rect,

Powered by Google App Engine
This is Rietveld 408576698