| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // Update may not get called for the layer (if it's not in the viewport | 64 // Update may not get called for the layer (if it's not in the viewport |
| 65 // for example, even though it has resized making the recording source no | 65 // for example, even though it has resized making the recording source no |
| 66 // longer valid. In this case just destroy the recording source. | 66 // longer valid. In this case just destroy the recording source. |
| 67 recording_source_->SetEmptyBounds(); | 67 recording_source_->SetEmptyBounds(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 layer_impl->SetNearestNeighbor(nearest_neighbor_); | 70 layer_impl->SetNearestNeighbor(nearest_neighbor_); |
| 71 | 71 |
| 72 scoped_refptr<RasterSource> raster_source = | 72 scoped_refptr<RasterSource> raster_source = |
| 73 recording_source_->CreateRasterSource(); | 73 recording_source_->CreateRasterSource(); |
| 74 raster_source->SetBackgoundColor(SafeOpaqueBackgroundColor()); | |
| 75 raster_source->SetRequiresClear(!contents_opaque() && | |
| 76 !client_->FillsBoundsCompletely()); | |
| 77 layer_impl->UpdateRasterSource(raster_source, &recording_invalidation_, | 74 layer_impl->UpdateRasterSource(raster_source, &recording_invalidation_, |
| 78 nullptr); | 75 nullptr); |
| 79 DCHECK(recording_invalidation_.IsEmpty()); | 76 DCHECK(recording_invalidation_.IsEmpty()); |
| 80 } | 77 } |
| 81 | 78 |
| 82 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { | 79 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { |
| 83 Layer::SetLayerTreeHost(host); | 80 Layer::SetLayerTreeHost(host); |
| 84 if (host) { | 81 if (host) { |
| 85 if (!recording_source_) { | 82 if (!recording_source_) { |
| 86 if (host->settings().use_display_lists) { | 83 if (host->settings().use_display_lists) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 116 visible_content_rect(), 1.f / contents_scale_x()); | 113 visible_content_rect(), 1.f / contents_scale_x()); |
| 117 gfx::Size layer_size = paint_properties().bounds; | 114 gfx::Size layer_size = paint_properties().bounds; |
| 118 | 115 |
| 119 if (last_updated_visible_content_rect_ == visible_content_rect() && | 116 if (last_updated_visible_content_rect_ == visible_content_rect() && |
| 120 recording_source_->GetSize() == layer_size && !can_use_lcd_text_changed && | 117 recording_source_->GetSize() == layer_size && !can_use_lcd_text_changed && |
| 121 pending_invalidation_.IsEmpty()) { | 118 pending_invalidation_.IsEmpty()) { |
| 122 // Only early out if the visible content rect of this layer hasn't changed. | 119 // Only early out if the visible content rect of this layer hasn't changed. |
| 123 return updated; | 120 return updated; |
| 124 } | 121 } |
| 125 | 122 |
| 123 recording_source_->SetBackgroundColor(SafeOpaqueBackgroundColor()); |
| 124 recording_source_->SetRequiresClear(!contents_opaque() && |
| 125 !client_->FillsBoundsCompletely()); |
| 126 |
| 126 TRACE_EVENT1("cc", "PictureLayer::Update", | 127 TRACE_EVENT1("cc", "PictureLayer::Update", |
| 127 "source_frame_number", | 128 "source_frame_number", |
| 128 layer_tree_host()->source_frame_number()); | 129 layer_tree_host()->source_frame_number()); |
| 129 devtools_instrumentation::ScopedLayerTreeTask update_layer( | 130 devtools_instrumentation::ScopedLayerTreeTask update_layer( |
| 130 devtools_instrumentation::kUpdateLayer, id(), layer_tree_host()->id()); | 131 devtools_instrumentation::kUpdateLayer, id(), layer_tree_host()->id()); |
| 131 | 132 |
| 132 // Calling paint in WebKit can sometimes cause invalidations, so save | 133 // Calling paint in WebKit can sometimes cause invalidations, so save |
| 133 // off the invalidation prior to calling update. | 134 // off the invalidation prior to calling update. |
| 134 pending_invalidation_.Swap(&recording_invalidation_); | 135 pending_invalidation_.Swap(&recording_invalidation_); |
| 135 pending_invalidation_.Clear(); | 136 pending_invalidation_.Clear(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 218 |
| 218 bool PictureLayer::HasDrawableContent() const { | 219 bool PictureLayer::HasDrawableContent() const { |
| 219 return client_ && Layer::HasDrawableContent(); | 220 return client_ && Layer::HasDrawableContent(); |
| 220 } | 221 } |
| 221 | 222 |
| 222 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 223 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 223 benchmark->RunOnLayer(this); | 224 benchmark->RunOnLayer(this); |
| 224 } | 225 } |
| 225 | 226 |
| 226 } // namespace cc | 227 } // namespace cc |
| OLD | NEW |