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