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

Side by Side Diff: cc/input/page_scale_animation.cc

Issue 1357423009: gfx: Make conversions from Size to SizeF be explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sizefconvert-gfx: . Created 5 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 unified diff | Download patch
« no previous file with comments | « cc/input/page_scale_animation.h ('k') | cc/layers/heads_up_display_layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "cc/input/page_scale_animation.h" 5 #include "cc/input/page_scale_animation.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "cc/animation/timing_function.h" 10 #include "cc/animation/timing_function.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 gfx::Vector2dF normalized = gfx::ScaleVector2d( 140 gfx::Vector2dF normalized = gfx::ScaleVector2d(
141 start_scroll_offset_ - target_scroll_offset_, width_scale, height_scale); 141 start_scroll_offset_ - target_scroll_offset_, width_scale, height_scale);
142 target_anchor_ = 142 target_anchor_ =
143 target_scroll_offset_ + DenormalizeToViewport(normalized, 143 target_scroll_offset_ + DenormalizeToViewport(normalized,
144 TargetViewportSize()); 144 TargetViewportSize());
145 } 145 }
146 146
147 void PageScaleAnimation::ClampTargetScrollOffset() { 147 void PageScaleAnimation::ClampTargetScrollOffset() {
148 gfx::Vector2dF max_scroll_offset = 148 gfx::Vector2dF max_scroll_offset =
149 gfx::RectF(root_layer_size_).bottom_right() - 149 gfx::RectF(root_layer_size_).bottom_right() -
150 gfx::RectF(TargetViewportSize()).bottom_right(); 150 gfx::RectF(gfx::SizeF(TargetViewportSize())).bottom_right();
151 target_scroll_offset_.SetToMax(gfx::Vector2dF()); 151 target_scroll_offset_.SetToMax(gfx::Vector2dF());
152 target_scroll_offset_.SetToMin(max_scroll_offset); 152 target_scroll_offset_.SetToMin(max_scroll_offset);
153 } 153 }
154 154
155 gfx::SizeF PageScaleAnimation::StartViewportSize() const { 155 gfx::SizeF PageScaleAnimation::StartViewportSize() const {
156 return gfx::ScaleSize(viewport_size_, 1.f / start_page_scale_factor_); 156 return gfx::ScaleSize(viewport_size_, 1.f / start_page_scale_factor_);
157 } 157 }
158 158
159 gfx::SizeF PageScaleAnimation::TargetViewportSize() const { 159 gfx::SizeF PageScaleAnimation::TargetViewportSize() const {
160 return gfx::ScaleSize(viewport_size_, 1.f / target_page_scale_factor_); 160 return gfx::ScaleSize(viewport_size_, 1.f / target_page_scale_factor_);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 // Linearly interpolate the magnitude in log scale. 237 // Linearly interpolate the magnitude in log scale.
238 float diff = target_page_scale_factor_ / start_page_scale_factor_; 238 float diff = target_page_scale_factor_ / start_page_scale_factor_;
239 float log_diff = log(diff); 239 float log_diff = log(diff);
240 log_diff *= interp; 240 log_diff *= interp;
241 diff = exp(log_diff); 241 diff = exp(log_diff);
242 return start_page_scale_factor_ * diff; 242 return start_page_scale_factor_ * diff;
243 } 243 }
244 244
245 } // namespace cc 245 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/page_scale_animation.h ('k') | cc/layers/heads_up_display_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698