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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 namespace ui { | 45 namespace ui { |
46 | 46 |
47 Layer::Layer() | 47 Layer::Layer() |
48 : type_(LAYER_TEXTURED), | 48 : type_(LAYER_TEXTURED), |
49 compositor_(NULL), | 49 compositor_(NULL), |
50 parent_(NULL), | 50 parent_(NULL), |
51 visible_(true), | 51 visible_(true), |
52 fills_bounds_opaquely_(true), | 52 fills_bounds_opaquely_(true), |
53 layer_updated_externally_(false), | 53 layer_updated_externally_(false), |
54 opacity_(1.0f), | 54 opacity_(1.0f), |
55 invert_(false), | |
55 delegate_(NULL), | 56 delegate_(NULL), |
56 scale_canvas_(true), | 57 scale_canvas_(true), |
57 device_scale_factor_(1.0f) { | 58 device_scale_factor_(1.0f) { |
58 CreateWebLayer(); | 59 CreateWebLayer(); |
59 } | 60 } |
60 | 61 |
61 Layer::Layer(LayerType type) | 62 Layer::Layer(LayerType type) |
62 : type_(type), | 63 : type_(type), |
63 compositor_(NULL), | 64 compositor_(NULL), |
64 parent_(NULL), | 65 parent_(NULL), |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 void Layer::SetBackgroundBlur(int blur_radius) | 199 void Layer::SetBackgroundBlur(int blur_radius) |
199 { | 200 { |
200 WebKit::WebFilterOperations filters; | 201 WebKit::WebFilterOperations filters; |
201 if (blur_radius) | 202 if (blur_radius) |
202 filters.append(WebKit::WebBlurFilterOperation(blur_radius)); | 203 filters.append(WebKit::WebBlurFilterOperation(blur_radius)); |
203 web_layer_.setBackgroundFilters(filters); | 204 web_layer_.setBackgroundFilters(filters); |
204 | 205 |
205 background_blur_radius_ = blur_radius; | 206 background_blur_radius_ = blur_radius; |
206 } | 207 } |
207 | 208 |
209 void Layer::SetInvert(bool invert) | |
210 { | |
sky
2012/05/16 21:07:48
{ on previous line
Zachary Kuznia
2012/05/17 08:25:25
Done.
| |
211 WebKit::WebFilterOperations filters; | |
212 if (invert) { | |
213 filters.append(WebKit::WebBasicComponentTransferFilterOperation( | |
214 WebKit::WebBasicComponentTransferFilterOperation:: | |
215 BasicComponentTransferFilterTypeInvert, 1.0)); | |
216 } | |
217 web_layer_.setFilters(filters); | |
218 | |
219 invert_ = invert; | |
220 } | |
221 | |
208 float Layer::GetTargetOpacity() const { | 222 float Layer::GetTargetOpacity() const { |
209 if (animator_.get() && animator_->IsAnimatingProperty( | 223 if (animator_.get() && animator_->IsAnimatingProperty( |
210 LayerAnimationElement::OPACITY)) | 224 LayerAnimationElement::OPACITY)) |
211 return animator_->GetTargetOpacity(); | 225 return animator_->GetTargetOpacity(); |
212 return opacity_; | 226 return opacity_; |
213 } | 227 } |
214 | 228 |
215 void Layer::SetVisible(bool visible) { | 229 void Layer::SetVisible(bool visible) { |
216 GetAnimator()->SetVisibility(visible); | 230 GetAnimator()->SetVisibility(visible); |
217 } | 231 } |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
618 return; | 632 return; |
619 unsigned int color = 0xFF000000; | 633 unsigned int color = 0xFF000000; |
620 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; | 634 color |= web_layer_is_accelerated_ ? 0x0000FF00 : 0x00FF0000; |
621 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); | 635 bool opaque = fills_bounds_opaquely_ && (GetCombinedOpacity() == 1.f); |
622 if (!opaque) | 636 if (!opaque) |
623 color |= 0xFF; | 637 color |= 0xFF; |
624 web_layer_.setDebugBorderColor(color); | 638 web_layer_.setDebugBorderColor(color); |
625 } | 639 } |
626 | 640 |
627 } // namespace ui | 641 } // namespace ui |
OLD | NEW |