diff options
author | shawnsingh@chromium.org <shawnsingh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-27 08:29:00 +0000 |
---|---|---|
committer | shawnsingh@chromium.org <shawnsingh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-27 08:29:00 +0000 |
commit | c8686a05e1fa4cb3aa82690d7450791828096840 (patch) | |
tree | c43ef1a56ac27a06bc1ed7c069850cf7c6790002 /content/common | |
parent | 5006a4185d3a95976ced07022188f9abb48790be (diff) | |
download | chromium_src-c8686a05e1fa4cb3aa82690d7450791828096840.zip chromium_src-c8686a05e1fa4cb3aa82690d7450791828096840.tar.gz chromium_src-c8686a05e1fa4cb3aa82690d7450791828096840.tar.bz2 |
Animation code is not yet migrated by this patch, due to WebTransformOperations.
BUG=159972
Review URL: https://codereview.chromium.org/11308153
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169609 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r-- | content/common/cc_messages.cc | 128 | ||||
-rw-r--r-- | content/common/cc_messages.h | 9 | ||||
-rw-r--r-- | content/common/cc_messages_unittest.cc | 10 |
3 files changed, 77 insertions, 70 deletions
diff --git a/content/common/cc_messages.cc b/content/common/cc_messages.cc index 6c1c440..166e77a 100644 --- a/content/common/cc_messages.cc +++ b/content/common/cc_messages.cc @@ -7,7 +7,7 @@ #include "content/public/common/common_param_traits.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebData.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMatrix.h" +#include "ui/gfx/transform.h" namespace IPC { @@ -208,104 +208,108 @@ void ParamTraits<WebKit::WebFilterOperations>::Log( l->append(")"); } -void ParamTraits<WebKit::WebTransformationMatrix>::Write( +void ParamTraits<gfx::Transform>::Write( Message* m, const param_type& p) { - WriteParam(m, p.m11()); - WriteParam(m, p.m12()); - WriteParam(m, p.m13()); - WriteParam(m, p.m14()); - WriteParam(m, p.m21()); - WriteParam(m, p.m22()); - WriteParam(m, p.m23()); - WriteParam(m, p.m24()); - WriteParam(m, p.m31()); - WriteParam(m, p.m32()); - WriteParam(m, p.m33()); - WriteParam(m, p.m34()); - WriteParam(m, p.m41()); - WriteParam(m, p.m42()); - WriteParam(m, p.m43()); - WriteParam(m, p.m44()); + WriteParam(m, p.matrix().getDouble(0, 0)); + WriteParam(m, p.matrix().getDouble(1, 0)); + WriteParam(m, p.matrix().getDouble(2, 0)); + WriteParam(m, p.matrix().getDouble(3, 0)); + WriteParam(m, p.matrix().getDouble(0, 1)); + WriteParam(m, p.matrix().getDouble(1, 1)); + WriteParam(m, p.matrix().getDouble(2, 1)); + WriteParam(m, p.matrix().getDouble(3, 1)); + WriteParam(m, p.matrix().getDouble(0, 2)); + WriteParam(m, p.matrix().getDouble(1, 2)); + WriteParam(m, p.matrix().getDouble(2, 2)); + WriteParam(m, p.matrix().getDouble(3, 2)); + WriteParam(m, p.matrix().getDouble(0, 3)); + WriteParam(m, p.matrix().getDouble(1, 3)); + WriteParam(m, p.matrix().getDouble(2, 3)); + WriteParam(m, p.matrix().getDouble(3, 3)); } -bool ParamTraits<WebKit::WebTransformationMatrix>::Read( +bool ParamTraits<gfx::Transform>::Read( const Message* m, PickleIterator* iter, param_type* r) { + // Note: In this function, "m12" means 1st row, 2nd column of the matrix. + // This is consistent with Skia's row-column notation, but backwards from + // WebCore's column-row notation. double m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44; + bool success = ReadParam(m, iter, &m11) && - ReadParam(m, iter, &m12) && - ReadParam(m, iter, &m13) && - ReadParam(m, iter, &m14) && ReadParam(m, iter, &m21) && - ReadParam(m, iter, &m22) && - ReadParam(m, iter, &m23) && - ReadParam(m, iter, &m24) && ReadParam(m, iter, &m31) && - ReadParam(m, iter, &m32) && - ReadParam(m, iter, &m33) && - ReadParam(m, iter, &m34) && ReadParam(m, iter, &m41) && + ReadParam(m, iter, &m12) && + ReadParam(m, iter, &m22) && + ReadParam(m, iter, &m32) && ReadParam(m, iter, &m42) && + ReadParam(m, iter, &m13) && + ReadParam(m, iter, &m23) && + ReadParam(m, iter, &m33) && ReadParam(m, iter, &m43) && + ReadParam(m, iter, &m14) && + ReadParam(m, iter, &m24) && + ReadParam(m, iter, &m34) && ReadParam(m, iter, &m44); if (success) { - r->setM11(m11); - r->setM12(m12); - r->setM13(m13); - r->setM14(m14); - r->setM21(m21); - r->setM22(m22); - r->setM23(m23); - r->setM24(m24); - r->setM31(m31); - r->setM32(m32); - r->setM33(m33); - r->setM34(m34); - r->setM41(m41); - r->setM42(m42); - r->setM43(m43); - r->setM44(m44); + r->matrix().setDouble(0, 0, m11); + r->matrix().setDouble(1, 0, m21); + r->matrix().setDouble(2, 0, m31); + r->matrix().setDouble(3, 0, m41); + r->matrix().setDouble(0, 1, m12); + r->matrix().setDouble(1, 1, m22); + r->matrix().setDouble(2, 1, m32); + r->matrix().setDouble(3, 1, m42); + r->matrix().setDouble(0, 2, m13); + r->matrix().setDouble(1, 2, m23); + r->matrix().setDouble(2, 2, m33); + r->matrix().setDouble(3, 2, m43); + r->matrix().setDouble(0, 3, m14); + r->matrix().setDouble(1, 3, m24); + r->matrix().setDouble(2, 3, m34); + r->matrix().setDouble(3, 3, m44); } return success; } -void ParamTraits<WebKit::WebTransformationMatrix>::Log( +void ParamTraits<gfx::Transform>::Log( const param_type& p, std::string* l) { l->append("("); - LogParam(p.m11(), l); + LogParam(p.matrix().getDouble(0, 0), l); l->append(", "); - LogParam(p.m12(), l); + LogParam(p.matrix().getDouble(1, 0), l); l->append(", "); - LogParam(p.m13(), l); + LogParam(p.matrix().getDouble(2, 0), l); l->append(", "); - LogParam(p.m14(), l); + LogParam(p.matrix().getDouble(3, 0), l); l->append(", "); - LogParam(p.m21(), l); + LogParam(p.matrix().getDouble(0, 1), l); l->append(", "); - LogParam(p.m22(), l); + LogParam(p.matrix().getDouble(1, 1), l); l->append(", "); - LogParam(p.m23(), l); + LogParam(p.matrix().getDouble(2, 1), l); l->append(", "); - LogParam(p.m24(), l); + LogParam(p.matrix().getDouble(3, 1), l); l->append(", "); - LogParam(p.m31(), l); + LogParam(p.matrix().getDouble(0, 2), l); l->append(", "); - LogParam(p.m32(), l); + LogParam(p.matrix().getDouble(1, 2), l); l->append(", "); - LogParam(p.m33(), l); + LogParam(p.matrix().getDouble(2, 2), l); l->append(", "); - LogParam(p.m34(), l); + LogParam(p.matrix().getDouble(3, 2), l); l->append(", "); - LogParam(p.m41(), l); + LogParam(p.matrix().getDouble(0, 3), l); l->append(", "); - LogParam(p.m42(), l); + LogParam(p.matrix().getDouble(1, 3), l); l->append(", "); - LogParam(p.m43(), l); + LogParam(p.matrix().getDouble(2, 3), l); l->append(", "); - LogParam(p.m44(), l); + LogParam(p.matrix().getDouble(3, 3), l); l->append(") "); } @@ -406,7 +410,7 @@ bool ParamTraits<cc::RenderPass>::Read( cc::RenderPass::Id id(-1, -1); gfx::Rect output_rect; gfx::RectF damage_rect; - WebKit::WebTransformationMatrix transform_to_root_target; + gfx::Transform transform_to_root_target; bool has_transparent_background; bool has_occlusion_from_outside_target_surface; WebKit::WebFilterOperations filters; diff --git a/content/common/cc_messages.h b/content/common/cc_messages.h index b896a2f..74f2479 100644 --- a/content/common/cc_messages.h +++ b/content/common/cc_messages.h @@ -24,10 +24,13 @@ #ifndef CONTENT_COMMON_CC_MESSAGES_H_ #define CONTENT_COMMON_CC_MESSAGES_H_ +namespace gfx { +class Transform; +} + namespace WebKit { class WebData; class WebFilterOperations; -class WebTransformationMatrix; } namespace IPC { @@ -57,8 +60,8 @@ struct ParamTraits<WebKit::WebFilterOperations> { }; template <> -struct ParamTraits<WebKit::WebTransformationMatrix> { - typedef WebKit::WebTransformationMatrix param_type; +struct ParamTraits<gfx::Transform> { + typedef gfx::Transform param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, PickleIterator* iter, param_type* r); static void Log(const param_type& p, std::string* l); diff --git a/content/common/cc_messages_unittest.cc b/content/common/cc_messages_unittest.cc index 7225b68..d58c518 100644 --- a/content/common/cc_messages_unittest.cc +++ b/content/common/cc_messages_unittest.cc @@ -23,9 +23,9 @@ using cc::TileDrawQuad; using cc::StreamVideoDrawQuad; using cc::VideoLayerImpl; using cc::YUVVideoDrawQuad; +using gfx::Transform; using WebKit::WebFilterOperation; using WebKit::WebFilterOperations; -using WebKit::WebTransformationMatrix; class CCMessagesTest : public testing::Test { protected: @@ -173,10 +173,10 @@ class CCMessagesTest : public testing::Test { TEST_F(CCMessagesTest, AllQuads) { IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); - WebTransformationMatrix arbitrary_matrix; - arbitrary_matrix.scale(3); - arbitrary_matrix.translate(-5, 20); - arbitrary_matrix.rotate(15); + Transform arbitrary_matrix; + arbitrary_matrix.Scale(3, 3); + arbitrary_matrix.Translate(-5, 20); + arbitrary_matrix.Rotate(15); gfx::Rect arbitrary_rect1(-5, 9, 3, 15); gfx::Rect arbitrary_rect2(40, 23, 11, 7); gfx::Rect arbitrary_rect3(7, -53, 22, 19); |