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 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 namespace ui { | 43 namespace ui { |
44 | 44 |
45 Layer::Layer() | 45 Layer::Layer() |
46 : type_(LAYER_TEXTURED), | 46 : type_(LAYER_TEXTURED), |
47 compositor_(NULL), | 47 compositor_(NULL), |
48 parent_(NULL), | 48 parent_(NULL), |
49 visible_(true), | 49 visible_(true), |
50 fills_bounds_opaquely_(true), | 50 fills_bounds_opaquely_(true), |
51 layer_updated_externally_(false), | 51 layer_updated_externally_(false), |
52 opacity_(1.0f), | 52 opacity_(1.0f), |
| 53 invert_(false), |
53 delegate_(NULL) { | 54 delegate_(NULL) { |
54 CreateWebLayer(); | 55 CreateWebLayer(); |
55 } | 56 } |
56 | 57 |
57 Layer::Layer(LayerType type) | 58 Layer::Layer(LayerType type) |
58 : type_(type), | 59 : type_(type), |
59 compositor_(NULL), | 60 compositor_(NULL), |
60 parent_(NULL), | 61 parent_(NULL), |
61 visible_(true), | 62 visible_(true), |
62 fills_bounds_opaquely_(true), | 63 fills_bounds_opaquely_(true), |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 void Layer::SetBackgroundBlur(int blur_radius) | 189 void Layer::SetBackgroundBlur(int blur_radius) |
189 { | 190 { |
190 WebKit::WebFilterOperations filters; | 191 WebKit::WebFilterOperations filters; |
191 if (blur_radius) | 192 if (blur_radius) |
192 filters.append(WebKit::WebBlurFilterOperation(blur_radius)); | 193 filters.append(WebKit::WebBlurFilterOperation(blur_radius)); |
193 web_layer_.setBackgroundFilters(filters); | 194 web_layer_.setBackgroundFilters(filters); |
194 | 195 |
195 background_blur_radius_ = blur_radius; | 196 background_blur_radius_ = blur_radius; |
196 } | 197 } |
197 | 198 |
| 199 void Layer::SetInvert(bool invert) |
| 200 { |
| 201 WebKit::WebFilterOperations filters; |
| 202 if (invert) { |
| 203 filters.append(WebKit::WebBasicComponentTransferFilterOperation( |
| 204 WebKit::WebBasicComponentTransferFilterOperation:: |
| 205 BasicComponentTransferFilterTypeInvert, 1.0)); |
| 206 } |
| 207 web_layer_.setFilters(filters); |
| 208 |
| 209 invert_ = invert; |
| 210 } |
| 211 |
198 float Layer::GetTargetOpacity() const { | 212 float Layer::GetTargetOpacity() const { |
199 if (animator_.get() && animator_->IsAnimatingProperty( | 213 if (animator_.get() && animator_->IsAnimatingProperty( |
200 LayerAnimationElement::OPACITY)) | 214 LayerAnimationElement::OPACITY)) |
201 return animator_->GetTargetOpacity(); | 215 return animator_->GetTargetOpacity(); |
202 return opacity_; | 216 return opacity_; |
203 } | 217 } |
204 | 218 |
205 void Layer::SetVisible(bool visible) { | 219 void Layer::SetVisible(bool visible) { |
206 GetAnimator()->SetVisibility(visible); | 220 GetAnimator()->SetVisibility(visible); |
207 } | 221 } |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 return; | 560 return; |
547 unsigned int color = 0xFF000000; | 561 unsigned int color = 0xFF000000; |
548 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; | 562 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; |
549 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); | 563 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); |
550 if (!opaque) | 564 if (!opaque) |
551 color |= 0xFF; | 565 color |= 0xFF; |
552 web_layer_.setDebugBorderColor(color); | 566 web_layer_.setDebugBorderColor(color); |
553 } | 567 } |
554 | 568 |
555 } // namespace ui | 569 } // namespace ui |
OLD | NEW |