summaryrefslogtreecommitdiffstats
path: root/ui/gfx/interpolated_transform.h
diff options
context:
space:
mode:
authorvollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-26 20:13:08 +0000
committervollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-26 20:13:08 +0000
commitf7c321eb19e1dd8a2f8b154cacb7e13788f1fc28 (patch)
treee1f1c285d359f728fd9d270267b881a836dbea0e /ui/gfx/interpolated_transform.h
parenteb052c93fa488df29314bcb70bb2458982fc94c8 (diff)
downloadchromium_src-f7c321eb19e1dd8a2f8b154cacb7e13788f1fc28.zip
chromium_src-f7c321eb19e1dd8a2f8b154cacb7e13788f1fc28.tar.gz
chromium_src-f7c321eb19e1dd8a2f8b154cacb7e13788f1fc28.tar.bz2
gfx::Transform API clean-up
We have too many ways to do the same thing in gfx::Transform, and their names can lead to confusion. We have the notion of Concat-ing and Preconcat-ing. We've borrowed this verbage from skia. a.preConcat(b) means a = a * b. This may seem counter-intuitive, but is the correct definition if we are multiplying our points/vectors on the right. That said, we almost always want to pre-concat. This what is done throughout WebKit. To simplify matters, rather than having ConcatFoo and PreconcatFoo, we will now only have Foo which does what PreconcatFoo used to. Furthermore, we also have SetFoo which is almost always used immediately after a transform is created, so Foo would do fine (with the optimization mentioned below). Another bit of redundant code eliminated by this CL is InterpolatedTransform::FactorTRS. This function was brittle and naive, and now that gfx::Transform::Blend exists, it needs to go away. Other minor changes rolled into this cleanup: - RotateAbout now takes the newly minted Vector3dF - The Foo functions mentioned above also check for identity to avoid needless matrix multiplications. BUG=159972 Review URL: https://chromiumcodereview.appspot.com/11418040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/interpolated_transform.h')
-rw-r--r--ui/gfx/interpolated_transform.h33
1 files changed, 15 insertions, 18 deletions
diff --git a/ui/gfx/interpolated_transform.h b/ui/gfx/interpolated_transform.h
index 8a93030..474e3a9 100644
--- a/ui/gfx/interpolated_transform.h
+++ b/ui/gfx/interpolated_transform.h
@@ -10,6 +10,8 @@
#include "ui/gfx/point.h"
#include "ui/gfx/point3_f.h"
#include "ui/gfx/transform.h"
+#include "ui/gfx/transform_util.h"
+#include "ui/gfx/vector3d_f.h"
namespace ui {
@@ -46,12 +48,6 @@ class UI_EXPORT InterpolatedTransform {
void SetReversed(bool reversed) { reversed_ = reversed; }
bool Reversed() const { return reversed_; }
- // NOTE: this function is soon to be deprecated.
- static bool FactorTRS(const gfx::Transform& transform,
- gfx::Point* translation,
- float* rotation,
- gfx::Point3F* scale);
-
protected:
// Calculates the interpolated transform without considering our child.
virtual gfx::Transform InterpolateButDoNotCompose(float t) const = 0;
@@ -115,10 +111,10 @@ class UI_EXPORT InterpolatedRotation : public InterpolatedTransform {
///////////////////////////////////////////////////////////////////////////////
class UI_EXPORT InterpolatedAxisAngleRotation : public InterpolatedTransform {
public:
- InterpolatedAxisAngleRotation(gfx::Point3F axis,
+ InterpolatedAxisAngleRotation(const gfx::Vector3dF& axis,
float start_degrees,
float end_degrees);
- InterpolatedAxisAngleRotation(gfx::Point3F axis,
+ InterpolatedAxisAngleRotation(const gfx::Vector3dF& axis,
float start_degrees,
float end_degrees,
float start_time,
@@ -129,7 +125,7 @@ class UI_EXPORT InterpolatedAxisAngleRotation : public InterpolatedTransform {
virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE;
private:
- gfx::Point3F axis_;
+ gfx::Vector3dF axis_;
const float start_degrees_;
const float end_degrees_;
@@ -240,17 +236,17 @@ class UI_EXPORT InterpolatedTransformAboutPivot : public InterpolatedTransform {
DISALLOW_COPY_AND_ASSIGN(InterpolatedTransformAboutPivot);
};
-class UI_EXPORT InterpolatedTRSTransform : public InterpolatedTransform {
+class UI_EXPORT InterpolatedMatrixTransform : public InterpolatedTransform {
public:
- InterpolatedTRSTransform(const gfx::Transform& start_transform,
- const gfx::Transform& end_transform);
+ InterpolatedMatrixTransform(const gfx::Transform& start_transform,
+ const gfx::Transform& end_transform);
- InterpolatedTRSTransform(const gfx::Transform& start_transform,
- const gfx::Transform& end_transform,
- float start_time,
- float end_time);
+ InterpolatedMatrixTransform(const gfx::Transform& start_transform,
+ const gfx::Transform& end_transform,
+ float start_time,
+ float end_time);
- virtual ~InterpolatedTRSTransform();
+ virtual ~InterpolatedMatrixTransform();
protected:
virtual gfx::Transform InterpolateButDoNotCompose(float t) const OVERRIDE;
@@ -259,7 +255,8 @@ class UI_EXPORT InterpolatedTRSTransform : public InterpolatedTransform {
void Init(const gfx::Transform& start_transform,
const gfx::Transform& end_transform);
- scoped_ptr<InterpolatedTransform> transform_;
+ gfx::DecomposedTransform start_decomp_;
+ gfx::DecomposedTransform end_decomp_;
};
} // namespace ui