| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 bool can_use_lcd_text = layer_impl->RasterSourceUsesLCDText(); | 72 bool can_use_lcd_text = layer_impl->RasterSourceUsesLCDText(); |
| 73 scoped_refptr<RasterSource> raster_source = | 73 scoped_refptr<RasterSource> raster_source = |
| 74 recording_source_->CreateRasterSource(can_use_lcd_text); | 74 recording_source_->CreateRasterSource(can_use_lcd_text); |
| 75 layer_impl->UpdateRasterSource(raster_source, &recording_invalidation_, | 75 layer_impl->UpdateRasterSource(raster_source, &recording_invalidation_, |
| 76 nullptr); | 76 nullptr); |
| 77 DCHECK(recording_invalidation_.IsEmpty()); | 77 DCHECK(recording_invalidation_.IsEmpty()); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { | 80 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { |
| 81 Layer::SetLayerTreeHost(host); | 81 Layer::SetLayerTreeHost(host); |
| 82 if (host) { | 82 if (!host) |
| 83 if (!recording_source_) { | 83 return; |
| 84 if (host->settings().use_display_lists) { | 84 |
| 85 recording_source_.reset(new DisplayListRecordingSource); | 85 if (!recording_source_) { |
| 86 } else { | 86 if (host->settings().use_display_lists) { |
| 87 recording_source_.reset( | 87 recording_source_.reset(new DisplayListRecordingSource); |
| 88 new PicturePile(host->settings().minimum_contents_scale, | 88 } else { |
| 89 host->settings().default_tile_grid_size)); | 89 recording_source_.reset( |
| 90 } | 90 new PicturePile(host->settings().minimum_contents_scale, |
| 91 host->settings().default_tile_grid_size)); |
| 91 } | 92 } |
| 92 recording_source_->DidMoveToNewCompositor(); | |
| 93 recording_source_->SetSlowdownRasterScaleFactor( | |
| 94 host->debug_state().slow_down_raster_scale_factor); | |
| 95 } | 93 } |
| 94 recording_source_->DidMoveToNewCompositor(); |
| 95 recording_source_->SetSlowdownRasterScaleFactor( |
| 96 host->debug_state().slow_down_raster_scale_factor); |
| 97 |
| 98 DCHECK(host->settings().raster_enabled); |
| 96 } | 99 } |
| 97 | 100 |
| 98 void PictureLayer::SetNeedsDisplayRect(const gfx::Rect& layer_rect) { | 101 void PictureLayer::SetNeedsDisplayRect(const gfx::Rect& layer_rect) { |
| 99 if (!layer_rect.IsEmpty()) { | 102 if (!layer_rect.IsEmpty()) { |
| 100 // Clamp invalidation to the layer bounds. | 103 // Clamp invalidation to the layer bounds. |
| 101 pending_invalidation_.Union( | 104 pending_invalidation_.Union( |
| 102 gfx::IntersectRects(layer_rect, gfx::Rect(bounds()))); | 105 gfx::IntersectRects(layer_rect, gfx::Rect(bounds()))); |
| 103 } | 106 } |
| 104 Layer::SetNeedsDisplayRect(layer_rect); | 107 Layer::SetNeedsDisplayRect(layer_rect); |
| 105 } | 108 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 206 |
| 204 bool PictureLayer::HasDrawableContent() const { | 207 bool PictureLayer::HasDrawableContent() const { |
| 205 return client_ && Layer::HasDrawableContent(); | 208 return client_ && Layer::HasDrawableContent(); |
| 206 } | 209 } |
| 207 | 210 |
| 208 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 211 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 209 benchmark->RunOnLayer(this); | 212 benchmark->RunOnLayer(this); |
| 210 } | 213 } |
| 211 | 214 |
| 212 } // namespace cc | 215 } // namespace cc |
| OLD | NEW |