summaryrefslogtreecommitdiffstats
path: root/cc/blink/web_scroll_offset_animation_curve_impl.cc
blob: e1f1bfd7d1990ae0505d9e346c8ed48c9788ce49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/blink/web_scroll_offset_animation_curve_impl.h"

#include "cc/animation/scroll_offset_animation_curve.h"
#include "cc/animation/timing_function.h"
#include "cc/blink/web_animation_curve_common.h"

using blink::WebFloatPoint;

namespace cc_blink {

WebScrollOffsetAnimationCurveImpl::WebScrollOffsetAnimationCurveImpl(
    WebFloatPoint target_value,
    TimingFunctionType timing_function)
    : curve_(cc::ScrollOffsetAnimationCurve::Create(
          gfx::Vector2dF(target_value.x, target_value.y),
          CreateTimingFunction(timing_function))) {
}

WebScrollOffsetAnimationCurveImpl::~WebScrollOffsetAnimationCurveImpl() {
}

blink::WebCompositorAnimationCurve::AnimationCurveType
WebScrollOffsetAnimationCurveImpl::type() const {
  return WebCompositorAnimationCurve::AnimationCurveTypeScrollOffset;
}

void WebScrollOffsetAnimationCurveImpl::setInitialValue(
    WebFloatPoint initial_value) {
  curve_->SetInitialValue(gfx::Vector2dF(initial_value.x, initial_value.y));
}

WebFloatPoint WebScrollOffsetAnimationCurveImpl::getValue(double time) const {
  gfx::Vector2dF value = curve_->GetValue(time);
  return WebFloatPoint(value.x(), value.y());
}

double WebScrollOffsetAnimationCurveImpl::duration() const {
  return curve_->Duration();
}

scoped_ptr<cc::AnimationCurve>
WebScrollOffsetAnimationCurveImpl::CloneToAnimationCurve() const {
  return curve_->Clone();
}

}  // namespace cc_blink