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

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: Comments are hard 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
« no previous file with comments | « cc/playback/transform_display_item.h ('k') | cc/proto/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/playback/transform_display_item.cc
diff --git a/cc/playback/transform_display_item.cc b/cc/playback/transform_display_item.cc
index df7ca1b8e563944ec3cdf8e4ebd35f5afe329e39..d0e7de79499c947f83661ad87370ea120d228d36 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) const {
+ proto->set_type(proto::DisplayItem::Type_Transform);
+
+ proto::TransformDisplayItem* details = proto->mutable_transform_item();
+ 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.transform_item();
+ gfx::Transform transform = ProtoToTransform(details.transform());
+
+ SetNew(transform);
+}
+
void TransformDisplayItem::Raster(SkCanvas* canvas,
const gfx::Rect& canvas_target_playback_rect,
SkPicture::AbortCallback* callback) const {
@@ -46,6 +64,14 @@ EndTransformDisplayItem::EndTransformDisplayItem() {
EndTransformDisplayItem::~EndTransformDisplayItem() {
}
+void EndTransformDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
+ 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,
« no previous file with comments | « cc/playback/transform_display_item.h ('k') | cc/proto/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698