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

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: RenderText fixup 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
« no previous file with comments | « content/public/common/common_param_traits.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
piman 2012/10/31 18:07:23 nit: indentation
Peter Kasting 2012/10/31 18:09:28 Also, one arg per line if they don't all fit on on
+ 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());
« no previous file with comments | « content/public/common/common_param_traits.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698