| Index: third_party/WebKit/Source/platform/animation/WebFilterAnimationCurve.cpp
|
| diff --git a/third_party/WebKit/Source/platform/animation/WebFilterAnimationCurve.cpp b/third_party/WebKit/Source/platform/animation/WebFilterAnimationCurve.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1e2e3fa6d5a1cbcd397ea7c116ff00afb5443842
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/platform/animation/WebFilterAnimationCurve.cpp
|
| @@ -0,0 +1,99 @@
|
| +// Copyright 2016 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 "platform/animation/WebFilterAnimationCurve.h"
|
| +
|
| +#include "cc/animation/keyframed_animation_curve.h"
|
| +#include "cc/animation/timing_function.h"
|
| +#include "cc/output/filter_operations.h"
|
| +#include "platform/animation/WebFilterOperations.h"
|
| +
|
| +using blink::WebFilterKeyframe;
|
| +
|
| +namespace blink {
|
| +
|
| +WebFilterAnimationCurve::WebFilterAnimationCurve()
|
| + : m_curve(cc::KeyframedFilterAnimationCurve::Create())
|
| +{
|
| +}
|
| +
|
| +WebFilterAnimationCurve::~WebFilterAnimationCurve()
|
| +{
|
| +}
|
| +
|
| +blink::WebCompositorAnimationCurve::AnimationCurveType
|
| +WebFilterAnimationCurve::type() const
|
| +{
|
| + return WebCompositorAnimationCurve::AnimationCurveTypeFilter;
|
| +}
|
| +
|
| +void WebFilterAnimationCurve::add(const WebFilterKeyframe& keyframe,
|
| + TimingFunctionType type)
|
| +{
|
| + const cc::FilterOperations& filterOperations = static_cast<const WebFilterOperations&>(keyframe.value())
|
| + .AsFilterOperations();
|
| + m_curve->AddKeyframe(cc::FilterKeyframe::Create(
|
| + base::TimeDelta::FromSecondsD(keyframe.time()), filterOperations,
|
| + CreateTimingFunction(type)));
|
| +}
|
| +
|
| +void WebFilterAnimationCurve::add(const WebFilterKeyframe& keyframe,
|
| + double x1,
|
| + double y1,
|
| + double x2,
|
| + double y2)
|
| +{
|
| + const cc::FilterOperations& filterOperations = static_cast<const WebFilterOperations&>(keyframe.value())
|
| + .AsFilterOperations();
|
| + m_curve->AddKeyframe(cc::FilterKeyframe::Create(
|
| + base::TimeDelta::FromSecondsD(keyframe.time()), filterOperations,
|
| + cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2)));
|
| +}
|
| +
|
| +void WebFilterAnimationCurve::add(const WebFilterKeyframe& keyframe,
|
| + int steps,
|
| + float stepsStartOffset)
|
| +{
|
| + const cc::FilterOperations& filterOperations = static_cast<const WebFilterOperations&>(keyframe.value())
|
| + .AsFilterOperations();
|
| + m_curve->AddKeyframe(cc::FilterKeyframe::Create(
|
| + base::TimeDelta::FromSecondsD(keyframe.time()), filterOperations,
|
| + cc::StepsTimingFunction::Create(steps, stepsStartOffset)));
|
| +}
|
| +
|
| +void WebFilterAnimationCurve::setLinearTimingFunction()
|
| +{
|
| + m_curve->SetTimingFunction(nullptr);
|
| +}
|
| +
|
| +void WebFilterAnimationCurve::setCubicBezierTimingFunction(
|
| + TimingFunctionType type)
|
| +{
|
| + m_curve->SetTimingFunction(CreateTimingFunction(type));
|
| +}
|
| +
|
| +void WebFilterAnimationCurve::setCubicBezierTimingFunction(double x1,
|
| + double y1,
|
| + double x2,
|
| + double y2)
|
| +{
|
| + m_curve->SetTimingFunction(
|
| + cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2));
|
| +}
|
| +
|
| +void WebFilterAnimationCurve::setStepsTimingFunction(
|
| + int numberOfSteps,
|
| + float stepsStartOffset)
|
| +{
|
| + m_curve->SetTimingFunction(
|
| + cc::StepsTimingFunction::Create(numberOfSteps, stepsStartOffset));
|
| +}
|
| +
|
| +scoped_ptr<cc::AnimationCurve>
|
| +WebFilterAnimationCurve::CloneToAnimationCurve() const
|
| +{
|
| + return m_curve->Clone();
|
| +}
|
| +
|
| +} // namespace blink
|
|
|