| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 last_updated_invalidation_.Clear(); | 122 last_updated_invalidation_.Clear(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 return updated; | 125 return updated; |
| 126 } | 126 } |
| 127 | 127 |
| 128 void PictureLayer::SetIsMask(bool is_mask) { | 128 void PictureLayer::SetIsMask(bool is_mask) { |
| 129 is_mask_ = is_mask; | 129 is_mask_ = is_mask; |
| 130 } | 130 } |
| 131 | 131 |
| 132 skia::RefPtr<SkPicture> PictureLayer::GetPicture() const { | 132 sk_sp<SkPicture> PictureLayer::GetPicture() const { |
| 133 // We could either flatten the DisplayListRecordingSource into a single | 133 // We could either flatten the DisplayListRecordingSource into a single |
| 134 // SkPicture, or paint a fresh one depending on what we intend to do with the | 134 // SkPicture, or paint a fresh one depending on what we intend to do with the |
| 135 // picture. For now we just paint a fresh one to get consistent results. | 135 // picture. For now we just paint a fresh one to get consistent results. |
| 136 if (!DrawsContent()) | 136 if (!DrawsContent()) |
| 137 return skia::RefPtr<SkPicture>(); | 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<DisplayListRasterSource> raster_source = |
| (...skipping 93 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 |