| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/interpolated_transform.h" | 5 #include "ui/gfx/interpolated_transform.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #ifndef M_PI | 9 #ifndef M_PI |
| 10 #define M_PI 3.14159265358979323846 | 10 #define M_PI 3.14159265358979323846 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 to_pivot.Translate(SkIntToMScalar(-pivot.x()), SkIntToMScalar(-pivot.y())); | 330 to_pivot.Translate(SkIntToMScalar(-pivot.x()), SkIntToMScalar(-pivot.y())); |
| 331 from_pivot.Translate(SkIntToMScalar(pivot.x()), SkIntToMScalar(pivot.y())); | 331 from_pivot.Translate(SkIntToMScalar(pivot.x()), SkIntToMScalar(pivot.y())); |
| 332 | 332 |
| 333 std::unique_ptr<InterpolatedTransform> pre_transform( | 333 std::unique_ptr<InterpolatedTransform> pre_transform( |
| 334 new InterpolatedConstantTransform(to_pivot)); | 334 new InterpolatedConstantTransform(to_pivot)); |
| 335 std::unique_ptr<InterpolatedTransform> post_transform( | 335 std::unique_ptr<InterpolatedTransform> post_transform( |
| 336 new InterpolatedConstantTransform(from_pivot)); | 336 new InterpolatedConstantTransform(from_pivot)); |
| 337 | 337 |
| 338 pre_transform->SetChild(xform); | 338 pre_transform->SetChild(xform); |
| 339 xform->SetChild(post_transform.release()); | 339 xform->SetChild(post_transform.release()); |
| 340 transform_.reset(pre_transform.release()); | 340 transform_ = std::move(pre_transform); |
| 341 } | 341 } |
| 342 | 342 |
| 343 InterpolatedMatrixTransform::InterpolatedMatrixTransform( | 343 InterpolatedMatrixTransform::InterpolatedMatrixTransform( |
| 344 const gfx::Transform& start_transform, | 344 const gfx::Transform& start_transform, |
| 345 const gfx::Transform& end_transform) | 345 const gfx::Transform& end_transform) |
| 346 : InterpolatedTransform() { | 346 : InterpolatedTransform() { |
| 347 Init(start_transform, end_transform); | 347 Init(start_transform, end_transform); |
| 348 } | 348 } |
| 349 | 349 |
| 350 InterpolatedMatrixTransform::InterpolatedMatrixTransform( | 350 InterpolatedMatrixTransform::InterpolatedMatrixTransform( |
| (...skipping 20 matching lines...) Expand all Loading... |
| 371 | 371 |
| 372 void InterpolatedMatrixTransform::Init(const gfx::Transform& start_transform, | 372 void InterpolatedMatrixTransform::Init(const gfx::Transform& start_transform, |
| 373 const gfx::Transform& end_transform) { | 373 const gfx::Transform& end_transform) { |
| 374 bool success = gfx::DecomposeTransform(&start_decomp_, start_transform); | 374 bool success = gfx::DecomposeTransform(&start_decomp_, start_transform); |
| 375 DCHECK(success); | 375 DCHECK(success); |
| 376 success = gfx::DecomposeTransform(&end_decomp_, end_transform); | 376 success = gfx::DecomposeTransform(&end_decomp_, end_transform); |
| 377 DCHECK(success); | 377 DCHECK(success); |
| 378 } | 378 } |
| 379 | 379 |
| 380 } // namespace ui | 380 } // namespace ui |
| OLD | NEW |