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

Unified Diff: cc/playback/float_clip_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/float_clip_display_item.cc
diff --git a/cc/playback/float_clip_display_item.cc b/cc/playback/float_clip_display_item.cc
index 5ba79a53f17b44d5062bc85aa09156f4c99e3435..0842db17ced28cd8a5cbe6dc0ae08bd9336380c8 100644
--- a/cc/playback/float_clip_display_item.cc
+++ b/cc/playback/float_clip_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"
#include "ui/gfx/skia_util.h"
@@ -24,6 +26,22 @@ void FloatClipDisplayItem::SetNew(const gfx::RectF& clip_rect) {
0 /* external_memory_usage */);
}
+void FloatClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) {
+ proto->set_type(proto::DisplayItem::Type_FloatClip);
+
+ proto::FloatClipDisplayItem* details = proto->mutable_details_float_clip();
+ RectFToProto(clip_rect_, details->mutable_clip_rect());
+}
+
+void FloatClipDisplayItem::FromProtobuf(const proto::DisplayItem& proto) {
+ DCHECK_EQ(proto::DisplayItem::Type_FloatClip, proto.type());
+
+ const proto::FloatClipDisplayItem& details = proto.details_float_clip();
+ gfx::RectF clip_rect = ProtoToRectF(details.clip_rect());
+
+ SetNew(clip_rect);
+}
+
void FloatClipDisplayItem::Raster(SkCanvas* canvas,
const gfx::Rect& canvas_target_playback_rect,
SkPicture::AbortCallback* callback) const {
@@ -50,6 +68,14 @@ EndFloatClipDisplayItem::EndFloatClipDisplayItem() {
EndFloatClipDisplayItem::~EndFloatClipDisplayItem() {
}
+void EndFloatClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) {
+ proto->set_type(proto::DisplayItem::Type_EndFloatClip);
+}
+
+void EndFloatClipDisplayItem::FromProtobuf(const proto::DisplayItem& proto) {
+ DCHECK_EQ(proto::DisplayItem::Type_EndFloatClip, proto.type());
+}
+
void EndFloatClipDisplayItem::Raster(
SkCanvas* canvas,
const gfx::Rect& canvas_target_playback_rect,

Powered by Google App Engine
This is Rietveld 408576698