| 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 "cc/layers/content_layer_client.h" | 9 #include "cc/layers/content_layer_client.h" |
| 9 #include "cc/layers/picture_layer_impl.h" | 10 #include "cc/layers/picture_layer_impl.h" |
| 10 #include "cc/playback/display_list_recording_source.h" | 11 #include "cc/playback/display_list_recording_source.h" |
| 11 #include "cc/proto/cc_conversions.h" | 12 #include "cc/proto/cc_conversions.h" |
| 12 #include "cc/proto/gfx_conversions.h" | 13 #include "cc/proto/gfx_conversions.h" |
| 13 #include "cc/proto/layer.pb.h" | 14 #include "cc/proto/layer.pb.h" |
| 14 #include "cc/trees/layer_tree_host.h" | 15 #include "cc/trees/layer_tree_host.h" |
| 15 #include "cc/trees/layer_tree_impl.h" | 16 #include "cc/trees/layer_tree_impl.h" |
| 16 #include "third_party/skia/include/core/SkPictureRecorder.h" | 17 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 17 #include "ui/gfx/geometry/rect_conversions.h" | 18 #include "ui/gfx/geometry/rect_conversions.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 43 PictureLayer::~PictureLayer() { | 44 PictureLayer::~PictureLayer() { |
| 44 } | 45 } |
| 45 | 46 |
| 46 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 47 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { |
| 47 return PictureLayerImpl::Create(tree_impl, id(), is_mask_, | 48 return PictureLayerImpl::Create(tree_impl, id(), is_mask_, |
| 48 new LayerImpl::SyncedScrollOffset); | 49 new LayerImpl::SyncedScrollOffset); |
| 49 } | 50 } |
| 50 | 51 |
| 51 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { | 52 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { |
| 52 Layer::PushPropertiesTo(base_layer); | 53 Layer::PushPropertiesTo(base_layer); |
| 54 TRACE_EVENT0("cc", "PictureLayer::PushPropertiesTo"); |
| 53 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); | 55 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); |
| 54 // TODO(danakj): Make is_mask_ a constructor parameter for PictureLayer. | 56 // TODO(danakj): Make is_mask_ a constructor parameter for PictureLayer. |
| 55 DCHECK_EQ(layer_impl->is_mask(), is_mask_); | 57 DCHECK_EQ(layer_impl->is_mask(), is_mask_); |
| 56 DropRecordingSourceContentIfInvalid(); | 58 DropRecordingSourceContentIfInvalid(); |
| 57 | 59 |
| 58 layer_impl->SetNearestNeighbor(nearest_neighbor_); | 60 layer_impl->SetNearestNeighbor(nearest_neighbor_); |
| 59 | 61 |
| 60 // Preserve lcd text settings from the current raster source. | 62 // Preserve lcd text settings from the current raster source. |
| 61 bool can_use_lcd_text = layer_impl->RasterSourceUsesLCDText(); | 63 bool can_use_lcd_text = layer_impl->RasterSourceUsesLCDText(); |
| 62 scoped_refptr<DisplayListRasterSource> raster_source = | 64 scoped_refptr<DisplayListRasterSource> raster_source = |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 if (update_source_frame_number_ != source_frame_number && | 245 if (update_source_frame_number_ != source_frame_number && |
| 244 recording_source_bounds != layer_bounds) { | 246 recording_source_bounds != layer_bounds) { |
| 245 // Update may not get called for the layer (if it's not in the viewport | 247 // Update may not get called for the layer (if it's not in the viewport |
| 246 // for example), even though it has resized making the recording source no | 248 // for example), even though it has resized making the recording source no |
| 247 // longer valid. In this case just destroy the recording source. | 249 // longer valid. In this case just destroy the recording source. |
| 248 recording_source_->SetEmptyBounds(); | 250 recording_source_->SetEmptyBounds(); |
| 249 } | 251 } |
| 250 } | 252 } |
| 251 | 253 |
| 252 } // namespace cc | 254 } // namespace cc |
| OLD | NEW |