summaryrefslogtreecommitdiffstats
path: root/ui/gfx/transform.cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-20 20:36:53 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-20 20:36:53 +0000
commit6ab42d98f29848fc1210a39fb8d47ced24a42ea7 (patch)
tree2504933ec45381484ce3def0beec177bc5eebf66 /ui/gfx/transform.cc
parent1353d5a890fb0442908d61d79319bfee9e8d6c63 (diff)
downloadchromium_src-6ab42d98f29848fc1210a39fb8d47ced24a42ea7.zip
chromium_src-6ab42d98f29848fc1210a39fb8d47ced24a42ea7.tar.gz
chromium_src-6ab42d98f29848fc1210a39fb8d47ced24a42ea7.tar.bz2
Add ToString() to gfx::Transform for easier debugging.
R=vollick Review URL: https://chromiumcodereview.appspot.com/11635036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174226 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/transform.cc')
-rw-r--r--ui/gfx/transform.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/ui/gfx/transform.cc b/ui/gfx/transform.cc
index 12f3e19..a4a4e64 100644
--- a/ui/gfx/transform.cc
+++ b/ui/gfx/transform.cc
@@ -9,6 +9,7 @@
#include <cmath>
+#include "base/stringprintf.h"
#include "ui/gfx/point.h"
#include "ui/gfx/point3_f.h"
#include "ui/gfx/vector3d_f.h"
@@ -364,4 +365,28 @@ void Transform::TransformPointInternal(const SkMatrix44& xform,
point.SetPoint(ToRoundedInt(p[0]), ToRoundedInt(p[1]));
}
+std::string Transform::ToString() const {
+ return base::StringPrintf(
+ "[ %+0.4f %+0.4f %+0.4f %+0.4f \n"
+ " %+0.4f %+0.4f %+0.4f %+0.4f \n"
+ " %+0.4f %+0.4f %+0.4f %+0.4f \n"
+ " %+0.4f %+0.4f %+0.4f %+0.4f ]\n",
+ matrix_.getDouble(0, 0),
+ matrix_.getDouble(0, 1),
+ matrix_.getDouble(0, 2),
+ matrix_.getDouble(0, 3),
+ matrix_.getDouble(1, 0),
+ matrix_.getDouble(1, 1),
+ matrix_.getDouble(1, 2),
+ matrix_.getDouble(1, 3),
+ matrix_.getDouble(2, 0),
+ matrix_.getDouble(2, 1),
+ matrix_.getDouble(2, 2),
+ matrix_.getDouble(2, 3),
+ matrix_.getDouble(3, 0),
+ matrix_.getDouble(3, 1),
+ matrix_.getDouble(3, 2),
+ matrix_.getDouble(3, 3));
+}
+
} // namespace gfx