summaryrefslogtreecommitdiffstats
path: root/ui/gfx/transform.cc
diff options
context:
space:
mode:
authorvollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-16 22:31:16 +0000
committervollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-16 22:31:16 +0000
commit4363a2d5bf871628db03808ba1af8a66ba4218b6 (patch)
treed26a1277392be62b69a6f6a854edd3f9f7a7d765 /ui/gfx/transform.cc
parentb0fcb0e709bc2731e6e71fbee0eb31b8a1ba7213 (diff)
downloadchromium_src-4363a2d5bf871628db03808ba1af8a66ba4218b6.zip
chromium_src-4363a2d5bf871628db03808ba1af8a66ba4218b6.tar.gz
chromium_src-4363a2d5bf871628db03808ba1af8a66ba4218b6.tar.bz2
Adds a new layer animation element which owns an interpolated transform. This allows more control over the interpolation, and in particular, it allows for a rotation about a pivot.
BUG=None TEST=None Review URL: http://codereview.chromium.org/9704070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127269 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/transform.cc')
-rw-r--r--ui/gfx/transform.cc32
1 files changed, 23 insertions, 9 deletions
diff --git a/ui/gfx/transform.cc b/ui/gfx/transform.cc
index 3f0b8ea..53695ed 100644
--- a/ui/gfx/transform.cc
+++ b/ui/gfx/transform.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -38,6 +38,13 @@ void Transform::SetRotate(float degree) {
matrix_.setRotateDegreesAbout(0, 0, 1, SkFloatToScalar(degree));
}
+void Transform::SetRotateAbout(const gfx::Point3f& axis, float degree) {
+ matrix_.setRotateDegreesAbout(axis.x(),
+ axis.y(),
+ axis.z(),
+ SkFloatToScalar(degree));
+}
+
void Transform::SetScaleX(float x) {
matrix_.set(0, 0, SkFloatToScalar(x));
}
@@ -47,10 +54,9 @@ void Transform::SetScaleY(float y) {
}
void Transform::SetScale(float x, float y) {
- matrix_.setScale(
- SkFloatToScalar(x),
- SkFloatToScalar(y),
- matrix_.get(2, 2));
+ matrix_.setScale(SkFloatToScalar(x),
+ SkFloatToScalar(y),
+ matrix_.get(2, 2));
}
void Transform::SetTranslateX(float x) {
@@ -62,10 +68,9 @@ void Transform::SetTranslateY(float y) {
}
void Transform::SetTranslate(float x, float y) {
- matrix_.setTranslate(
- SkFloatToScalar(x),
- SkFloatToScalar(y),
- matrix_.get(2, 3));
+ matrix_.setTranslate(SkFloatToScalar(x),
+ SkFloatToScalar(y),
+ matrix_.get(2, 3));
}
void Transform::ConcatRotate(float degree) {
@@ -74,6 +79,15 @@ void Transform::ConcatRotate(float degree) {
matrix_.postConcat(rot);
}
+void Transform::ConcatRotateAbout(const gfx::Point3f& axis, float degree) {
+ SkMatrix44 rot;
+ rot.setRotateDegreesAbout(axis.x(),
+ axis.y(),
+ axis.z(),
+ SkFloatToScalar(degree));
+ matrix_.postConcat(rot);
+}
+
void Transform::ConcatScale(float x, float y) {
SkMatrix44 scale;
scale.setScale(SkFloatToScalar(x), SkFloatToScalar(y), 1);