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