| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 recording_source_->SetSlowdownRasterScaleFactor( | 75 recording_source_->SetSlowdownRasterScaleFactor( |
| 76 host->debug_state().slow_down_raster_scale_factor); | 76 host->debug_state().slow_down_raster_scale_factor); |
| 77 // If we need to enable image decode tasks, then we have to generate the | 77 // If we need to enable image decode tasks, then we have to generate the |
| 78 // discardable images metadata. | 78 // discardable images metadata. |
| 79 const LayerTreeSettings& settings = layer_tree_host()->settings(); | 79 const LayerTreeSettings& settings = layer_tree_host()->settings(); |
| 80 recording_source_->SetGenerateDiscardableImagesMetadata( | 80 recording_source_->SetGenerateDiscardableImagesMetadata( |
| 81 settings.image_decode_tasks_enabled); | 81 settings.image_decode_tasks_enabled); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void PictureLayer::SetNeedsDisplayRect(const gfx::Rect& layer_rect) { | 84 void PictureLayer::SetNeedsDisplayRect(const gfx::Rect& layer_rect) { |
| 85 DCHECK(!layer_tree_host() || !layer_tree_host()->in_paint_layer_contents()); | 85 DCHECK(!layer_tree_host() || !GetLayerTree()->in_paint_layer_contents()); |
| 86 if (recording_source_) | 86 if (recording_source_) |
| 87 recording_source_->SetNeedsDisplayRect(layer_rect); | 87 recording_source_->SetNeedsDisplayRect(layer_rect); |
| 88 Layer::SetNeedsDisplayRect(layer_rect); | 88 Layer::SetNeedsDisplayRect(layer_rect); |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool PictureLayer::Update() { | 91 bool PictureLayer::Update() { |
| 92 update_source_frame_number_ = layer_tree_host()->source_frame_number(); | 92 update_source_frame_number_ = layer_tree_host()->source_frame_number(); |
| 93 bool updated = Layer::Update(); | 93 bool updated = Layer::Update(); |
| 94 | 94 |
| 95 gfx::Size layer_size = paint_properties().bounds; | 95 gfx::Size layer_size = paint_properties().bounds; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 if (update_source_frame_number_ != source_frame_number && | 252 if (update_source_frame_number_ != source_frame_number && |
| 253 recording_source_bounds != layer_bounds) { | 253 recording_source_bounds != layer_bounds) { |
| 254 // Update may not get called for the layer (if it's not in the viewport | 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 | 255 // for example), even though it has resized making the recording source no |
| 256 // longer valid. In this case just destroy the recording source. | 256 // longer valid. In this case just destroy the recording source. |
| 257 recording_source_->SetEmptyBounds(); | 257 recording_source_->SetEmptyBounds(); |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 } // namespace cc | 261 } // namespace cc |
| OLD | NEW |