| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 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().per_tile_painting_enabled) { |
| 99 updater_ = SkPictureContentLayerUpdater::Create( | |
| 100 painter.Pass(), | |
| 101 rendering_stats_instrumentation(), | |
| 102 id()); | |
| 103 else if (layer_tree_host()->settings().per_tile_painting_enabled) | |
| 104 updater_ = BitmapSkPictureContentLayerUpdater::Create( | 99 updater_ = BitmapSkPictureContentLayerUpdater::Create( |
| 105 painter.Pass(), | 100 painter.Pass(), |
| 106 rendering_stats_instrumentation(), | 101 rendering_stats_instrumentation(), |
| 107 id()); | 102 id()); |
| 108 else | 103 } else { |
| 109 updater_ = BitmapContentLayerUpdater::Create( | 104 updater_ = BitmapContentLayerUpdater::Create( |
| 110 painter.Pass(), | 105 painter.Pass(), |
| 111 rendering_stats_instrumentation(), | 106 rendering_stats_instrumentation(), |
| 112 id()); | 107 id()); |
| 108 } |
| 113 updater_->SetOpaque(contents_opaque()); | 109 updater_->SetOpaque(contents_opaque()); |
| 114 | 110 |
| 115 unsigned texture_format = | 111 unsigned texture_format = |
| 116 layer_tree_host()->GetRendererCapabilities().best_texture_format; | 112 layer_tree_host()->GetRendererCapabilities().best_texture_format; |
| 117 SetTextureFormat(texture_format); | 113 SetTextureFormat(texture_format); |
| 118 } | 114 } |
| 119 | 115 |
| 120 void ContentLayer::SetContentsOpaque(bool opaque) { | 116 void ContentLayer::SetContentsOpaque(bool opaque) { |
| 121 Layer::SetContentsOpaque(opaque); | 117 Layer::SetContentsOpaque(opaque); |
| 122 if (updater_) | 118 if (updater_) |
| 123 updater_->SetOpaque(opaque); | 119 updater_->SetOpaque(opaque); |
| 124 } | 120 } |
| 125 | 121 |
| 126 void ContentLayer::UpdateCanUseLCDText() { | 122 void ContentLayer::UpdateCanUseLCDText() { |
| 127 if (can_use_lcd_text_last_frame_ == can_use_lcd_text()) | 123 if (can_use_lcd_text_last_frame_ == can_use_lcd_text()) |
| 128 return; | 124 return; |
| 129 | 125 |
| 130 can_use_lcd_text_last_frame_ = can_use_lcd_text(); | 126 can_use_lcd_text_last_frame_ = can_use_lcd_text(); |
| 131 if (client_) | 127 if (client_) |
| 132 client_->DidChangeLayerCanUseLCDText(); | 128 client_->DidChangeLayerCanUseLCDText(); |
| 133 } | 129 } |
| 134 | 130 |
| 135 bool ContentLayer::SupportsLCDText() const { | 131 bool ContentLayer::SupportsLCDText() const { |
| 136 return true; | 132 return true; |
| 137 } | 133 } |
| 138 | 134 |
| 139 } // namespace cc | 135 } // namespace cc |
| OLD | NEW |