OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 last_updated_invalidation_ = invalidation; | 55 last_updated_invalidation_ = invalidation; |
56 } | 56 } |
57 | 57 |
58 void set_update_source_frame_number(int number) { | 58 void set_update_source_frame_number(int number) { |
59 update_source_frame_number_ = number; | 59 update_source_frame_number_ = number; |
60 } | 60 } |
61 | 61 |
62 void set_is_mask(bool is_mask) { is_mask_ = is_mask; } | 62 void set_is_mask(bool is_mask) { is_mask_ = is_mask; } |
63 | 63 |
64 void set_nearest_neighbor(bool nearest_neighbor) { | 64 void set_nearest_neighbor(bool nearest_neighbor) { |
65 inputs_.nearest_neighbor = nearest_neighbor; | 65 picture_layer_inputs_.nearest_neighbor = nearest_neighbor; |
66 } | 66 } |
67 | 67 |
68 void ValidateSerialization( | 68 void ValidateSerialization( |
69 ImageSerializationProcessor* image_serialization_processor, | 69 ImageSerializationProcessor* image_serialization_processor, |
70 LayerTreeHost* host) { | 70 LayerTreeHost* host) { |
71 std::vector<uint32_t> engine_picture_ids = GetPictureIds(); | 71 std::vector<uint32_t> engine_picture_ids = GetPictureIds(); |
72 proto::LayerProperties proto; | 72 proto::LayerProperties proto; |
73 LayerSpecificPropertiesToProto(&proto); | 73 LayerSpecificPropertiesToProto(&proto); |
74 | 74 |
75 FakeEnginePictureCache* engine_picture_cache = | 75 FakeEnginePictureCache* engine_picture_cache = |
(...skipping 11 matching lines...) Expand all Loading... |
87 FakeClientPictureCache* client_picture_cache = | 87 FakeClientPictureCache* client_picture_cache = |
88 static_cast<FakeClientPictureCache*>(host->client_picture_cache()); | 88 static_cast<FakeClientPictureCache*>(host->client_picture_cache()); |
89 EXPECT_THAT(engine_picture_ids, | 89 EXPECT_THAT(engine_picture_ids, |
90 testing::UnorderedElementsAreArray( | 90 testing::UnorderedElementsAreArray( |
91 client_picture_cache->GetAllUsedPictureIds())); | 91 client_picture_cache->GetAllUsedPictureIds())); |
92 | 92 |
93 // Validate that the PictureLayer specific fields are properly set. | 93 // Validate that the PictureLayer specific fields are properly set. |
94 EXPECT_TRUE(recording_source()->EqualsTo(*layer->recording_source())); | 94 EXPECT_TRUE(recording_source()->EqualsTo(*layer->recording_source())); |
95 EXPECT_EQ(update_source_frame_number_, layer->update_source_frame_number_); | 95 EXPECT_EQ(update_source_frame_number_, layer->update_source_frame_number_); |
96 EXPECT_EQ(is_mask_, layer->is_mask_); | 96 EXPECT_EQ(is_mask_, layer->is_mask_); |
97 EXPECT_EQ(inputs_.nearest_neighbor, layer->inputs_.nearest_neighbor); | 97 EXPECT_EQ(picture_layer_inputs_.nearest_neighbor, |
| 98 layer->picture_layer_inputs_.nearest_neighbor); |
98 } | 99 } |
99 | 100 |
100 std::vector<uint32_t> GetPictureIds() { | 101 std::vector<uint32_t> GetPictureIds() { |
101 std::vector<uint32_t> ids; | 102 std::vector<uint32_t> ids; |
102 const DisplayItemList* display_list = | 103 const DisplayItemList* display_list = |
103 recording_source()->GetDisplayItemList(); | 104 recording_source()->GetDisplayItemList(); |
104 if (!display_list) | 105 if (!display_list) |
105 return ids; | 106 return ids; |
106 | 107 |
107 for (auto it = display_list->begin(); it != display_list->end(); ++it) { | 108 for (auto it = display_list->begin(); it != display_list->end(); ++it) { |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 // Do a main frame, record the picture layers. The frame number has changed | 527 // Do a main frame, record the picture layers. The frame number has changed |
527 // non-monotonically. | 528 // non-monotonically. |
528 layer->SetNeedsDisplay(); | 529 layer->SetNeedsDisplay(); |
529 host2->Composite(base::TimeTicks::Now()); | 530 host2->Composite(base::TimeTicks::Now()); |
530 EXPECT_EQ(3, layer->update_count()); | 531 EXPECT_EQ(3, layer->update_count()); |
531 EXPECT_EQ(1, host2->source_frame_number()); | 532 EXPECT_EQ(1, host2->source_frame_number()); |
532 } | 533 } |
533 | 534 |
534 } // namespace | 535 } // namespace |
535 } // namespace cc | 536 } // namespace cc |
OLD | NEW |