[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | cc3cfaa | 2013-03-18 09:05:52 | [diff] [blame] | 5 | #include "cc/layers/picture_layer.h" |
[email protected] | f117a4c | 2012-12-16 04:53:10 | [diff] [blame] | 6 | |
[email protected] | 4ea293f7 | 2014-08-13 03:03:17 | [diff] [blame] | 7 | #include "base/auto_reset.h" |
danakj | 7a3089f | 2016-01-16 01:20:13 | [diff] [blame] | 8 | #include "base/trace_event/trace_event.h" |
[email protected] | f7837a9 | 2013-08-21 03:00:05 | [diff] [blame] | 9 | #include "cc/layers/content_layer_client.h" |
[email protected] | cc3cfaa | 2013-03-18 09:05:52 | [diff] [blame] | 10 | #include "cc/layers/picture_layer_impl.h" |
vmpstr | e17fd21 | 2016-03-30 20:03:32 | [diff] [blame] | 11 | #include "cc/playback/recording_source.h" |
dtrainor | 8e9da48 | 2016-01-04 09:53:05 | [diff] [blame] | 12 | #include "cc/proto/cc_conversions.h" |
| 13 | #include "cc/proto/gfx_conversions.h" |
| 14 | #include "cc/proto/layer.pb.h" |
jamesr | 9b8fda3 | 2015-03-16 19:11:05 | [diff] [blame] | 15 | #include "cc/trees/layer_tree_host.h" |
[email protected] | 556fd29 | 2013-03-18 08:03:04 | [diff] [blame] | 16 | #include "cc/trees/layer_tree_impl.h" |
[email protected] | de14c2c | 2014-04-24 01:02:25 | [diff] [blame] | 17 | #include "third_party/skia/include/core/SkPictureRecorder.h" |
heejin.r.chung | d28506ba | 2014-10-23 16:36:20 | [diff] [blame] | 18 | #include "ui/gfx/geometry/rect_conversions.h" |
[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 19 | |
| 20 | namespace cc { |
| 21 | |
loyso | 0940d41 | 2016-03-14 01:30:31 | [diff] [blame] | 22 | scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { |
| 23 | return make_scoped_refptr(new PictureLayer(client)); |
[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 24 | } |
| 25 | |
loyso | 0940d41 | 2016-03-14 01:30:31 | [diff] [blame] | 26 | PictureLayer::PictureLayer(ContentLayerClient* client) |
mlliu | 42f5222 | 2016-07-11 19:15:26 | [diff] [blame] | 27 | : instrumentation_object_tracker_(id()), |
[email protected] | 36df063 | 2014-06-12 20:26:15 | [diff] [blame] | 28 | update_source_frame_number_(-1), |
mlliu | 42f5222 | 2016-07-11 19:15:26 | [diff] [blame] | 29 | is_mask_(false) { |
| 30 | inputs_.client = client; |
| 31 | } |
[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 32 | |
loyso | 0940d41 | 2016-03-14 01:30:31 | [diff] [blame] | 33 | PictureLayer::PictureLayer(ContentLayerClient* client, |
danakj | 60bc3bc | 2016-04-09 00:24:48 | [diff] [blame] | 34 | std::unique_ptr<RecordingSource> source) |
loyso | 0940d41 | 2016-03-14 01:30:31 | [diff] [blame] | 35 | : PictureLayer(client) { |
danakj | a04855a | 2015-11-18 20:39:10 | [diff] [blame] | 36 | recording_source_ = std::move(source); |
danakj | a819c255 | 2014-11-14 02:05:04 | [diff] [blame] | 37 | } |
| 38 | |
[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 39 | PictureLayer::~PictureLayer() { |
| 40 | } |
| 41 | |
danakj | 60bc3bc | 2016-04-09 00:24:48 | [diff] [blame] | 42 | std::unique_ptr<LayerImpl> PictureLayer::CreateLayerImpl( |
| 43 | LayerTreeImpl* tree_impl) { |
sunxd | c36713a | 2016-03-03 22:31:10 | [diff] [blame] | 44 | return PictureLayerImpl::Create(tree_impl, id(), is_mask_); |
[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 45 | } |
| 46 | |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 47 | void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { |
| 48 | Layer::PushPropertiesTo(base_layer); |
danakj | 7a3089f | 2016-01-16 01:20:13 | [diff] [blame] | 49 | TRACE_EVENT0("cc", "PictureLayer::PushPropertiesTo"); |
[email protected] | 3621e18 | 2012-11-09 22:37:09 | [diff] [blame] | 50 | PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); |
danakj | a4ed6a2 | 2014-12-11 01:09:38 | [diff] [blame] | 51 | // TODO(danakj): Make is_mask_ a constructor parameter for PictureLayer. |
danakj | d193f6b | 2014-12-16 00:06:23 | [diff] [blame] | 52 | DCHECK_EQ(layer_impl->is_mask(), is_mask_); |
dtrainor | 8e9da48 | 2016-01-04 09:53:05 | [diff] [blame] | 53 | DropRecordingSourceContentIfInvalid(); |
[email protected] | eda36f0 | 2013-10-23 08:15:31 | [diff] [blame] | 54 | |
mlliu | 42f5222 | 2016-07-11 19:15:26 | [diff] [blame] | 55 | layer_impl->SetNearestNeighbor(inputs_.nearest_neighbor); |
jackhou | 2422961 | 2014-12-13 23:41:00 | [diff] [blame] | 56 | |
enne | af5bda3 | 2015-02-19 01:27:36 | [diff] [blame] | 57 | // Preserve lcd text settings from the current raster source. |
| 58 | bool can_use_lcd_text = layer_impl->RasterSourceUsesLCDText(); |
vmpstr | 41d68f88 | 2016-03-30 01:20:23 | [diff] [blame] | 59 | scoped_refptr<RasterSource> raster_source = |
enne | af5bda3 | 2015-02-19 01:27:36 | [diff] [blame] | 60 | recording_source_->CreateRasterSource(can_use_lcd_text); |
hendrikw | 757ba9e | 2015-03-23 21:13:09 | [diff] [blame] | 61 | layer_impl->set_gpu_raster_max_texture_size( |
| 62 | layer_tree_host()->device_viewport_size()); |
chrishtr | c41aca7b | 2016-03-18 15:44:29 | [diff] [blame] | 63 | layer_impl->UpdateRasterSource(raster_source, &last_updated_invalidation_, |
danakj | a4ed6a2 | 2014-12-11 01:09:38 | [diff] [blame] | 64 | nullptr); |
chrishtr | c41aca7b | 2016-03-18 15:44:29 | [diff] [blame] | 65 | DCHECK(last_updated_invalidation_.IsEmpty()); |
[email protected] | 3621e18 | 2012-11-09 22:37:09 | [diff] [blame] | 66 | } |
| 67 | |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 68 | void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { |
| 69 | Layer::SetLayerTreeHost(host); |
enne | bdb6fd20 | 2015-03-10 06:01:57 | [diff] [blame] | 70 | if (!host) |
| 71 | return; |
| 72 | |
vmpstr | 5c4b681 | 2015-09-29 19:57:13 | [diff] [blame] | 73 | if (!recording_source_) |
vmpstr | e17fd21 | 2016-03-30 20:03:32 | [diff] [blame] | 74 | recording_source_.reset(new RecordingSource); |
enne | bdb6fd20 | 2015-03-10 06:01:57 | [diff] [blame] | 75 | recording_source_->SetSlowdownRasterScaleFactor( |
| 76 | host->debug_state().slow_down_raster_scale_factor); |
vmpstr | dfd2286 | 2015-09-25 17:42:41 | [diff] [blame] | 77 | // If we need to enable image decode tasks, then we have to generate the |
| 78 | // discardable images metadata. |
vmpstr | 5c4b681 | 2015-09-29 19:57:13 | [diff] [blame] | 79 | const LayerTreeSettings& settings = layer_tree_host()->settings(); |
vmpstr | dfd2286 | 2015-09-25 17:42:41 | [diff] [blame] | 80 | recording_source_->SetGenerateDiscardableImagesMetadata( |
| 81 | settings.image_decode_tasks_enabled); |
[email protected] | ce37a15 | 2013-01-08 17:12:33 | [diff] [blame] | 82 | } |
| 83 | |
danakj | 19f0c9e | 2014-10-11 03:24:42 | [diff] [blame] | 84 | void PictureLayer::SetNeedsDisplayRect(const gfx::Rect& layer_rect) { |
chrishtr | bb9af00 | 2015-12-09 02:00:11 | [diff] [blame] | 85 | DCHECK(!layer_tree_host() || !layer_tree_host()->in_paint_layer_contents()); |
chrishtr | c41aca7b | 2016-03-18 15:44:29 | [diff] [blame] | 86 | if (recording_source_) |
| 87 | recording_source_->SetNeedsDisplayRect(layer_rect); |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 88 | Layer::SetNeedsDisplayRect(layer_rect); |
[email protected] | 3621e18 | 2012-11-09 22:37:09 | [diff] [blame] | 89 | } |
| 90 | |
danakj | 5f46636a | 2015-06-19 00:01:40 | [diff] [blame] | 91 | bool PictureLayer::Update() { |
[email protected] | abe5134 | 2013-10-28 22:04:38 | [diff] [blame] | 92 | update_source_frame_number_ = layer_tree_host()->source_frame_number(); |
danakj | 5f46636a | 2015-06-19 00:01:40 | [diff] [blame] | 93 | bool updated = Layer::Update(); |
[email protected] | c50b99729 | 2013-08-03 18:44:30 | [diff] [blame] | 94 | |
[email protected] | a108f5db | 2014-07-16 06:10:27 | [diff] [blame] | 95 | gfx::Size layer_size = paint_properties().bounds; |
[email protected] | 4c159895 | 2014-04-16 02:54:48 | [diff] [blame] | 96 | |
enne | ffe5781 | 2015-02-14 02:37:20 | [diff] [blame] | 97 | recording_source_->SetBackgroundColor(SafeOpaqueBackgroundColor()); |
| 98 | recording_source_->SetRequiresClear(!contents_opaque() && |
mlliu | 42f5222 | 2016-07-11 19:15:26 | [diff] [blame] | 99 | !inputs_.client->FillsBoundsCompletely()); |
enne | ffe5781 | 2015-02-14 02:37:20 | [diff] [blame] | 100 | |
[email protected] | 08ac6f9e | 2013-12-04 05:44:09 | [diff] [blame] | 101 | TRACE_EVENT1("cc", "PictureLayer::Update", |
| 102 | "source_frame_number", |
| 103 | layer_tree_host()->source_frame_number()); |
[email protected] | 8af1ce1 | 2014-06-15 12:18:36 | [diff] [blame] | 104 | devtools_instrumentation::ScopedLayerTreeTask update_layer( |
| 105 | devtools_instrumentation::kUpdateLayer, id(), layer_tree_host()->id()); |
[email protected] | 08ac6f9e | 2013-12-04 05:44:09 | [diff] [blame] | 106 | |
[email protected] | 8f322ba | 2014-06-18 23:48:18 | [diff] [blame] | 107 | // UpdateAndExpandInvalidation will give us an invalidation that covers |
| 108 | // anything not explicitly recorded in this frame. We give this region |
| 109 | // to the impl side so that it drops tiles that may not have a recording |
| 110 | // for them. |
mlliu | 42f5222 | 2016-07-11 19:15:26 | [diff] [blame] | 111 | DCHECK(inputs_.client); |
hendrikw | 9d909aa7 | 2014-11-11 20:19:52 | [diff] [blame] | 112 | updated |= recording_source_->UpdateAndExpandInvalidation( |
mlliu | 42f5222 | 2016-07-11 19:15:26 | [diff] [blame] | 113 | inputs_.client, &last_updated_invalidation_, layer_size, |
vmpstr | e17fd21 | 2016-03-30 20:03:32 | [diff] [blame] | 114 | update_source_frame_number_, RecordingSource::RECORD_NORMALLY); |
[email protected] | 048ff15 | 2013-11-25 21:02:11 | [diff] [blame] | 115 | |
[email protected] | 214c8697 | 2013-08-20 23:43:06 | [diff] [blame] | 116 | if (updated) { |
| 117 | SetNeedsPushProperties(); |
| 118 | } else { |
hendrikw | 312ee8ac | 2014-11-12 23:24:34 | [diff] [blame] | 119 | // If this invalidation did not affect the recording source, then it can be |
| 120 | // cleared as an optimization. |
chrishtr | c41aca7b | 2016-03-18 15:44:29 | [diff] [blame] | 121 | last_updated_invalidation_.Clear(); |
[email protected] | 49304bde | 2013-07-08 21:31:22 | [diff] [blame] | 122 | } |
[email protected] | 214c8697 | 2013-08-20 23:43:06 | [diff] [blame] | 123 | |
[email protected] | 49304bde | 2013-07-08 21:31:22 | [diff] [blame] | 124 | return updated; |
[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 125 | } |
| 126 | |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 127 | void PictureLayer::SetIsMask(bool is_mask) { |
hendrikw | 4e8c632 | 2014-11-18 05:46:32 | [diff] [blame] | 128 | is_mask_ = is_mask; |
[email protected] | f677653 | 2012-12-21 20:24:33 | [diff] [blame] | 129 | } |
| 130 | |
fmalita | 2d74328 | 2016-03-22 13:32:10 | [diff] [blame] | 131 | sk_sp<SkPicture> PictureLayer::GetPicture() const { |
vmpstr | e17fd21 | 2016-03-30 20:03:32 | [diff] [blame] | 132 | // We could either flatten the RecordingSource into a single |
hendrikw | ddb87659a | 2015-10-06 20:23:37 | [diff] [blame] | 133 | // SkPicture, or paint a fresh one depending on what we intend to do with the |
[email protected] | f7837a9 | 2013-08-21 03:00:05 | [diff] [blame] | 134 | // picture. For now we just paint a fresh one to get consistent results. |
| 135 | if (!DrawsContent()) |
fmalita | 2d74328 | 2016-03-22 13:32:10 | [diff] [blame] | 136 | return nullptr; |
[email protected] | f7837a9 | 2013-08-21 03:00:05 | [diff] [blame] | 137 | |
pan.deng | 0bd2a73 | 2015-04-01 03:22:05 | [diff] [blame] | 138 | gfx::Size layer_size = bounds(); |
danakj | 60bc3bc | 2016-04-09 00:24:48 | [diff] [blame] | 139 | std::unique_ptr<RecordingSource> recording_source(new RecordingSource); |
pdr | b42dfda3 | 2015-09-16 18:34:19 | [diff] [blame] | 140 | Region recording_invalidation; |
| 141 | recording_source->UpdateAndExpandInvalidation( |
mlliu | 42f5222 | 2016-07-11 19:15:26 | [diff] [blame] | 142 | inputs_.client, &recording_invalidation, layer_size, |
| 143 | update_source_frame_number_, RecordingSource::RECORD_NORMALLY); |
pan.deng | 0bd2a73 | 2015-04-01 03:22:05 | [diff] [blame] | 144 | |
vmpstr | 41d68f88 | 2016-03-30 01:20:23 | [diff] [blame] | 145 | scoped_refptr<RasterSource> raster_source = |
pdr | b42dfda3 | 2015-09-16 18:34:19 | [diff] [blame] | 146 | recording_source->CreateRasterSource(false); |
pan.deng | 0bd2a73 | 2015-04-01 03:22:05 | [diff] [blame] | 147 | |
pdr | b42dfda3 | 2015-09-16 18:34:19 | [diff] [blame] | 148 | return raster_source->GetFlattenedPicture(); |
[email protected] | f7837a9 | 2013-08-21 03:00:05 | [diff] [blame] | 149 | } |
| 150 | |
[email protected] | a6c1b23 | 2014-05-05 23:53:08 | [diff] [blame] | 151 | bool PictureLayer::IsSuitableForGpuRasterization() const { |
hendrikw | 9d909aa7 | 2014-11-11 20:19:52 | [diff] [blame] | 152 | return recording_source_->IsSuitableForGpuRasterization(); |
[email protected] | a6c1b23 | 2014-05-05 23:53:08 | [diff] [blame] | 153 | } |
| 154 | |
[email protected] | ad63b2f | 2014-08-11 17:39:54 | [diff] [blame] | 155 | void PictureLayer::ClearClient() { |
mlliu | 42f5222 | 2016-07-11 19:15:26 | [diff] [blame] | 156 | inputs_.client = nullptr; |
[email protected] | ad63b2f | 2014-08-11 17:39:54 | [diff] [blame] | 157 | UpdateDrawsContent(HasDrawableContent()); |
| 158 | } |
| 159 | |
jackhou | 2422961 | 2014-12-13 23:41:00 | [diff] [blame] | 160 | void PictureLayer::SetNearestNeighbor(bool nearest_neighbor) { |
mlliu | 42f5222 | 2016-07-11 19:15:26 | [diff] [blame] | 161 | if (inputs_.nearest_neighbor == nearest_neighbor) |
jackhou | 2422961 | 2014-12-13 23:41:00 | [diff] [blame] | 162 | return; |
| 163 | |
mlliu | 42f5222 | 2016-07-11 19:15:26 | [diff] [blame] | 164 | inputs_.nearest_neighbor = nearest_neighbor; |
jackhou | 2422961 | 2014-12-13 23:41:00 | [diff] [blame] | 165 | SetNeedsCommit(); |
| 166 | } |
| 167 | |
[email protected] | ad63b2f | 2014-08-11 17:39:54 | [diff] [blame] | 168 | bool PictureLayer::HasDrawableContent() const { |
mlliu | 42f5222 | 2016-07-11 19:15:26 | [diff] [blame] | 169 | return inputs_.client && Layer::HasDrawableContent(); |
[email protected] | ad63b2f | 2014-08-11 17:39:54 | [diff] [blame] | 170 | } |
| 171 | |
dtrainor | 8e9da48 | 2016-01-04 09:53:05 | [diff] [blame] | 172 | void PictureLayer::SetTypeForProtoSerialization(proto::LayerNode* proto) const { |
nyquist | 607e072e9 | 2016-02-19 00:30:41 | [diff] [blame] | 173 | proto->set_type(proto::LayerNode::PICTURE_LAYER); |
dtrainor | 8e9da48 | 2016-01-04 09:53:05 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | void PictureLayer::LayerSpecificPropertiesToProto( |
| 177 | proto::LayerProperties* proto) { |
| 178 | Layer::LayerSpecificPropertiesToProto(proto); |
| 179 | DropRecordingSourceContentIfInvalid(); |
| 180 | |
| 181 | proto::PictureLayerProperties* picture = proto->mutable_picture(); |
nyquist | fbaee11 | 2016-06-24 23:15:13 | [diff] [blame] | 182 | recording_source_->ToProtobuf(picture->mutable_recording_source()); |
| 183 | |
| 184 | // Add all SkPicture items to the picture cache. |
| 185 | const DisplayItemList* display_list = recording_source_->GetDisplayItemList(); |
| 186 | if (display_list) { |
| 187 | for (auto it = display_list->begin(); it != display_list->end(); ++it) { |
| 188 | sk_sp<const SkPicture> picture = it->GetPicture(); |
| 189 | // Only DrawingDisplayItems have SkPictures. |
| 190 | if (!picture) |
| 191 | continue; |
| 192 | |
| 193 | layer_tree_host()->engine_picture_cache()->MarkUsed(picture.get()); |
| 194 | } |
| 195 | } |
| 196 | |
chrishtr | c41aca7b | 2016-03-18 15:44:29 | [diff] [blame] | 197 | RegionToProto(last_updated_invalidation_, picture->mutable_invalidation()); |
dtrainor | 8e9da48 | 2016-01-04 09:53:05 | [diff] [blame] | 198 | picture->set_is_mask(is_mask_); |
mlliu | 42f5222 | 2016-07-11 19:15:26 | [diff] [blame] | 199 | picture->set_nearest_neighbor(inputs_.nearest_neighbor); |
dtrainor | 8e9da48 | 2016-01-04 09:53:05 | [diff] [blame] | 200 | |
| 201 | picture->set_update_source_frame_number(update_source_frame_number_); |
| 202 | |
chrishtr | c41aca7b | 2016-03-18 15:44:29 | [diff] [blame] | 203 | last_updated_invalidation_.Clear(); |
dtrainor | 8e9da48 | 2016-01-04 09:53:05 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | void PictureLayer::FromLayerSpecificPropertiesProto( |
| 207 | const proto::LayerProperties& proto) { |
| 208 | Layer::FromLayerSpecificPropertiesProto(proto); |
| 209 | const proto::PictureLayerProperties& picture = proto.picture(); |
nyquist | 34a0f41 | 2016-02-19 00:19:15 | [diff] [blame] | 210 | // If this is a new layer, ensure it has a recording source. During layer |
| 211 | // hierarchy deserialization, ::SetLayerTreeHost(...) is not called, but |
| 212 | // instead the member is set directly, so it needs to be set here explicitly. |
| 213 | if (!recording_source_) |
vmpstr | e17fd21 | 2016-03-30 20:03:32 | [diff] [blame] | 214 | recording_source_.reset(new RecordingSource); |
nyquist | 34a0f41 | 2016-02-19 00:19:15 | [diff] [blame] | 215 | |
nyquist | fbaee11 | 2016-06-24 23:15:13 | [diff] [blame] | 216 | std::vector<uint32_t> used_engine_picture_ids; |
| 217 | recording_source_->FromProtobuf(picture.recording_source(), |
| 218 | layer_tree_host()->client_picture_cache(), |
| 219 | &used_engine_picture_ids); |
| 220 | |
| 221 | // Inform picture cache about which SkPictures are now in use. |
| 222 | for (uint32_t engine_picture_id : used_engine_picture_ids) |
| 223 | layer_tree_host()->client_picture_cache()->MarkUsed(engine_picture_id); |
dtrainor | 8e9da48 | 2016-01-04 09:53:05 | [diff] [blame] | 224 | |
| 225 | Region new_invalidation = RegionFromProto(picture.invalidation()); |
chrishtr | c41aca7b | 2016-03-18 15:44:29 | [diff] [blame] | 226 | last_updated_invalidation_.Swap(&new_invalidation); |
dtrainor | 8e9da48 | 2016-01-04 09:53:05 | [diff] [blame] | 227 | is_mask_ = picture.is_mask(); |
mlliu | 42f5222 | 2016-07-11 19:15:26 | [diff] [blame] | 228 | inputs_.nearest_neighbor = picture.nearest_neighbor(); |
dtrainor | 8e9da48 | 2016-01-04 09:53:05 | [diff] [blame] | 229 | |
| 230 | update_source_frame_number_ = picture.update_source_frame_number(); |
| 231 | } |
| 232 | |
[email protected] | 1a55d7dc | 2013-10-12 07:52:20 | [diff] [blame] | 233 | void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 234 | benchmark->RunOnLayer(this); |
| 235 | } |
| 236 | |
dtrainor | 8e9da48 | 2016-01-04 09:53:05 | [diff] [blame] | 237 | void PictureLayer::DropRecordingSourceContentIfInvalid() { |
| 238 | int source_frame_number = layer_tree_host()->source_frame_number(); |
| 239 | gfx::Size recording_source_bounds = recording_source_->GetSize(); |
| 240 | |
| 241 | gfx::Size layer_bounds = bounds(); |
| 242 | if (paint_properties().source_frame_number == source_frame_number) |
| 243 | layer_bounds = paint_properties().bounds; |
| 244 | |
| 245 | // If update called, then recording source size must match bounds pushed to |
| 246 | // impl layer. |
| 247 | DCHECK(update_source_frame_number_ != source_frame_number || |
| 248 | layer_bounds == recording_source_bounds) |
| 249 | << " bounds " << layer_bounds.ToString() << " recording source " |
| 250 | << recording_source_bounds.ToString(); |
| 251 | |
| 252 | if (update_source_frame_number_ != source_frame_number && |
| 253 | recording_source_bounds != layer_bounds) { |
| 254 | // Update may not get called for the layer (if it's not in the viewport |
| 255 | // for example), even though it has resized making the recording source no |
| 256 | // longer valid. In this case just destroy the recording source. |
| 257 | recording_source_->SetEmptyBounds(); |
| 258 | } |
| 259 | } |
| 260 | |
[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 261 | } // namespace cc |