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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 #include "cc/layers/solid_color_layer.h" | 6 #include "cc/layers/solid_color_layer.h" |
7 #include "cc/layers/texture_layer.h" | 7 #include "cc/layers/texture_layer.h" |
8 #include "cc/output/copy_output_request.h" | 8 #include "cc/output/copy_output_request.h" |
9 #include "cc/output/copy_output_result.h" | 9 #include "cc/output/copy_output_result.h" |
10 #include "cc/test/fake_picture_layer.h" | 10 #include "cc/test/fake_picture_layer.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } else { | 76 } else { |
77 DCHECK_EQ(test_type_, PIXEL_TEST_GL); | 77 DCHECK_EQ(test_type_, PIXEL_TEST_GL); |
78 request = CopyOutputRequest::CreateRequest( | 78 request = CopyOutputRequest::CreateRequest( |
79 base::Bind(&LayerTreeHostReadbackPixelTest::ReadbackResultAsTexture, | 79 base::Bind(&LayerTreeHostReadbackPixelTest::ReadbackResultAsTexture, |
80 base::Unretained(this))); | 80 base::Unretained(this))); |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 if (!copy_subrect_.IsEmpty()) | 84 if (!copy_subrect_.IsEmpty()) |
85 request->set_area(copy_subrect_); | 85 request->set_area(copy_subrect_); |
86 return request.Pass(); | 86 return request; |
87 } | 87 } |
88 | 88 |
89 void BeginTest() override { | 89 void BeginTest() override { |
90 if (insert_copy_request_after_frame_count_ == 0) { | 90 if (insert_copy_request_after_frame_count_ == 0) { |
91 Layer* const target = | 91 Layer* const target = |
92 readback_target_ ? readback_target_ : layer_tree_host()->root_layer(); | 92 readback_target_ ? readback_target_ : layer_tree_host()->root_layer(); |
93 target->RequestCopyOfOutput(CreateCopyOutputRequest().Pass()); | 93 target->RequestCopyOfOutput(CreateCopyOutputRequest().Pass()); |
94 } | 94 } |
95 PostSetNeedsCommitToMainThread(); | 95 PostSetNeedsCommitToMainThread(); |
96 } | 96 } |
(...skipping 21 matching lines...) Expand all Loading... |
118 TextureMailbox texture_mailbox; | 118 TextureMailbox texture_mailbox; |
119 scoped_ptr<SingleReleaseCallback> release_callback; | 119 scoped_ptr<SingleReleaseCallback> release_callback; |
120 result->TakeTexture(&texture_mailbox, &release_callback); | 120 result->TakeTexture(&texture_mailbox, &release_callback); |
121 EXPECT_TRUE(texture_mailbox.IsValid()); | 121 EXPECT_TRUE(texture_mailbox.IsValid()); |
122 EXPECT_TRUE(texture_mailbox.IsTexture()); | 122 EXPECT_TRUE(texture_mailbox.IsTexture()); |
123 | 123 |
124 scoped_ptr<SkBitmap> bitmap = | 124 scoped_ptr<SkBitmap> bitmap = |
125 CopyTextureMailboxToBitmap(result->size(), texture_mailbox); | 125 CopyTextureMailboxToBitmap(result->size(), texture_mailbox); |
126 release_callback->Run(gpu::SyncToken(), false); | 126 release_callback->Run(gpu::SyncToken(), false); |
127 | 127 |
128 ReadbackResultAsBitmap(CopyOutputResult::CreateBitmapResult(bitmap.Pass())); | 128 ReadbackResultAsBitmap( |
| 129 CopyOutputResult::CreateBitmapResult(std::move(bitmap))); |
129 } | 130 } |
130 | 131 |
131 ReadbackType readback_type_; | 132 ReadbackType readback_type_; |
132 gfx::Rect copy_subrect_; | 133 gfx::Rect copy_subrect_; |
133 int insert_copy_request_after_frame_count_; | 134 int insert_copy_request_after_frame_count_; |
134 }; | 135 }; |
135 | 136 |
136 void IgnoreReadbackResult(scoped_ptr<CopyOutputResult> result) { | 137 void IgnoreReadbackResult(scoped_ptr<CopyOutputResult> result) { |
137 } | 138 } |
138 | 139 |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 READBACK_DEFAULT), | 548 READBACK_DEFAULT), |
548 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL, | 549 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL, |
549 READBACK_DEFAULT), | 550 READBACK_DEFAULT), |
550 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL, | 551 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL, |
551 READBACK_BITMAP))); | 552 READBACK_BITMAP))); |
552 | 553 |
553 } // namespace | 554 } // namespace |
554 } // namespace cc | 555 } // namespace cc |
555 | 556 |
556 #endif // OS_ANDROID | 557 #endif // OS_ANDROID |
OLD | NEW |