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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 << recording_source_bounds.ToString(); | 56 << recording_source_bounds.ToString(); |
57 | 57 |
58 if (update_source_frame_number_ != source_frame_number && | 58 if (update_source_frame_number_ != source_frame_number && |
59 recording_source_bounds != impl_bounds) { | 59 recording_source_bounds != impl_bounds) { |
60 // Update may not get called for the layer (if it's not in the viewport | 60 // Update may not get called for the layer (if it's not in the viewport |
61 // for example, even though it has resized making the recording source no | 61 // for example, even though it has resized making the recording source no |
62 // longer valid. In this case just destroy the recording source. | 62 // longer valid. In this case just destroy the recording source. |
63 recording_source_->SetEmptyBounds(); | 63 recording_source_->SetEmptyBounds(); |
64 } | 64 } |
65 | 65 |
66 // Unlike other properties, invalidation must always be set on layer_impl. | |
67 // See PictureLayerImpl::PushPropertiesTo for more details. | |
68 layer_impl->invalidation_.Clear(); | |
69 layer_impl->invalidation_.Swap(&recording_invalidation_); | |
70 layer_impl->set_is_mask(is_mask_); | |
71 scoped_refptr<RasterSource> raster_source = | 66 scoped_refptr<RasterSource> raster_source = |
72 recording_source_->CreateRasterSource(); | 67 recording_source_->CreateRasterSource(); |
73 raster_source->SetBackgoundColor(SafeOpaqueBackgroundColor()); | 68 raster_source->SetBackgoundColor(SafeOpaqueBackgroundColor()); |
74 raster_source->SetRequiresClear(!contents_opaque() && | 69 raster_source->SetRequiresClear(!contents_opaque() && |
75 !client_->FillsBoundsCompletely()); | 70 !client_->FillsBoundsCompletely()); |
76 layer_impl->UpdateRasterSource(raster_source); | 71 layer_impl->UpdateRasterSource(raster_source, &recording_invalidation_, |
| 72 is_mask_, nullptr); |
| 73 DCHECK(recording_invalidation_.IsEmpty()); |
77 } | 74 } |
78 | 75 |
79 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { | 76 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { |
80 Layer::SetLayerTreeHost(host); | 77 Layer::SetLayerTreeHost(host); |
81 if (host) { | 78 if (host) { |
82 if (!recording_source_) { | 79 if (!recording_source_) { |
83 if (host->settings().use_display_lists) { | 80 if (host->settings().use_display_lists) { |
84 recording_source_.reset(new DisplayListRecordingSource); | 81 recording_source_.reset(new DisplayListRecordingSource); |
85 } else { | 82 } else { |
86 recording_source_.reset(new PicturePile); | 83 recording_source_.reset(new PicturePile); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 205 |
209 bool PictureLayer::HasDrawableContent() const { | 206 bool PictureLayer::HasDrawableContent() const { |
210 return client_ && Layer::HasDrawableContent(); | 207 return client_ && Layer::HasDrawableContent(); |
211 } | 208 } |
212 | 209 |
213 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 210 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
214 benchmark->RunOnLayer(this); | 211 benchmark->RunOnLayer(this); |
215 } | 212 } |
216 | 213 |
217 } // namespace cc | 214 } // namespace cc |
OLD | NEW |