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

Unified Diff: content/public/common/common_param_traits.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more vector use fixes Created 8 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: content/public/common/common_param_traits.cc
diff --git a/content/public/common/common_param_traits.cc b/content/public/common/common_param_traits.cc
index 95658659ca8f026ecd43fa9ed2d0ecfa92eba5ac..dde1015a0d4bf3dbb35783259dddb5909b0d0f30 100644
--- a/content/public/common/common_param_traits.cc
+++ b/content/public/common/common_param_traits.cc
@@ -151,6 +151,26 @@ void ParamTraits<gfx::Size>::Log(const gfx::Size& p, std::string* l) {
l->append(base::StringPrintf("(%d, %d)", p.width(), p.height()));
}
+void ParamTraits<gfx::Vector2d>::Write(Message* m, const gfx::Vector2d& v) {
+ m->WriteInt(v.x());
+ m->WriteInt(v.y());
+}
+
+bool ParamTraits<gfx::Vector2d>::Read(const Message* m, PickleIterator* iter,
+ gfx::Vector2d* r) {
+ int x, y;
+ if (!m->ReadInt(iter, &x) ||
+ !m->ReadInt(iter, &y))
+ return false;
+ r->set_x(x);
+ r->set_y(y);
+ return true;
+}
+
+void ParamTraits<gfx::Vector2d>::Log(const gfx::Vector2d& v, std::string* l) {
+ l->append(base::StringPrintf("(%d, %d)", v.x(), v.y()));
+}
+
void ParamTraits<gfx::Rect>::Write(Message* m, const gfx::Rect& p) {
m->WriteInt(p.x());
m->WriteInt(p.y());

Powered by Google App Engine
This is Rietveld 408576698