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 "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
9 #include "cc/layers/content_layer_client.h" | 9 #include "cc/layers/content_layer_client.h" |
10 #include "cc/layers/picture_layer_impl.h" | 10 #include "cc/layers/picture_layer_impl.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 TRACE_EVENT0("cc", "PictureLayer::PushPropertiesTo"); | 48 TRACE_EVENT0("cc", "PictureLayer::PushPropertiesTo"); |
49 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); | 49 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); |
50 // TODO(danakj): Make is_mask_ a constructor parameter for PictureLayer. | 50 // TODO(danakj): Make is_mask_ a constructor parameter for PictureLayer. |
51 DCHECK_EQ(layer_impl->is_mask(), is_mask_); | 51 DCHECK_EQ(layer_impl->is_mask(), is_mask_); |
52 DropRecordingSourceContentIfInvalid(); | 52 DropRecordingSourceContentIfInvalid(); |
53 | 53 |
54 layer_impl->SetNearestNeighbor(nearest_neighbor_); | 54 layer_impl->SetNearestNeighbor(nearest_neighbor_); |
55 | 55 |
56 // Preserve lcd text settings from the current raster source. | 56 // Preserve lcd text settings from the current raster source. |
57 bool can_use_lcd_text = layer_impl->RasterSourceUsesLCDText(); | 57 bool can_use_lcd_text = layer_impl->RasterSourceUsesLCDText(); |
58 scoped_refptr<DisplayListRasterSource> raster_source = | 58 scoped_refptr<RasterSource> raster_source = |
59 recording_source_->CreateRasterSource(can_use_lcd_text); | 59 recording_source_->CreateRasterSource(can_use_lcd_text); |
60 layer_impl->set_gpu_raster_max_texture_size( | 60 layer_impl->set_gpu_raster_max_texture_size( |
61 layer_tree_host()->device_viewport_size()); | 61 layer_tree_host()->device_viewport_size()); |
62 layer_impl->UpdateRasterSource(raster_source, &last_updated_invalidation_, | 62 layer_impl->UpdateRasterSource(raster_source, &last_updated_invalidation_, |
63 nullptr); | 63 nullptr); |
64 DCHECK(last_updated_invalidation_.IsEmpty()); | 64 DCHECK(last_updated_invalidation_.IsEmpty()); |
65 } | 65 } |
66 | 66 |
67 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { | 67 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { |
68 Layer::SetLayerTreeHost(host); | 68 Layer::SetLayerTreeHost(host); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 return nullptr; | 137 return nullptr; |
138 | 138 |
139 gfx::Size layer_size = bounds(); | 139 gfx::Size layer_size = bounds(); |
140 scoped_ptr<DisplayListRecordingSource> recording_source( | 140 scoped_ptr<DisplayListRecordingSource> recording_source( |
141 new DisplayListRecordingSource); | 141 new DisplayListRecordingSource); |
142 Region recording_invalidation; | 142 Region recording_invalidation; |
143 recording_source->UpdateAndExpandInvalidation( | 143 recording_source->UpdateAndExpandInvalidation( |
144 client_, &recording_invalidation, layer_size, gfx::Rect(layer_size), | 144 client_, &recording_invalidation, layer_size, gfx::Rect(layer_size), |
145 update_source_frame_number_, DisplayListRecordingSource::RECORD_NORMALLY); | 145 update_source_frame_number_, DisplayListRecordingSource::RECORD_NORMALLY); |
146 | 146 |
147 scoped_refptr<DisplayListRasterSource> raster_source = | 147 scoped_refptr<RasterSource> raster_source = |
148 recording_source->CreateRasterSource(false); | 148 recording_source->CreateRasterSource(false); |
149 | 149 |
150 return raster_source->GetFlattenedPicture(); | 150 return raster_source->GetFlattenedPicture(); |
151 } | 151 } |
152 | 152 |
153 bool PictureLayer::IsSuitableForGpuRasterization() const { | 153 bool PictureLayer::IsSuitableForGpuRasterization() const { |
154 return recording_source_->IsSuitableForGpuRasterization(); | 154 return recording_source_->IsSuitableForGpuRasterization(); |
155 } | 155 } |
156 | 156 |
157 void PictureLayer::ClearClient() { | 157 void PictureLayer::ClearClient() { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 if (update_source_frame_number_ != source_frame_number && | 241 if (update_source_frame_number_ != source_frame_number && |
242 recording_source_bounds != layer_bounds) { | 242 recording_source_bounds != layer_bounds) { |
243 // Update may not get called for the layer (if it's not in the viewport | 243 // Update may not get called for the layer (if it's not in the viewport |
244 // for example), even though it has resized making the recording source no | 244 // for example), even though it has resized making the recording source no |
245 // longer valid. In this case just destroy the recording source. | 245 // longer valid. In this case just destroy the recording source. |
246 recording_source_->SetEmptyBounds(); | 246 recording_source_->SetEmptyBounds(); |
247 } | 247 } |
248 } | 248 } |
249 | 249 |
250 } // namespace cc | 250 } // namespace cc |
OLD | NEW |