| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/compositor/layer.h" | 5 #include "ui/compositor/layer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 std::unique_ptr<Layer> Layer::Clone() const { | 164 std::unique_ptr<Layer> Layer::Clone() const { |
| 165 auto clone = base::MakeUnique<Layer>(type_); | 165 auto clone = base::MakeUnique<Layer>(type_); |
| 166 | 166 |
| 167 // Background filters. | 167 // Background filters. |
| 168 clone->SetBackgroundBlur(background_blur_radius_); | 168 clone->SetBackgroundBlur(background_blur_radius_); |
| 169 clone->SetBackgroundZoom(zoom_, zoom_inset_); | 169 clone->SetBackgroundZoom(zoom_, zoom_inset_); |
| 170 | 170 |
| 171 // Filters. | 171 // Filters. |
| 172 clone->SetLayerTemperature(GetTargetTemperature()); |
| 172 clone->SetLayerSaturation(layer_saturation_); | 173 clone->SetLayerSaturation(layer_saturation_); |
| 173 clone->SetLayerBrightness(GetTargetBrightness()); | 174 clone->SetLayerBrightness(GetTargetBrightness()); |
| 174 clone->SetLayerGrayscale(GetTargetGrayscale()); | 175 clone->SetLayerGrayscale(GetTargetGrayscale()); |
| 175 clone->SetLayerInverted(layer_inverted_); | 176 clone->SetLayerInverted(layer_inverted_); |
| 176 if (alpha_shape_) | 177 if (alpha_shape_) |
| 177 clone->SetAlphaShape(base::MakeUnique<SkRegion>(*alpha_shape_)); | 178 clone->SetAlphaShape(base::MakeUnique<SkRegion>(*alpha_shape_)); |
| 178 | 179 |
| 179 // cc::Layer state. | 180 // cc::Layer state. |
| 180 if (surface_layer_ && surface_layer_->primary_surface_info().is_valid()) { | 181 if (surface_layer_ && surface_layer_->primary_surface_info().is_valid()) { |
| 181 clone->SetShowPrimarySurface(surface_layer_->primary_surface_info(), | 182 clone->SetShowPrimarySurface(surface_layer_->primary_surface_info(), |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 opacity *= current->opacity(); | 376 opacity *= current->opacity(); |
| 376 current = current->parent_; | 377 current = current->parent_; |
| 377 } | 378 } |
| 378 return opacity; | 379 return opacity; |
| 379 } | 380 } |
| 380 | 381 |
| 381 void Layer::SetLayerTemperature(float value) { | 382 void Layer::SetLayerTemperature(float value) { |
| 382 GetAnimator()->SetTemperature(value); | 383 GetAnimator()->SetTemperature(value); |
| 383 } | 384 } |
| 384 | 385 |
| 386 float Layer::GetTargetTemperature() const { |
| 387 if (animator_ && |
| 388 animator_->IsAnimatingProperty(LayerAnimationElement::TEMPERATURE)) { |
| 389 return animator_->GetTargetTemperature(); |
| 390 } |
| 391 return layer_temperature(); |
| 392 } |
| 393 |
| 385 void Layer::SetBackgroundBlur(int blur_radius) { | 394 void Layer::SetBackgroundBlur(int blur_radius) { |
| 386 background_blur_radius_ = blur_radius; | 395 background_blur_radius_ = blur_radius; |
| 387 | 396 |
| 388 SetLayerBackgroundFilters(); | 397 SetLayerBackgroundFilters(); |
| 389 } | 398 } |
| 390 | 399 |
| 391 void Layer::SetLayerSaturation(float saturation) { | 400 void Layer::SetLayerSaturation(float saturation) { |
| 392 layer_saturation_ = saturation; | 401 layer_saturation_ = saturation; |
| 393 SetLayerFilters(); | 402 SetLayerFilters(); |
| 394 } | 403 } |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(), | 1236 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(), |
| 1228 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) { | 1237 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) { |
| 1229 return mirror_ptr.get() == mirror; | 1238 return mirror_ptr.get() == mirror; |
| 1230 }); | 1239 }); |
| 1231 | 1240 |
| 1232 DCHECK(it != mirrors_.end()); | 1241 DCHECK(it != mirrors_.end()); |
| 1233 mirrors_.erase(it); | 1242 mirrors_.erase(it); |
| 1234 } | 1243 } |
| 1235 | 1244 |
| 1236 } // namespace ui | 1245 } // namespace ui |
| OLD | NEW |