| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/picture_layer.h" | 7 #include "cc/picture_layer.h" |
| 8 #include "cc/picture_layer_impl.h" | 8 #include "cc/picture_layer_impl.h" |
| 9 #include "ui/gfx/rect_conversions.h" |
| 9 | 10 |
| 10 namespace cc { | 11 namespace cc { |
| 11 | 12 |
| 12 scoped_refptr<PictureLayer> PictureLayer::create(ContentLayerClient* client) { | 13 scoped_refptr<PictureLayer> PictureLayer::create(ContentLayerClient* client) { |
| 13 return make_scoped_refptr(new PictureLayer(client)); | 14 return make_scoped_refptr(new PictureLayer(client)); |
| 14 } | 15 } |
| 15 | 16 |
| 16 PictureLayer::PictureLayer(ContentLayerClient* client) : | 17 PictureLayer::PictureLayer(ContentLayerClient* client) : |
| 17 client_(client) { | 18 client_(client) { |
| 18 } | 19 } |
| 19 | 20 |
| 20 PictureLayer::~PictureLayer() { | 21 PictureLayer::~PictureLayer() { |
| 21 } | 22 } |
| 22 | 23 |
| 23 bool PictureLayer::drawsContent() const { | 24 bool PictureLayer::drawsContent() const { |
| 24 return Layer::drawsContent() && client_; | 25 return Layer::drawsContent() && client_; |
| 25 } | 26 } |
| 26 | 27 |
| 27 scoped_ptr<LayerImpl> PictureLayer::createLayerImpl() { | 28 scoped_ptr<LayerImpl> PictureLayer::createLayerImpl() { |
| 28 return PictureLayerImpl::create(id()).PassAs<LayerImpl>(); | 29 return PictureLayerImpl::create(id()).PassAs<LayerImpl>(); |
| 29 } | 30 } |
| 30 | 31 |
| 31 void PictureLayer::pushPropertiesTo(LayerImpl* baseLayerImpl) { | 32 void PictureLayer::pushPropertiesTo(LayerImpl* base_layer) { |
| 32 PictureLayerImpl* layerImpl = static_cast<PictureLayerImpl*>(baseLayerImpl); | 33 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); |
| 33 pile_.pushPropertiesTo(layerImpl->pile_); | 34 pile_.PushPropertiesTo(layer_impl->pile_); |
| 35 |
| 36 // TODO(nduca): Need to invalidate tiles here from pile's invalidation info. |
| 37 } |
| 38 |
| 39 void PictureLayer::setNeedsDisplayRect(const gfx::RectF& layer_rect) { |
| 40 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect); |
| 41 pile_.Invalidate(rect); |
| 42 } |
| 43 |
| 44 void PictureLayer::update(ResourceUpdateQueue&, const OcclusionTracker*, |
| 45 RenderingStats& stats) { |
| 46 pile_.Resize(bounds()); |
| 47 pile_.Update(client_, stats); |
| 34 } | 48 } |
| 35 | 49 |
| 36 } // namespace cc | 50 } // namespace cc |
| OLD | NEW |