OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "cc/layers/content_layer.h" | 5 #include "cc/layers/content_layer.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "cc/layers/content_layer_client.h" | 10 #include "cc/layers/content_layer_client.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 LayerUpdater* ContentLayer::Updater() const { | 89 LayerUpdater* ContentLayer::Updater() const { |
90 return updater_.get(); | 90 return updater_.get(); |
91 } | 91 } |
92 | 92 |
93 void ContentLayer::CreateUpdaterIfNeeded() { | 93 void ContentLayer::CreateUpdaterIfNeeded() { |
94 if (updater_) | 94 if (updater_) |
95 return; | 95 return; |
96 scoped_ptr<LayerPainter> painter = | 96 scoped_ptr<LayerPainter> painter = |
97 ContentLayerPainter::Create(client_).PassAs<LayerPainter>(); | 97 ContentLayerPainter::Create(client_).PassAs<LayerPainter>(); |
98 if (layer_tree_host()->settings().accelerate_painting) | 98 if (layer_tree_host()->settings().accelerate_painting) |
99 updater_ = SkPictureContentLayerUpdater::Create(painter.Pass()); | 99 updater_ = SkPictureContentLayerUpdater::Create( |
| 100 painter.Pass(), |
| 101 rendering_stats_instrumentation()); |
100 else if (layer_tree_host()->settings().per_tile_painting_enabled) | 102 else if (layer_tree_host()->settings().per_tile_painting_enabled) |
101 updater_ = BitmapSkPictureContentLayerUpdater::Create(painter.Pass()); | 103 updater_ = BitmapSkPictureContentLayerUpdater::Create( |
| 104 painter.Pass(), |
| 105 rendering_stats_instrumentation()); |
102 else | 106 else |
103 updater_ = BitmapContentLayerUpdater::Create(painter.Pass()); | 107 updater_ = BitmapContentLayerUpdater::Create( |
| 108 painter.Pass(), |
| 109 rendering_stats_instrumentation()); |
104 updater_->SetOpaque(contents_opaque()); | 110 updater_->SetOpaque(contents_opaque()); |
105 | 111 |
106 unsigned texture_format = | 112 unsigned texture_format = |
107 layer_tree_host()->GetRendererCapabilities().best_texture_format; | 113 layer_tree_host()->GetRendererCapabilities().best_texture_format; |
108 SetTextureFormat(texture_format); | 114 SetTextureFormat(texture_format); |
109 } | 115 } |
110 | 116 |
111 void ContentLayer::SetContentsOpaque(bool opaque) { | 117 void ContentLayer::SetContentsOpaque(bool opaque) { |
112 Layer::SetContentsOpaque(opaque); | 118 Layer::SetContentsOpaque(opaque); |
113 if (updater_) | 119 if (updater_) |
114 updater_->SetOpaque(opaque); | 120 updater_->SetOpaque(opaque); |
115 } | 121 } |
116 | 122 |
117 void ContentLayer::UpdateCanUseLCDText() { | 123 void ContentLayer::UpdateCanUseLCDText() { |
118 if (can_use_lcd_text_last_frame_ == can_use_lcd_text()) | 124 if (can_use_lcd_text_last_frame_ == can_use_lcd_text()) |
119 return; | 125 return; |
120 | 126 |
121 can_use_lcd_text_last_frame_ = can_use_lcd_text(); | 127 can_use_lcd_text_last_frame_ = can_use_lcd_text(); |
122 if (client_) | 128 if (client_) |
123 client_->DidChangeLayerCanUseLCDText(); | 129 client_->DidChangeLayerCanUseLCDText(); |
124 } | 130 } |
125 | 131 |
126 } // namespace cc | 132 } // namespace cc |
OLD | NEW |