| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 DCHECK(recording_invalidation_.IsEmpty()); | 80 DCHECK(recording_invalidation_.IsEmpty()); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { | 83 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { |
| 84 Layer::SetLayerTreeHost(host); | 84 Layer::SetLayerTreeHost(host); |
| 85 if (!host) | 85 if (!host) |
| 86 return; | 86 return; |
| 87 | 87 |
| 88 if (!recording_source_) { | 88 if (!recording_source_) { |
| 89 if (host->settings().use_display_lists) { | 89 if (host->settings().use_display_lists) { |
| 90 recording_source_.reset(new DisplayListRecordingSource); | 90 recording_source_.reset(new DisplayListRecordingSource( |
| 91 host->settings().default_tile_grid_size)); |
| 91 } else { | 92 } else { |
| 92 recording_source_.reset( | 93 recording_source_.reset( |
| 93 new PicturePile(host->settings().minimum_contents_scale, | 94 new PicturePile(host->settings().minimum_contents_scale, |
| 94 host->settings().default_tile_grid_size)); | 95 host->settings().default_tile_grid_size)); |
| 95 } | 96 } |
| 96 } | 97 } |
| 97 recording_source_->DidMoveToNewCompositor(); | 98 recording_source_->DidMoveToNewCompositor(); |
| 98 recording_source_->SetSlowdownRasterScaleFactor( | 99 recording_source_->SetSlowdownRasterScaleFactor( |
| 99 host->debug_state().slow_down_raster_scale_factor); | 100 host->debug_state().slow_down_raster_scale_factor); |
| 100 recording_source_->SetGatherPixelRefs(host->settings().gather_pixel_refs); | 101 recording_source_->SetGatherPixelRefs(host->settings().gather_pixel_refs); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // or paint a fresh one depending on what we intend to do with the | 179 // or paint a fresh one depending on what we intend to do with the |
| 179 // picture. For now we just paint a fresh one to get consistent results. | 180 // picture. For now we just paint a fresh one to get consistent results. |
| 180 if (!DrawsContent()) | 181 if (!DrawsContent()) |
| 181 return skia::RefPtr<SkPicture>(); | 182 return skia::RefPtr<SkPicture>(); |
| 182 | 183 |
| 183 gfx::Size layer_size = bounds(); | 184 gfx::Size layer_size = bounds(); |
| 184 const LayerTreeSettings& settings = layer_tree_host()->settings(); | 185 const LayerTreeSettings& settings = layer_tree_host()->settings(); |
| 185 | 186 |
| 186 if (settings.use_display_lists) { | 187 if (settings.use_display_lists) { |
| 187 scoped_ptr<RecordingSource> recording_source; | 188 scoped_ptr<RecordingSource> recording_source; |
| 188 recording_source.reset(new DisplayListRecordingSource); | 189 recording_source.reset( |
| 190 new DisplayListRecordingSource(settings.default_tile_grid_size)); |
| 189 Region recording_invalidation; | 191 Region recording_invalidation; |
| 190 recording_source->UpdateAndExpandInvalidation( | 192 recording_source->UpdateAndExpandInvalidation( |
| 191 client_, &recording_invalidation, layer_size, gfx::Rect(layer_size), | 193 client_, &recording_invalidation, layer_size, gfx::Rect(layer_size), |
| 192 update_source_frame_number_, RecordingSource::RECORD_NORMALLY); | 194 update_source_frame_number_, RecordingSource::RECORD_NORMALLY); |
| 193 | 195 |
| 194 scoped_refptr<RasterSource> raster_source = | 196 scoped_refptr<RasterSource> raster_source = |
| 195 recording_source->CreateRasterSource(false); | 197 recording_source->CreateRasterSource(false); |
| 196 | 198 |
| 197 return raster_source->GetFlattenedPicture(); | 199 return raster_source->GetFlattenedPicture(); |
| 198 } | 200 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 227 | 229 |
| 228 bool PictureLayer::HasDrawableContent() const { | 230 bool PictureLayer::HasDrawableContent() const { |
| 229 return client_ && Layer::HasDrawableContent(); | 231 return client_ && Layer::HasDrawableContent(); |
| 230 } | 232 } |
| 231 | 233 |
| 232 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 234 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 233 benchmark->RunOnLayer(this); | 235 benchmark->RunOnLayer(this); |
| 234 } | 236 } |
| 235 | 237 |
| 236 } // namespace cc | 238 } // namespace cc |
| OLD | NEW |