| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // longer valid. In this case just destroy the recording source. | 66 // longer valid. In this case just destroy the recording source. |
| 67 recording_source_->SetEmptyBounds(); | 67 recording_source_->SetEmptyBounds(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 layer_impl->SetNearestNeighbor(nearest_neighbor_); | 70 layer_impl->SetNearestNeighbor(nearest_neighbor_); |
| 71 | 71 |
| 72 // Preserve lcd text settings from the current raster source. | 72 // Preserve lcd text settings from the current raster source. |
| 73 bool can_use_lcd_text = layer_impl->RasterSourceUsesLCDText(); | 73 bool can_use_lcd_text = layer_impl->RasterSourceUsesLCDText(); |
| 74 scoped_refptr<RasterSource> raster_source = | 74 scoped_refptr<RasterSource> raster_source = |
| 75 recording_source_->CreateRasterSource(can_use_lcd_text); | 75 recording_source_->CreateRasterSource(can_use_lcd_text); |
| 76 layer_impl->set_gpu_raster_max_texture_size( |
| 77 layer_tree_host()->device_viewport_size()); |
| 76 layer_impl->UpdateRasterSource(raster_source, &recording_invalidation_, | 78 layer_impl->UpdateRasterSource(raster_source, &recording_invalidation_, |
| 77 nullptr); | 79 nullptr); |
| 78 DCHECK(recording_invalidation_.IsEmpty()); | 80 DCHECK(recording_invalidation_.IsEmpty()); |
| 79 } | 81 } |
| 80 | 82 |
| 81 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { | 83 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { |
| 82 Layer::SetLayerTreeHost(host); | 84 Layer::SetLayerTreeHost(host); |
| 83 if (!host) | 85 if (!host) |
| 84 return; | 86 return; |
| 85 | 87 |
| 86 if (!recording_source_) { | 88 if (!recording_source_) { |
| 87 if (host->settings().use_display_lists) { | 89 if (host->settings().use_display_lists) { |
| 88 recording_source_.reset(new DisplayListRecordingSource); | 90 recording_source_.reset(new DisplayListRecordingSource); |
| 89 } else { | 91 } else { |
| 90 recording_source_.reset( | 92 recording_source_.reset( |
| 91 new PicturePile(host->settings().minimum_contents_scale, | 93 new PicturePile(host->settings().minimum_contents_scale, |
| 92 host->settings().default_tile_grid_size)); | 94 host->settings().default_tile_grid_size)); |
| 93 } | 95 } |
| 94 } | 96 } |
| 95 recording_source_->DidMoveToNewCompositor(); | 97 recording_source_->DidMoveToNewCompositor(); |
| 96 recording_source_->SetSlowdownRasterScaleFactor( | 98 recording_source_->SetSlowdownRasterScaleFactor( |
| 97 host->debug_state().slow_down_raster_scale_factor); | 99 host->debug_state().slow_down_raster_scale_factor); |
| 100 recording_source_->SetGatherPixelRefs(host->settings().gather_pixel_refs); |
| 98 | 101 |
| 99 DCHECK(host->settings().raster_enabled); | 102 DCHECK(host->settings().raster_enabled); |
| 100 } | 103 } |
| 101 | 104 |
| 102 void PictureLayer::SetNeedsDisplayRect(const gfx::Rect& layer_rect) { | 105 void PictureLayer::SetNeedsDisplayRect(const gfx::Rect& layer_rect) { |
| 103 if (!layer_rect.IsEmpty()) { | 106 if (!layer_rect.IsEmpty()) { |
| 104 // Clamp invalidation to the layer bounds. | 107 // Clamp invalidation to the layer bounds. |
| 105 pending_invalidation_.Union( | 108 pending_invalidation_.Union( |
| 106 gfx::IntersectRects(layer_rect, gfx::Rect(bounds()))); | 109 gfx::IntersectRects(layer_rect, gfx::Rect(bounds()))); |
| 107 } | 110 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 210 |
| 208 bool PictureLayer::HasDrawableContent() const { | 211 bool PictureLayer::HasDrawableContent() const { |
| 209 return client_ && Layer::HasDrawableContent(); | 212 return client_ && Layer::HasDrawableContent(); |
| 210 } | 213 } |
| 211 | 214 |
| 212 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 215 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 213 benchmark->RunOnLayer(this); | 216 benchmark->RunOnLayer(this); |
| 214 } | 217 } |
| 215 | 218 |
| 216 } // namespace cc | 219 } // namespace cc |
| OLD | NEW |