| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 void ContentLayer::SetTexturePriorities( | 60 void ContentLayer::SetTexturePriorities( |
| 61 const PriorityCalculator& priority_calc) { | 61 const PriorityCalculator& priority_calc) { |
| 62 // Update the tile data before creating all the layer's tiles. | 62 // Update the tile data before creating all the layer's tiles. |
| 63 UpdateTileSizeAndTilingOption(); | 63 UpdateTileSizeAndTilingOption(); |
| 64 | 64 |
| 65 TiledLayer::SetTexturePriorities(priority_calc); | 65 TiledLayer::SetTexturePriorities(priority_calc); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void ContentLayer::Update(ResourceUpdateQueue* queue, | 68 void ContentLayer::Update(ResourceUpdateQueue* queue, |
| 69 const OcclusionTracker* occlusion, | 69 const OcclusionTracker* occlusion) { |
| 70 RenderingStats* stats) { | |
| 71 { | 70 { |
| 72 base::AutoReset<bool> ignore_set_needs_commit(&ignore_set_needs_commit_, | 71 base::AutoReset<bool> ignore_set_needs_commit(&ignore_set_needs_commit_, |
| 73 true); | 72 true); |
| 74 | 73 |
| 75 CreateUpdaterIfNeeded(); | 74 CreateUpdaterIfNeeded(); |
| 76 } | 75 } |
| 77 | 76 |
| 78 TiledLayer::Update(queue, occlusion, stats); | 77 TiledLayer::Update(queue, occlusion); |
| 79 needs_display_ = false; | 78 needs_display_ = false; |
| 80 } | 79 } |
| 81 | 80 |
| 82 bool ContentLayer::NeedMoreUpdates() { | 81 bool ContentLayer::NeedMoreUpdates() { |
| 83 return NeedsIdlePaint(); | 82 return NeedsIdlePaint(); |
| 84 } | 83 } |
| 85 | 84 |
| 86 LayerUpdater* ContentLayer::Updater() const { | 85 LayerUpdater* ContentLayer::Updater() const { |
| 87 return updater_.get(); | 86 return updater_.get(); |
| 88 } | 87 } |
| 89 | 88 |
| 90 void ContentLayer::CreateUpdaterIfNeeded() { | 89 void ContentLayer::CreateUpdaterIfNeeded() { |
| 91 if (updater_) | 90 if (updater_) |
| 92 return; | 91 return; |
| 93 scoped_ptr<LayerPainter> painter = | 92 scoped_ptr<LayerPainter> painter = |
| 94 ContentLayerPainter::Create(client_).PassAs<LayerPainter>(); | 93 ContentLayerPainter::Create(client_).PassAs<LayerPainter>(); |
| 95 if (layer_tree_host()->settings().accelerate_painting) | 94 if (layer_tree_host()->settings().accelerate_painting) |
| 96 updater_ = SkPictureContentLayerUpdater::Create(painter.Pass()); | 95 updater_ = SkPictureContentLayerUpdater::Create( |
| 96 painter.Pass(), |
| 97 rendering_stats_instrumentation()); |
| 97 else if (layer_tree_host()->settings().per_tile_painting_enabled) | 98 else if (layer_tree_host()->settings().per_tile_painting_enabled) |
| 98 updater_ = BitmapSkPictureContentLayerUpdater::Create(painter.Pass()); | 99 updater_ = BitmapSkPictureContentLayerUpdater::Create( |
| 100 painter.Pass(), |
| 101 rendering_stats_instrumentation()); |
| 99 else | 102 else |
| 100 updater_ = BitmapContentLayerUpdater::Create(painter.Pass()); | 103 updater_ = BitmapContentLayerUpdater::Create( |
| 104 painter.Pass(), |
| 105 rendering_stats_instrumentation()); |
| 101 updater_->SetOpaque(contents_opaque()); | 106 updater_->SetOpaque(contents_opaque()); |
| 102 | 107 |
| 103 unsigned texture_format = | 108 unsigned texture_format = |
| 104 layer_tree_host()->GetRendererCapabilities().best_texture_format; | 109 layer_tree_host()->GetRendererCapabilities().best_texture_format; |
| 105 SetTextureFormat(texture_format); | 110 SetTextureFormat(texture_format); |
| 106 } | 111 } |
| 107 | 112 |
| 108 void ContentLayer::SetContentsOpaque(bool opaque) { | 113 void ContentLayer::SetContentsOpaque(bool opaque) { |
| 109 Layer::SetContentsOpaque(opaque); | 114 Layer::SetContentsOpaque(opaque); |
| 110 if (updater_) | 115 if (updater_) |
| 111 updater_->SetOpaque(opaque); | 116 updater_->SetOpaque(opaque); |
| 112 } | 117 } |
| 113 | 118 |
| 114 } // namespace cc | 119 } // namespace cc |
| OLD | NEW |