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/playback/display_list_recording_source.h" | 10 #include "cc/playback/display_list_recording_source.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Update may not get called for the layer (if it's not in the viewport | 67 // Update may not get called for the layer (if it's not in the viewport |
68 // for example, even though it has resized making the recording source no | 68 // for example, even though it has resized making the recording source no |
69 // longer valid. In this case just destroy the recording source. | 69 // longer valid. In this case just destroy the recording source. |
70 recording_source_->SetEmptyBounds(); | 70 recording_source_->SetEmptyBounds(); |
71 } | 71 } |
72 | 72 |
73 layer_impl->SetNearestNeighbor(nearest_neighbor_); | 73 layer_impl->SetNearestNeighbor(nearest_neighbor_); |
74 | 74 |
75 // Preserve lcd text settings from the current raster source. | 75 // Preserve lcd text settings from the current raster source. |
76 bool can_use_lcd_text = layer_impl->RasterSourceUsesLCDText(); | 76 bool can_use_lcd_text = layer_impl->RasterSourceUsesLCDText(); |
77 scoped_refptr<RasterSource> raster_source = | 77 scoped_refptr<DisplayListRasterSource> raster_source = |
78 recording_source_->CreateRasterSource(can_use_lcd_text); | 78 recording_source_->CreateRasterSource(can_use_lcd_text); |
79 layer_impl->set_gpu_raster_max_texture_size( | 79 layer_impl->set_gpu_raster_max_texture_size( |
80 layer_tree_host()->device_viewport_size()); | 80 layer_tree_host()->device_viewport_size()); |
81 layer_impl->UpdateRasterSource(raster_source, &recording_invalidation_, | 81 layer_impl->UpdateRasterSource(raster_source, &recording_invalidation_, |
82 nullptr); | 82 nullptr); |
83 DCHECK(recording_invalidation_.IsEmpty()); | 83 DCHECK(recording_invalidation_.IsEmpty()); |
84 } | 84 } |
85 | 85 |
86 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { | 86 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { |
87 Layer::SetLayerTreeHost(host); | 87 Layer::SetLayerTreeHost(host); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 return skia::RefPtr<SkPicture>(); | 176 return skia::RefPtr<SkPicture>(); |
177 | 177 |
178 gfx::Size layer_size = bounds(); | 178 gfx::Size layer_size = bounds(); |
179 scoped_ptr<DisplayListRecordingSource> recording_source( | 179 scoped_ptr<DisplayListRecordingSource> recording_source( |
180 new DisplayListRecordingSource); | 180 new DisplayListRecordingSource); |
181 Region recording_invalidation; | 181 Region recording_invalidation; |
182 recording_source->UpdateAndExpandInvalidation( | 182 recording_source->UpdateAndExpandInvalidation( |
183 client_, &recording_invalidation, layer_size, gfx::Rect(layer_size), | 183 client_, &recording_invalidation, layer_size, gfx::Rect(layer_size), |
184 update_source_frame_number_, DisplayListRecordingSource::RECORD_NORMALLY); | 184 update_source_frame_number_, DisplayListRecordingSource::RECORD_NORMALLY); |
185 | 185 |
186 scoped_refptr<RasterSource> raster_source = | 186 scoped_refptr<DisplayListRasterSource> raster_source = |
187 recording_source->CreateRasterSource(false); | 187 recording_source->CreateRasterSource(false); |
188 | 188 |
189 return raster_source->GetFlattenedPicture(); | 189 return raster_source->GetFlattenedPicture(); |
190 } | 190 } |
191 | 191 |
192 bool PictureLayer::IsSuitableForGpuRasterization() const { | 192 bool PictureLayer::IsSuitableForGpuRasterization() const { |
193 return recording_source_->IsSuitableForGpuRasterization(); | 193 return recording_source_->IsSuitableForGpuRasterization(); |
194 } | 194 } |
195 | 195 |
196 void PictureLayer::ClearClient() { | 196 void PictureLayer::ClearClient() { |
(...skipping 11 matching lines...) Expand all Loading... |
208 | 208 |
209 bool PictureLayer::HasDrawableContent() const { | 209 bool PictureLayer::HasDrawableContent() const { |
210 return client_ && Layer::HasDrawableContent(); | 210 return client_ && Layer::HasDrawableContent(); |
211 } | 211 } |
212 | 212 |
213 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 213 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
214 benchmark->RunOnLayer(this); | 214 benchmark->RunOnLayer(this); |
215 } | 215 } |
216 | 216 |
217 } // namespace cc | 217 } // namespace cc |
OLD | NEW |