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

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

Issue 10818011: Allow floating point rectangles to be sent via IPC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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') | ui/ui.gyp » ('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 8ee6b2afd8eb4f1b5abb53f036fe707dcd6811b2..90943d7771b0ad665b24ede70ecf76e6a40018a0 100644
--- a/content/public/common/common_param_traits.cc
+++ b/content/public/common/common_param_traits.cc
@@ -12,6 +12,7 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/range/range.h"
#include "ui/gfx/rect.h"
+#include "ui/gfx/rect_f.h"
namespace {
@@ -422,6 +423,34 @@ void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) {
p.width(), p.height()));
}
+void ParamTraits<gfx::RectF>::Write(Message* m, const gfx::RectF& p) {
+ m->WriteFloat(p.x());
brettw 2012/07/23 19:06:21 I'd avoid adding anything to pickle and instead us
Leandro GraciĆ” Gil 2012/07/23 20:45:35 SGTM. Fixed. On 2012/07/23 19:06:21, brettw wrote
+ m->WriteFloat(p.y());
+ m->WriteFloat(p.width());
+ m->WriteFloat(p.height());
+}
+
+bool ParamTraits<gfx::RectF>::Read(const Message* m,
+ PickleIterator* iter,
+ gfx::RectF* r) {
+ float x, y, w, h;
+ if (!m->ReadFloat(iter, &x) ||
+ !m->ReadFloat(iter, &y) ||
+ !m->ReadFloat(iter, &w) ||
+ !m->ReadFloat(iter, &h))
+ return false;
+ r->set_x(x);
+ r->set_y(y);
+ r->set_width(w);
+ r->set_height(h);
+ return true;
+}
+
+void ParamTraits<gfx::RectF>::Log(const gfx::RectF& p, std::string* l) {
+ l->append(base::StringPrintf("(%f, %f, %f, %f)", p.x(), p.y(),
+ p.width(), p.height()));
+}
+
void ParamTraits<ui::Range>::Write(Message* m, const ui::Range& r) {
m->WriteUInt64(r.start());
m->WriteUInt64(r.end());
« no previous file with comments | « content/public/common/common_param_traits.h ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698