| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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; | 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()->root_layer(); | 92 readback_target_ ? readback_target_ : layer_tree_host()->root_layer(); |
| 93 target->RequestCopyOfOutput(CreateCopyOutputRequest()); | 93 target->RequestCopyOfOutput(CreateCopyOutputRequest()); |
| 94 } | 94 } |
| 95 PostSetNeedsCommitToMainThread(); | 95 PostSetNeedsCommitToMainThread(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void DidCommitAndDrawFrame() override { | 98 void DidCommitAndDrawFrame() override { |
| 99 if (insert_copy_request_after_frame_count_ == | 99 if (insert_copy_request_after_frame_count_ == |
| 100 layer_tree_host()->SourceFrameNumber()) { | 100 layer_tree_host()->SourceFrameNumber()) { |
| 101 Layer* const target = | 101 Layer* const target = |
| 102 readback_target_ ? readback_target_ : layer_tree()->root_layer(); | 102 readback_target_ ? readback_target_ : layer_tree_host()->root_layer(); |
| 103 target->RequestCopyOfOutput(CreateCopyOutputRequest()); | 103 target->RequestCopyOfOutput(CreateCopyOutputRequest()); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 void ReadbackResultAsBitmap(std::unique_ptr<CopyOutputResult> result) { | 107 void ReadbackResultAsBitmap(std::unique_ptr<CopyOutputResult> result) { |
| 108 EXPECT_TRUE(task_runner_provider()->IsMainThread()); | 108 EXPECT_TRUE(task_runner_provider()->IsMainThread()); |
| 109 EXPECT_TRUE(result->HasBitmap()); | 109 EXPECT_TRUE(result->HasBitmap()); |
| 110 result_bitmap_ = result->TakeBitmap(); | 110 result_bitmap_ = result->TakeBitmap(); |
| 111 EndTest(); | 111 EndTest(); |
| 112 } | 112 } |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 white_client_(SK_ColorWHITE, gfx::Size(200, 200)), | 461 white_client_(SK_ColorWHITE, gfx::Size(200, 200)), |
| 462 green_client_(SK_ColorGREEN, gfx::Size(200, 200)), | 462 green_client_(SK_ColorGREEN, gfx::Size(200, 200)), |
| 463 blue_client_(SK_ColorBLUE, gfx::Size(200, 200)) {} | 463 blue_client_(SK_ColorBLUE, gfx::Size(200, 200)) {} |
| 464 | 464 |
| 465 void InitializeSettings(LayerTreeSettings* settings) override { | 465 void InitializeSettings(LayerTreeSettings* settings) override { |
| 466 // Cause the device scale factor to be inherited by contents scales. | 466 // Cause the device scale factor to be inherited by contents scales. |
| 467 settings->layer_transforms_should_scale_layer_contents = true; | 467 settings->layer_transforms_should_scale_layer_contents = true; |
| 468 } | 468 } |
| 469 | 469 |
| 470 void SetupTree() override { | 470 void SetupTree() override { |
| 471 layer_tree()->SetDeviceScaleFactor(device_scale_factor_); | 471 layer_tree_host()->SetDeviceScaleFactor(device_scale_factor_); |
| 472 LayerTreePixelTest::SetupTree(); | 472 LayerTreePixelTest::SetupTree(); |
| 473 } | 473 } |
| 474 | 474 |
| 475 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 475 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
| 476 EXPECT_EQ(device_scale_factor_, | 476 EXPECT_EQ(device_scale_factor_, |
| 477 host_impl->active_tree()->device_scale_factor()); | 477 host_impl->active_tree()->device_scale_factor()); |
| 478 } | 478 } |
| 479 | 479 |
| 480 float device_scale_factor_; | 480 float device_scale_factor_; |
| 481 SolidColorContentLayerClient white_client_; | 481 SolidColorContentLayerClient white_client_; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 READBACK_DEFAULT), | 547 READBACK_DEFAULT), |
| 548 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL, | 548 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL, |
| 549 READBACK_DEFAULT), | 549 READBACK_DEFAULT), |
| 550 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL, | 550 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL, |
| 551 READBACK_BITMAP))); | 551 READBACK_BITMAP))); |
| 552 | 552 |
| 553 } // namespace | 553 } // namespace |
| 554 } // namespace cc | 554 } // namespace cc |
| 555 | 555 |
| 556 #endif // OS_ANDROID | 556 #endif // OS_ANDROID |
| OLD | NEW |