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

Side by Side Diff: cc/animation/keyframed_animation_curve.cc

Issue 1076313006: Animation start scale should be considered for the raster scale (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "cc/animation/keyframed_animation_curve.h" 7 #include "cc/animation/keyframed_animation_curve.h"
8 #include "cc/base/time_util.h" 8 #include "cc/base/time_util.h"
9 #include "ui/gfx/animation/tween.h" 9 #include "ui/gfx/animation/tween.h"
10 #include "ui/gfx/geometry/box_f.h" 10 #include "ui/gfx/geometry/box_f.h"
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 372 }
373 373
374 bool KeyframedTransformAnimationCurve::IsTranslation() const { 374 bool KeyframedTransformAnimationCurve::IsTranslation() const {
375 for (size_t i = 0; i < keyframes_.size(); ++i) { 375 for (size_t i = 0; i < keyframes_.size(); ++i) {
376 if (!keyframes_[i]->Value().IsTranslation() && 376 if (!keyframes_[i]->Value().IsTranslation() &&
377 !keyframes_[i]->Value().IsIdentity()) 377 !keyframes_[i]->Value().IsIdentity())
378 return false; 378 return false;
379 } 379 }
380 return true; 380 return true;
381 } 381 }
382 bool KeyframedTransformAnimationCurve::AnimationStartScale(
383 bool forward_direction,
384 float* start_scale) const {
385 DCHECK_GE(keyframes_.size(), 2ul);
386 *start_scale = 0.f;
387 size_t start_location = 0;
388 if (!forward_direction) {
389 start_location = keyframes_.size() - 1;
390 }
382 391
392 gfx::Vector3dF target_scale_for_segment;
ajuma 2015/04/23 19:17:01 start_scale_for_segment?
patro 2015/04/24 11:47:27 Done.
393 if (!keyframes_[start_location]->Value().ScaleComponent(
394 &target_scale_for_segment))
395 return false;
396 float start_scale_for_segment =
397 fmax(std::abs(target_scale_for_segment.x()),
398 fmax(std::abs(target_scale_for_segment.y()),
399 std::abs(target_scale_for_segment.z())));
400 *start_scale = fmax(*start_scale, start_scale_for_segment);
401 return true;
402 }
383 bool KeyframedTransformAnimationCurve::MaximumTargetScale( 403 bool KeyframedTransformAnimationCurve::MaximumTargetScale(
384 bool forward_direction, 404 bool forward_direction,
385 float* max_scale) const { 405 float* max_scale) const {
386 DCHECK_GE(keyframes_.size(), 2ul); 406 DCHECK_GE(keyframes_.size(), 2ul);
387 *max_scale = 0.f; 407 *max_scale = 0.f;
388 408
389 // If |forward_direction| is true, then skip the first frame, otherwise 409 // If |forward_direction| is true, then skip the first frame, otherwise
390 // skip the last frame, since that is the original position in the animation. 410 // skip the last frame, since that is the original position in the animation.
391 size_t start = 1; 411 size_t start = 1;
392 size_t end = keyframes_.size(); 412 size_t end = keyframes_.size();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 bool KeyframedFilterAnimationCurve::HasFilterThatMovesPixels() const { 476 bool KeyframedFilterAnimationCurve::HasFilterThatMovesPixels() const {
457 for (size_t i = 0; i < keyframes_.size(); ++i) { 477 for (size_t i = 0; i < keyframes_.size(); ++i) {
458 if (keyframes_[i]->Value().HasFilterThatMovesPixels()) { 478 if (keyframes_[i]->Value().HasFilterThatMovesPixels()) {
459 return true; 479 return true;
460 } 480 }
461 } 481 }
462 return false; 482 return false;
463 } 483 }
464 484
465 } // namespace cc 485 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698