Commit 5dce4331 authored by loyso's avatar loyso Committed by Commit bot

CC: Allow per-curve timing functions to be steps timing functions

Implement per-curve timing functions.
A chromium part. Blink part: https://codereview.chromium.org/800133004

In general: Allow Web Animations with Animation timing functions to run on compositor.

BUG=417909
R=dstockwell@chromium.org
R=ajuma@chromium.org
TEST=ManualTests/animation/compositor-animation-steps.html

Review URL: https://codereview.chromium.org/814853003

Cr-Commit-Position: refs/heads/master@{#310203}
parent cf383c3b
......@@ -60,18 +60,30 @@ void WebFilterAnimationCurveImpl::add(const WebFilterKeyframe& keyframe,
cc::StepsTimingFunction::Create(steps, steps_start_offset)));
}
void WebFilterAnimationCurveImpl::setTimingFunction(TimingFunctionType type) {
void WebFilterAnimationCurveImpl::setLinearTimingFunction() {
curve_->SetTimingFunction(nullptr);
}
void WebFilterAnimationCurveImpl::setCubicBezierTimingFunction(
TimingFunctionType type) {
curve_->SetTimingFunction(CreateTimingFunction(type));
}
void WebFilterAnimationCurveImpl::setTimingFunction(double x1,
double y1,
double x2,
double y2) {
void WebFilterAnimationCurveImpl::setCubicBezierTimingFunction(double x1,
double y1,
double x2,
double y2) {
curve_->SetTimingFunction(
cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass());
}
void WebFilterAnimationCurveImpl::setStepsTimingFunction(
int number_of_steps,
float steps_start_offset) {
curve_->SetTimingFunction(cc::StepsTimingFunction::Create(
number_of_steps, steps_start_offset).Pass());
}
scoped_ptr<cc::AnimationCurve>
WebFilterAnimationCurveImpl::CloneToAnimationCurve() const {
return curve_->Clone();
......
......@@ -39,9 +39,14 @@ class WebFilterAnimationCurveImpl : public blink::WebFilterAnimationCurve {
virtual void add(const blink::WebFilterKeyframe& keyframe,
int steps,
float steps_start_offset);
virtual void setTimingFunction(TimingFunctionType type);
virtual void setTimingFunction(double x1, double y1, double x2, double y2);
virtual void setLinearTimingFunction();
virtual void setCubicBezierTimingFunction(TimingFunctionType);
virtual void setCubicBezierTimingFunction(double x1,
double y1,
double x2,
double y2);
virtual void setStepsTimingFunction(int number_of_steps,
float steps_start_offset);
scoped_ptr<cc::AnimationCurve> CloneToAnimationCurve() const;
......
......@@ -54,18 +54,30 @@ void WebFloatAnimationCurveImpl::add(const WebFloatKeyframe& keyframe,
cc::StepsTimingFunction::Create(steps, steps_start_offset)));
}
void WebFloatAnimationCurveImpl::setTimingFunction(TimingFunctionType type) {
void WebFloatAnimationCurveImpl::setLinearTimingFunction() {
curve_->SetTimingFunction(nullptr);
}
void WebFloatAnimationCurveImpl::setCubicBezierTimingFunction(
TimingFunctionType type) {
curve_->SetTimingFunction(CreateTimingFunction(type));
}
void WebFloatAnimationCurveImpl::setTimingFunction(double x1,
double y1,
double x2,
double y2) {
void WebFloatAnimationCurveImpl::setCubicBezierTimingFunction(double x1,
double y1,
double x2,
double y2) {
curve_->SetTimingFunction(
cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass());
}
void WebFloatAnimationCurveImpl::setStepsTimingFunction(
int number_of_steps,
float steps_start_offset) {
curve_->SetTimingFunction(cc::StepsTimingFunction::Create(
number_of_steps, steps_start_offset).Pass());
}
float WebFloatAnimationCurveImpl::getValue(double time) const {
return curve_->GetValue(base::TimeDelta::FromSecondsD(time));
}
......
......@@ -40,9 +40,14 @@ class WebFloatAnimationCurveImpl : public blink::WebFloatAnimationCurve {
virtual void add(const blink::WebFloatKeyframe& keyframe,
int steps,
float steps_start_offset);
virtual void setTimingFunction(TimingFunctionType type);
virtual void setTimingFunction(double x1, double y1, double x2, double y2);
virtual void setLinearTimingFunction();
virtual void setCubicBezierTimingFunction(TimingFunctionType);
virtual void setCubicBezierTimingFunction(double x1,
double y1,
double x2,
double y2);
virtual void setStepsTimingFunction(int number_of_steps,
float steps_start_offset);
virtual float getValue(double time) const;
......
......@@ -64,19 +64,30 @@ void WebTransformAnimationCurveImpl::add(const WebTransformKeyframe& keyframe,
cc::StepsTimingFunction::Create(steps, steps_start_offset)));
}
void WebTransformAnimationCurveImpl::setTimingFunction(
void WebTransformAnimationCurveImpl::setLinearTimingFunction() {
curve_->SetTimingFunction(nullptr);
}
void WebTransformAnimationCurveImpl::setCubicBezierTimingFunction(
TimingFunctionType type) {
curve_->SetTimingFunction(CreateTimingFunction(type));
}
void WebTransformAnimationCurveImpl::setTimingFunction(double x1,
double y1,
double x2,
double y2) {
void WebTransformAnimationCurveImpl::setCubicBezierTimingFunction(double x1,
double y1,
double x2,
double y2) {
curve_->SetTimingFunction(
cc::CubicBezierTimingFunction::Create(x1, y1, x2, y2).Pass());
}
void WebTransformAnimationCurveImpl::setStepsTimingFunction(
int number_of_steps,
float steps_start_offset) {
curve_->SetTimingFunction(cc::StepsTimingFunction::Create(
number_of_steps, steps_start_offset).Pass());
}
scoped_ptr<cc::AnimationCurve>
WebTransformAnimationCurveImpl::CloneToAnimationCurve() const {
return curve_->Clone();
......
......@@ -41,9 +41,14 @@ class WebTransformAnimationCurveImpl
virtual void add(const blink::WebTransformKeyframe& keyframe,
int steps,
float stepsStartOffset);
virtual void setTimingFunction(TimingFunctionType type);
virtual void setTimingFunction(double x1, double y1, double x2, double y2);
virtual void setLinearTimingFunction();
virtual void setCubicBezierTimingFunction(TimingFunctionType);
virtual void setCubicBezierTimingFunction(double x1,
double y1,
double x2,
double y2);
virtual void setStepsTimingFunction(int number_of_steps,
float steps_start_offset);
scoped_ptr<cc::AnimationCurve> CloneToAnimationCurve() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment