OLD | NEW |
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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCPageScaleAnimation.h" | 7 #include "CCPageScaleAnimation.h" |
8 | 8 |
9 #include "FloatRect.h" | 9 #include "FloatRect.h" |
10 #include "FloatSize.h" | 10 #include "FloatSize.h" |
11 | 11 |
12 #include <math.h> | 12 #include <math.h> |
13 | 13 |
14 namespace WebCore { | 14 namespace cc { |
15 | 15 |
16 PassOwnPtr<CCPageScaleAnimation> CCPageScaleAnimation::create(const IntSize& scr
ollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& conten
tSize, double startTime) | 16 PassOwnPtr<CCPageScaleAnimation> CCPageScaleAnimation::create(const IntSize& scr
ollStart, float pageScaleStart, const IntSize& windowSize, const IntSize& conten
tSize, double startTime) |
17 { | 17 { |
18 return adoptPtr(new CCPageScaleAnimation(scrollStart, pageScaleStart, window
Size, contentSize, startTime)); | 18 return adoptPtr(new CCPageScaleAnimation(scrollStart, pageScaleStart, window
Size, contentSize, startTime)); |
19 } | 19 } |
20 | 20 |
21 | 21 |
22 CCPageScaleAnimation::CCPageScaleAnimation(const IntSize& scrollStart, float pag
eScaleStart, const IntSize& windowSize, const IntSize& contentSize, double start
Time) | 22 CCPageScaleAnimation::CCPageScaleAnimation(const IntSize& scrollStart, float pag
eScaleStart, const IntSize& windowSize, const IntSize& contentSize, double start
Time) |
23 : m_scrollStart(scrollStart) | 23 : m_scrollStart(scrollStart) |
24 , m_pageScaleStart(pageScaleStart) | 24 , m_pageScaleStart(pageScaleStart) |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // Log scale is needed to maintain the appearance of uniform zoom. For | 149 // Log scale is needed to maintain the appearance of uniform zoom. For |
150 // example, if we zoom from 0.5 to 4.0 in 3 seconds, then we should | 150 // example, if we zoom from 0.5 to 4.0 in 3 seconds, then we should |
151 // be zooming by 2x every second. | 151 // be zooming by 2x every second. |
152 float diff = m_pageScaleEnd / m_pageScaleStart; | 152 float diff = m_pageScaleEnd / m_pageScaleStart; |
153 float logDiff = log(diff); | 153 float logDiff = log(diff); |
154 logDiff *= ratio; | 154 logDiff *= ratio; |
155 diff = exp(logDiff); | 155 diff = exp(logDiff); |
156 return m_pageScaleStart * diff; | 156 return m_pageScaleStart * diff; |
157 } | 157 } |
158 | 158 |
159 } // namespace WebCore | 159 } // namespace cc |
OLD | NEW |