OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/android/compositor/layer/content_layer.h" | 5 #include "chrome/browser/android/compositor/layer/content_layer.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
9 #include "cc/layers/layer_collections.h" | 9 #include "cc/layers/layer_collections.h" |
10 #include "cc/layers/surface_layer.h" | 10 #include "cc/layers/surface_layer.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } | 57 } |
58 | 58 |
59 void ContentLayer::SetProperties(int id, | 59 void ContentLayer::SetProperties(int id, |
60 bool can_use_live_layer, | 60 bool can_use_live_layer, |
61 float static_to_view_blend, | 61 float static_to_view_blend, |
62 bool should_override_content_alpha, | 62 bool should_override_content_alpha, |
63 float content_alpha_override, | 63 float content_alpha_override, |
64 float saturation, | 64 float saturation, |
65 bool should_clip, | 65 bool should_clip, |
66 const gfx::Rect& clip) { | 66 const gfx::Rect& clip) { |
67 scoped_refptr<cc::Layer> live_layer; | 67 scoped_refptr<cc::Layer> live_layer = tab_content_manager_->GetLiveLayer(id); |
68 if (can_use_live_layer) | 68 if (live_layer) |
69 live_layer = tab_content_manager_->GetLiveLayer(id); | 69 live_layer->SetHideLayerAndSubtree(!can_use_live_layer); |
70 bool live_layer_draws = GetDrawsContentLeaf(live_layer); | 70 bool live_layer_draws = GetDrawsContentLeaf(live_layer); |
71 | 71 |
72 scoped_refptr<ThumbnailLayer> static_layer = | 72 scoped_refptr<ThumbnailLayer> static_layer = |
73 tab_content_manager_->GetOrCreateStaticLayer(id, !live_layer_draws); | 73 tab_content_manager_->GetOrCreateStaticLayer(id, !live_layer_draws); |
74 | 74 |
75 float content_opacity = | 75 float content_opacity = |
76 should_override_content_alpha ? content_alpha_override : 1.0f; | 76 should_override_content_alpha ? content_alpha_override : 1.0f; |
77 float static_opacity = | 77 float static_opacity = |
78 should_override_content_alpha ? content_alpha_override : 1.0f; | 78 should_override_content_alpha ? content_alpha_override : 1.0f; |
79 if (live_layer_draws) | 79 if (live_layer_draws) |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 | 132 |
133 ContentLayer::ContentLayer(TabContentManager* tab_content_manager) | 133 ContentLayer::ContentLayer(TabContentManager* tab_content_manager) |
134 : layer_(cc::Layer::Create()), | 134 : layer_(cc::Layer::Create()), |
135 tab_content_manager_(tab_content_manager) {} | 135 tab_content_manager_(tab_content_manager) {} |
136 | 136 |
137 ContentLayer::~ContentLayer() { | 137 ContentLayer::~ContentLayer() { |
138 } | 138 } |
139 | 139 |
140 } // namespace android | 140 } // namespace android |
OLD | NEW |