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

Unified Diff: cc/proto/gfx_conversions.cc

Issue 1417963011: Added serialization to protobufs for property trees. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 years, 1 month 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/proto/gfx_conversions.cc
diff --git a/cc/proto/gfx_conversions.cc b/cc/proto/gfx_conversions.cc
index cf85fbf249b822d8b147a1d19645965ba72219f1..3330ad190184c395fa195d1c390237036a826f3b 100644
--- a/cc/proto/gfx_conversions.cc
+++ b/cc/proto/gfx_conversions.cc
@@ -8,15 +8,19 @@
#include "cc/proto/pointf.pb.h"
#include "cc/proto/rect.pb.h"
#include "cc/proto/rectf.pb.h"
+#include "cc/proto/scroll_offset.pb.h"
#include "cc/proto/size.pb.h"
#include "cc/proto/sizef.pb.h"
#include "cc/proto/transform.pb.h"
+#include "cc/proto/vector2df.pb.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_f.h"
+#include "ui/gfx/geometry/scroll_offset.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/size_f.h"
+#include "ui/gfx/geometry/vector2d_f.h"
#include "ui/gfx/transform.h"
namespace cc {
@@ -101,4 +105,23 @@ gfx::Transform ProtoToTransform(const proto::Transform& proto) {
return transform;
}
+void Vector2dFToProto(const gfx::Vector2dF& vector, proto::Vector2dF* proto) {
+ proto->set_x(vector.x());
+ proto->set_y(vector.y());
+}
+
+gfx::Vector2dF ProtoToVector2dF(const proto::Vector2dF& proto) {
+ return gfx::Vector2dF(proto.x(), proto.y());
+}
+
+void ScrollOffsetToProto(const gfx::ScrollOffset& scroll_offset,
+ proto::ScrollOffset* proto) {
+ proto->set_x(scroll_offset.x());
+ proto->set_y(scroll_offset.y());
+}
+
+gfx::ScrollOffset ProtoToScrollOffset(const proto::ScrollOffset& proto) {
+ return gfx::ScrollOffset(proto.x(), proto.y());
+}
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698