Chromium Code Reviews| 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/test/fake_content_layer.h" | 5 #include "cc/test/fake_content_layer.h" |
| 6 | 6 |
| 7 #include "cc/resources/content_layer_updater.h" | |
| 7 #include "cc/resources/prioritized_resource.h" | 8 #include "cc/resources/prioritized_resource.h" |
| 8 #include "cc/test/fake_content_layer_impl.h" | 9 #include "cc/test/fake_content_layer_impl.h" |
| 9 | 10 |
| 10 namespace cc { | 11 namespace cc { |
| 11 | 12 |
| 13 class FakeContentLayerUpdater : public ContentLayerUpdater { | |
| 14 public: | |
| 15 ~FakeContentLayerUpdater() {} | |
|
danakj
2013/12/04 16:32:17
It should be virtual, then LGTM
| |
| 16 using ContentLayerUpdater::content_rect; | |
| 17 }; | |
| 18 | |
| 12 FakeContentLayer::FakeContentLayer(ContentLayerClient* client) | 19 FakeContentLayer::FakeContentLayer(ContentLayerClient* client) |
| 13 : ContentLayer(client), | 20 : ContentLayer(client), |
| 14 update_count_(0), | 21 update_count_(0), |
| 15 push_properties_count_(0), | 22 push_properties_count_(0), |
| 16 output_surface_created_count_(0), | 23 output_surface_created_count_(0), |
| 17 always_update_resources_(false) { | 24 always_update_resources_(false) { |
| 18 SetAnchorPoint(gfx::PointF(0.f, 0.f)); | 25 SetAnchorPoint(gfx::PointF(0.f, 0.f)); |
| 19 SetBounds(gfx::Size(1, 1)); | 26 SetBounds(gfx::Size(1, 1)); |
| 20 SetIsDrawable(true); | 27 SetIsDrawable(true); |
| 21 } | 28 } |
| 22 | 29 |
| 23 FakeContentLayer::~FakeContentLayer() {} | 30 FakeContentLayer::~FakeContentLayer() {} |
| 24 | 31 |
| 25 scoped_ptr<LayerImpl> FakeContentLayer::CreateLayerImpl( | 32 scoped_ptr<LayerImpl> FakeContentLayer::CreateLayerImpl( |
| 26 LayerTreeImpl* tree_impl) { | 33 LayerTreeImpl* tree_impl) { |
| 27 return FakeContentLayerImpl::Create(tree_impl, layer_id_).PassAs<LayerImpl>(); | 34 return FakeContentLayerImpl::Create(tree_impl, layer_id_).PassAs<LayerImpl>(); |
| 28 } | 35 } |
| 29 | 36 |
| 30 bool FakeContentLayer::Update(ResourceUpdateQueue* queue, | 37 bool FakeContentLayer::Update(ResourceUpdateQueue* queue, |
| 31 const OcclusionTracker* occlusion) { | 38 const OcclusionTracker* occlusion) { |
| 32 bool updated = ContentLayer::Update(queue, occlusion); | 39 bool updated = ContentLayer::Update(queue, occlusion); |
| 33 update_count_++; | 40 update_count_++; |
| 34 return updated || always_update_resources_; | 41 return updated || always_update_resources_; |
| 35 } | 42 } |
| 36 | 43 |
| 44 gfx::Rect FakeContentLayer::LastPaintRect() const { | |
| 45 return (static_cast<FakeContentLayerUpdater*> | |
| 46 (Updater()))->content_rect(); | |
| 47 } | |
| 48 | |
| 37 void FakeContentLayer::PushPropertiesTo(LayerImpl* layer) { | 49 void FakeContentLayer::PushPropertiesTo(LayerImpl* layer) { |
| 38 ContentLayer::PushPropertiesTo(layer); | 50 ContentLayer::PushPropertiesTo(layer); |
| 39 push_properties_count_++; | 51 push_properties_count_++; |
| 40 } | 52 } |
| 41 | 53 |
| 42 void FakeContentLayer::OnOutputSurfaceCreated() { | 54 void FakeContentLayer::OnOutputSurfaceCreated() { |
| 43 ContentLayer::OnOutputSurfaceCreated(); | 55 ContentLayer::OnOutputSurfaceCreated(); |
| 44 output_surface_created_count_++; | 56 output_surface_created_count_++; |
| 45 } | 57 } |
| 46 | 58 |
| 47 bool FakeContentLayer::HaveBackingAt(int i, int j) { | 59 bool FakeContentLayer::HaveBackingAt(int i, int j) { |
| 48 const PrioritizedResource* resource = ResourceAtForTesting(i, j); | 60 const PrioritizedResource* resource = ResourceAtForTesting(i, j); |
| 49 return resource && resource->have_backing_texture(); | 61 return resource && resource->have_backing_texture(); |
| 50 } | 62 } |
| 51 | 63 |
| 52 } // namespace cc | 64 } // namespace cc |
| OLD | NEW |