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_picture_layer.h" | 5 #include "cc/test/fake_picture_layer.h" |
6 | 6 |
7 #include "cc/test/fake_picture_layer_impl.h" | 7 #include "cc/test/fake_picture_layer_impl.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
11 FakePictureLayer::FakePictureLayer(ContentLayerClient* client) | 11 FakePictureLayer::FakePictureLayer(ContentLayerClient* client) |
12 : PictureLayer(client), | 12 : PictureLayer(client), |
13 update_count_(0), | 13 update_count_(0), |
14 push_properties_count_(0), | 14 push_properties_count_(0), |
15 output_surface_created_count_(0), | 15 output_surface_created_count_(0), |
16 always_update_resources_(false) { | 16 always_update_resources_(false), |
| 17 disable_lcd_text_(false) { |
17 SetBounds(gfx::Size(1, 1)); | 18 SetBounds(gfx::Size(1, 1)); |
18 SetIsDrawable(true); | 19 SetIsDrawable(true); |
19 } | 20 } |
20 | 21 |
21 FakePictureLayer::FakePictureLayer(ContentLayerClient* client, | 22 FakePictureLayer::FakePictureLayer(ContentLayerClient* client, |
22 scoped_ptr<RecordingSource> source) | 23 scoped_ptr<RecordingSource> source) |
23 : PictureLayer(client, source.Pass()), | 24 : PictureLayer(client, source.Pass()), |
24 update_count_(0), | 25 update_count_(0), |
25 push_properties_count_(0), | 26 push_properties_count_(0), |
26 output_surface_created_count_(0), | 27 output_surface_created_count_(0), |
27 always_update_resources_(false) { | 28 always_update_resources_(false) { |
28 SetBounds(gfx::Size(1, 1)); | 29 SetBounds(gfx::Size(1, 1)); |
29 SetIsDrawable(true); | 30 SetIsDrawable(true); |
30 } | 31 } |
31 | 32 |
32 FakePictureLayer::~FakePictureLayer() {} | 33 FakePictureLayer::~FakePictureLayer() {} |
33 | 34 |
34 scoped_ptr<LayerImpl> FakePictureLayer::CreateLayerImpl( | 35 scoped_ptr<LayerImpl> FakePictureLayer::CreateLayerImpl( |
35 LayerTreeImpl* tree_impl) { | 36 LayerTreeImpl* tree_impl) { |
36 return FakePictureLayerImpl::Create(tree_impl, layer_id_); | 37 return FakePictureLayerImpl::Create(tree_impl, layer_id_); |
37 } | 38 } |
38 | 39 |
39 bool FakePictureLayer::Update(ResourceUpdateQueue* queue, | 40 bool FakePictureLayer::Update(ResourceUpdateQueue* queue, |
40 const OcclusionTracker<Layer>* occlusion) { | 41 const OcclusionTracker<Layer>* occlusion) { |
| 42 if (disable_lcd_text_) |
| 43 draw_properties().can_use_lcd_text = false; |
41 bool updated = PictureLayer::Update(queue, occlusion); | 44 bool updated = PictureLayer::Update(queue, occlusion); |
42 update_count_++; | 45 update_count_++; |
43 return updated || always_update_resources_; | 46 return updated || always_update_resources_; |
44 } | 47 } |
45 | 48 |
46 void FakePictureLayer::PushPropertiesTo(LayerImpl* layer) { | 49 void FakePictureLayer::PushPropertiesTo(LayerImpl* layer) { |
47 PictureLayer::PushPropertiesTo(layer); | 50 PictureLayer::PushPropertiesTo(layer); |
48 push_properties_count_++; | 51 push_properties_count_++; |
49 } | 52 } |
50 | 53 |
51 void FakePictureLayer::OnOutputSurfaceCreated() { | 54 void FakePictureLayer::OnOutputSurfaceCreated() { |
52 PictureLayer::OnOutputSurfaceCreated(); | 55 PictureLayer::OnOutputSurfaceCreated(); |
53 output_surface_created_count_++; | 56 output_surface_created_count_++; |
54 } | 57 } |
55 | 58 |
56 } // namespace cc | 59 } // namespace cc |
OLD | NEW |