| 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/trees/layer_tree_impl.h" | 10 #include "cc/trees/layer_tree_impl.h" |
| 11 #include "third_party/skia/include/core/SkPictureRecorder.h" | 11 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 12 #include "ui/gfx/geometry/size_conversions.h" |
| 12 #include "ui/gfx/rect_conversions.h" | 13 #include "ui/gfx/rect_conversions.h" |
| 13 | 14 |
| 14 namespace cc { | 15 namespace cc { |
| 15 | 16 |
| 16 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { | 17 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { |
| 17 return make_scoped_refptr(new PictureLayer(client)); | 18 return make_scoped_refptr(new PictureLayer(client)); |
| 18 } | 19 } |
| 19 | 20 |
| 20 PictureLayer::PictureLayer(ContentLayerClient* client) | 21 PictureLayer::PictureLayer(ContentLayerClient* client) |
| 21 : client_(client), | 22 : client_(client), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 39 if (layer_impl->bounds().IsEmpty()) { | 40 if (layer_impl->bounds().IsEmpty()) { |
| 40 // Update may not get called for an empty layer, so resize here instead. | 41 // Update may not get called for an empty layer, so resize here instead. |
| 41 // Using layer_impl because either bounds() or paint_properties().bounds | 42 // Using layer_impl because either bounds() or paint_properties().bounds |
| 42 // may disagree and either one could have been pushed to layer_impl. | 43 // may disagree and either one could have been pushed to layer_impl. |
| 43 pile_->SetEmptyBounds(); | 44 pile_->SetEmptyBounds(); |
| 44 } else if (update_source_frame_number_ == | 45 } else if (update_source_frame_number_ == |
| 45 layer_tree_host()->source_frame_number()) { | 46 layer_tree_host()->source_frame_number()) { |
| 46 // TODO(ernstm): This DCHECK is only valid as long as the pile's tiling_rect | 47 // TODO(ernstm): This DCHECK is only valid as long as the pile's tiling_rect |
| 47 // is identical to the layer_rect. | 48 // is identical to the layer_rect. |
| 48 // If update called, then pile size must match bounds pushed to impl layer. | 49 // If update called, then pile size must match bounds pushed to impl layer. |
| 49 DCHECK_EQ(layer_impl->bounds().ToString(), pile_->tiling_size().ToString()); | 50 DCHECK_EQ(gfx::ToCeiledSize(layer_impl->bounds()).ToString(), |
| 51 pile_->tiling_size().ToString()); |
| 50 } | 52 } |
| 51 | 53 |
| 52 // Unlike other properties, invalidation must always be set on layer_impl. | 54 // Unlike other properties, invalidation must always be set on layer_impl. |
| 53 // See PictureLayerImpl::PushPropertiesTo for more details. | 55 // See PictureLayerImpl::PushPropertiesTo for more details. |
| 54 layer_impl->invalidation_.Clear(); | 56 layer_impl->invalidation_.Clear(); |
| 55 layer_impl->invalidation_.Swap(&pile_invalidation_); | 57 layer_impl->invalidation_.Swap(&pile_invalidation_); |
| 56 layer_impl->pile_ = PicturePileImpl::CreateFromOther(pile_.get()); | 58 layer_impl->pile_ = PicturePileImpl::CreateFromOther(pile_.get()); |
| 57 } | 59 } |
| 58 | 60 |
| 59 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { | 61 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 205 |
| 204 bool PictureLayer::HasDrawableContent() const { | 206 bool PictureLayer::HasDrawableContent() const { |
| 205 return client_ && Layer::HasDrawableContent(); | 207 return client_ && Layer::HasDrawableContent(); |
| 206 } | 208 } |
| 207 | 209 |
| 208 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 210 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 209 benchmark->RunOnLayer(this); | 211 benchmark->RunOnLayer(this); |
| 210 } | 212 } |
| 211 | 213 |
| 212 } // namespace cc | 214 } // namespace cc |
| OLD | NEW |