| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/layers/picture_layer.h" | 5 #include "cc/layers/picture_layer.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "cc/layers/content_layer_client.h" | 8 #include "cc/layers/content_layer_client.h" |
| 9 #include "cc/layers/picture_layer_impl.h" | 9 #include "cc/layers/picture_layer_impl.h" |
| 10 #include "cc/resources/display_list_recording_source.h" | 10 #include "cc/resources/display_list_recording_source.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 DCHECK(recording_invalidation_.IsEmpty()); | 78 DCHECK(recording_invalidation_.IsEmpty()); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { | 81 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { |
| 82 Layer::SetLayerTreeHost(host); | 82 Layer::SetLayerTreeHost(host); |
| 83 if (host) { | 83 if (host) { |
| 84 if (!recording_source_) { | 84 if (!recording_source_) { |
| 85 if (host->settings().use_display_lists) { | 85 if (host->settings().use_display_lists) { |
| 86 recording_source_.reset(new DisplayListRecordingSource); | 86 recording_source_.reset(new DisplayListRecordingSource); |
| 87 } else { | 87 } else { |
| 88 recording_source_.reset( | 88 recording_source_.reset(new PicturePile); |
| 89 new PicturePile(host->settings().minimum_contents_scale, | |
| 90 host->settings().default_tile_grid_size)); | |
| 91 } | 89 } |
| 92 } | 90 } |
| 91 recording_source_->SetMinContentsScale( |
| 92 host->settings().minimum_contents_scale); |
| 93 recording_source_->SetTileGridSize(host->settings().default_tile_grid_size); |
| 93 recording_source_->SetSlowdownRasterScaleFactor( | 94 recording_source_->SetSlowdownRasterScaleFactor( |
| 94 host->debug_state().slow_down_raster_scale_factor); | 95 host->debug_state().slow_down_raster_scale_factor); |
| 95 } | 96 } |
| 96 } | 97 } |
| 97 | 98 |
| 98 void PictureLayer::SetNeedsDisplayRect(const gfx::Rect& layer_rect) { | 99 void PictureLayer::SetNeedsDisplayRect(const gfx::Rect& layer_rect) { |
| 99 if (!layer_rect.IsEmpty()) { | 100 if (!layer_rect.IsEmpty()) { |
| 100 // Clamp invalidation to the layer bounds. | 101 // Clamp invalidation to the layer bounds. |
| 101 pending_invalidation_.Union( | 102 pending_invalidation_.Union( |
| 102 gfx::IntersectRects(layer_rect, gfx::Rect(bounds()))); | 103 gfx::IntersectRects(layer_rect, gfx::Rect(bounds()))); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 218 |
| 218 bool PictureLayer::HasDrawableContent() const { | 219 bool PictureLayer::HasDrawableContent() const { |
| 219 return client_ && Layer::HasDrawableContent(); | 220 return client_ && Layer::HasDrawableContent(); |
| 220 } | 221 } |
| 221 | 222 |
| 222 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 223 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 223 benchmark->RunOnLayer(this); | 224 benchmark->RunOnLayer(this); |
| 224 } | 225 } |
| 225 | 226 |
| 226 } // namespace cc | 227 } // namespace cc |
| OLD | NEW |