Chromium Code Reviews| Index: ui/gfx/ipc/gfx_param_traits.cc |
| diff --git a/ui/gfx/ipc/gfx_param_traits.cc b/ui/gfx/ipc/gfx_param_traits.cc |
| index e800fef5bba66a686c27db5c17a33d0c972f2af4..4038acedafd5b946aea84251ad5994baff8da045 100644 |
| --- a/ui/gfx/ipc/gfx_param_traits.cc |
| +++ b/ui/gfx/ipc/gfx_param_traits.cc |
| @@ -15,6 +15,7 @@ |
| #include "ui/gfx/geometry/rect_f.h" |
| #include "ui/gfx/geometry/scroll_offset.h" |
| #include "ui/gfx/range/range.h" |
| +#include "ui/gfx/transform.h" |
| #if defined(OS_MACOSX) |
| #include "ipc/mach_port_mac.h" |
| @@ -363,6 +364,46 @@ void ParamTraits<gfx::ScrollOffset>::Log(const param_type& p, std::string* l) { |
| l->append(")"); |
| } |
| +void ParamTraits<gfx::Transform>::Write(base::Pickle* m, const param_type& p) { |
| +#ifdef SK_MSCALAR_IS_FLOAT |
| + float column_major_data[16]; |
| + p.matrix().asColMajorf(column_major_data); |
| +#else |
| + double column_major_data[16]; |
| + p.matrix().asColMajord(column_major_data); |
| +#endif |
| + m->WriteBytes(&column_major_data, sizeof(SkMScalar) * 16); |
|
dcheng
2016/03/08 00:39:42
I know you're just moving this, but mind adding a
dmazzoni
2016/03/16 21:38:14
Done.
|
| +} |
| + |
| +bool ParamTraits<gfx::Transform>::Read(const base::Pickle* m, |
| + base::PickleIterator* iter, |
| + param_type* r) { |
| + const char* column_major_data; |
| + if (!iter->ReadBytes(&column_major_data, sizeof(SkMScalar) * 16)) |
| + return false; |
| + r->matrix().setColMajor( |
| + reinterpret_cast<const SkMScalar*>(column_major_data)); |
| + return true; |
| +} |
| + |
| +void ParamTraits<gfx::Transform>::Log( |
| + const param_type& p, std::string* l) { |
| +#ifdef SK_MSCALAR_IS_FLOAT |
| + float row_major_data[16]; |
| + p.matrix().asRowMajorf(row_major_data); |
| +#else |
| + double row_major_data[16]; |
| + p.matrix().asRowMajord(row_major_data); |
| +#endif |
| + l->append("("); |
| + for (int i = 0; i < 16; ++i) { |
| + if (i > 0) |
| + l->append(", "); |
| + LogParam(row_major_data[i], l); |
| + } |
| + l->append(") "); |
| +} |
| + |
| #if defined(OS_MACOSX) && !defined(OS_IOS) |
| void ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Write( |
| base::Pickle* m, |