Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Unified Diff: ui/gfx/interpolated_transform.cc

Issue 642323002: Extending support for 3d in gfx::InterpolatedScale and gfx::InterpolatedTranslation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding unit_tests Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/interpolated_transform.h ('k') | ui/gfx/interpolated_transform_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/interpolated_transform.cc
diff --git a/ui/gfx/interpolated_transform.cc b/ui/gfx/interpolated_transform.cc
index 4c807f1b4ed3de17460f96c9d2eaa80299cbb11f..693b6567f7f53f01b266818001cf7d188f011f86 100644
--- a/ui/gfx/interpolated_transform.cc
+++ b/ui/gfx/interpolated_transform.cc
@@ -230,8 +230,8 @@ gfx::Transform InterpolatedScale::InterpolateButDoNotCompose(float t) const {
gfx::Transform result;
float scale_x = ValueBetween(t, start_scale_.x(), end_scale_.x());
float scale_y = ValueBetween(t, start_scale_.y(), end_scale_.y());
- // TODO(vollick) 3d xforms.
- result.Scale(scale_x, scale_y);
+ float scale_z = ValueBetween(t, start_scale_.z(), end_scale_.z());
+ result.Scale3d(scale_x, scale_y, scale_z);
return result;
}
@@ -255,14 +255,28 @@ InterpolatedTranslation::InterpolatedTranslation(const gfx::Point& start_pos,
end_pos_(end_pos) {
}
+InterpolatedTranslation::InterpolatedTranslation(const gfx::Point3F& start_pos,
+ const gfx::Point3F& end_pos)
+ : InterpolatedTransform(), start_pos_(start_pos), end_pos_(end_pos) {
+}
+
+InterpolatedTranslation::InterpolatedTranslation(const gfx::Point3F& start_pos,
+ const gfx::Point3F& end_pos,
+ float start_time,
+ float end_time)
+ : InterpolatedTransform(start_time, end_time),
+ start_pos_(start_pos),
+ end_pos_(end_pos) {
+}
+
InterpolatedTranslation::~InterpolatedTranslation() {}
gfx::Transform
InterpolatedTranslation::InterpolateButDoNotCompose(float t) const {
gfx::Transform result;
- // TODO(vollick) 3d xforms.
- result.Translate(ValueBetween(t, start_pos_.x(), end_pos_.x()),
- ValueBetween(t, start_pos_.y(), end_pos_.y()));
+ result.Translate3d(ValueBetween(t, start_pos_.x(), end_pos_.x()),
+ ValueBetween(t, start_pos_.y(), end_pos_.y()),
+ ValueBetween(t, start_pos_.z(), end_pos_.z()));
return result;
}
« no previous file with comments | « ui/gfx/interpolated_transform.h ('k') | ui/gfx/interpolated_transform_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698