| Index: ui/compositor/layer.cc
|
| diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
|
| index d3eb226e9f775a2e9830f820277af57c8fc3d3ce..a3ae747b8059df56d146b13ef77b935cfb073fc3 100644
|
| --- a/ui/compositor/layer.cc
|
| +++ b/ui/compositor/layer.cc
|
| @@ -56,6 +56,7 @@ Layer::Layer()
|
| background_blur_radius_(0),
|
| layer_saturation_(0.0f),
|
| layer_brightness_(0.0f),
|
| + layer_grayscale_(0.0f),
|
| layer_inverted_(false),
|
| layer_mask_(NULL),
|
| layer_mask_back_link_(NULL),
|
| @@ -184,8 +185,9 @@ void Layer::SetTransform(const ui::Transform& transform) {
|
|
|
| Transform Layer::GetTargetTransform() const {
|
| if (animator_.get() && animator_->IsAnimatingProperty(
|
| - LayerAnimationElement::TRANSFORM))
|
| + LayerAnimationElement::TRANSFORM)) {
|
| return animator_->GetTargetTransform();
|
| + }
|
| return transform_;
|
| }
|
|
|
| @@ -195,8 +197,9 @@ void Layer::SetBounds(const gfx::Rect& bounds) {
|
|
|
| gfx::Rect Layer::GetTargetBounds() const {
|
| if (animator_.get() && animator_->IsAnimatingProperty(
|
| - LayerAnimationElement::BOUNDS))
|
| + LayerAnimationElement::BOUNDS)) {
|
| return animator_->GetTargetBounds();
|
| + }
|
| return bounds_;
|
| }
|
|
|
| @@ -229,8 +232,27 @@ void Layer::SetLayerSaturation(float saturation) {
|
| }
|
|
|
| void Layer::SetLayerBrightness(float brightness) {
|
| - layer_brightness_ = brightness;
|
| - SetLayerFilters();
|
| + GetAnimator()->SetBrightness(brightness);
|
| +}
|
| +
|
| +float Layer::GetTargetBrightness() const {
|
| + if (animator_.get() && animator_->IsAnimatingProperty(
|
| + LayerAnimationElement::BRIGHTNESS)) {
|
| + return animator_->GetTargetBrightness();
|
| + }
|
| + return layer_brightness();
|
| +}
|
| +
|
| +void Layer::SetLayerGrayscale(float grayscale) {
|
| + GetAnimator()->SetGrayscale(grayscale);
|
| +}
|
| +
|
| +float Layer::GetTargetGrayscale() const {
|
| + if (animator_.get() && animator_->IsAnimatingProperty(
|
| + LayerAnimationElement::GRAYSCALE)) {
|
| + return animator_->GetTargetGrayscale();
|
| + }
|
| + return layer_grayscale();
|
| }
|
|
|
| void Layer::SetLayerInverted(bool inverted) {
|
| @@ -270,6 +292,10 @@ void Layer::SetLayerFilters() {
|
| filters.append(WebKit::WebFilterOperation::createBrightnessFilter(
|
| layer_brightness_));
|
| }
|
| + if (layer_grayscale_) {
|
| + filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(
|
| + layer_grayscale_));
|
| + }
|
| if (layer_inverted_)
|
| filters.append(WebKit::WebFilterOperation::createInvertFilter(1.0));
|
|
|
| @@ -604,6 +630,16 @@ void Layer::SetVisibilityImmediately(bool visible) {
|
| web_layer_.setOpacity(visible_ ? opacity_ : 0.f);
|
| }
|
|
|
| +void Layer::SetBrightnessImmediately(float brightness) {
|
| + layer_brightness_ = brightness;
|
| + SetLayerFilters();
|
| +}
|
| +
|
| +void Layer::SetGrayscaleImmediately(float grayscale) {
|
| + layer_grayscale_ = grayscale;
|
| + SetLayerFilters();
|
| +}
|
| +
|
| void Layer::SetBoundsFromAnimation(const gfx::Rect& bounds) {
|
| SetBoundsImmediately(bounds);
|
| }
|
| @@ -620,6 +656,13 @@ void Layer::SetVisibilityFromAnimation(bool visibility) {
|
| SetVisibilityImmediately(visibility);
|
| }
|
|
|
| +void Layer::SetBrightnessFromAnimation(float brightness) {
|
| + SetBrightnessImmediately(brightness);
|
| +}
|
| +void Layer::SetGrayscaleFromAnimation(float grayscale) {
|
| + SetGrayscaleImmediately(grayscale);
|
| +}
|
| +
|
| void Layer::ScheduleDrawForAnimation() {
|
| ScheduleDraw();
|
| }
|
| @@ -640,6 +683,14 @@ bool Layer::GetVisibilityForAnimation() const {
|
| return visible();
|
| }
|
|
|
| +float Layer::GetBrightnessForAnimation() const {
|
| + return layer_brightness();
|
| +}
|
| +
|
| +float Layer::GetGrayscaleForAnimation() const {
|
| + return layer_grayscale();
|
| +}
|
| +
|
| void Layer::CreateWebLayer() {
|
| if (type_ == LAYER_SOLID_COLOR)
|
| web_layer_ = WebKit::WebSolidColorLayer::create();
|
|
|