| 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 } | 479 } |
| 480 | 480 |
| 481 float device_scale_factor_; | 481 float device_scale_factor_; |
| 482 SolidColorContentLayerClient white_client_; | 482 SolidColorContentLayerClient white_client_; |
| 483 SolidColorContentLayerClient green_client_; | 483 SolidColorContentLayerClient green_client_; |
| 484 SolidColorContentLayerClient blue_client_; | 484 SolidColorContentLayerClient blue_client_; |
| 485 }; | 485 }; |
| 486 | 486 |
| 487 TEST_P(LayerTreeHostReadbackDeviceScalePixelTest, ReadbackSubrect) { | 487 TEST_P(LayerTreeHostReadbackDeviceScalePixelTest, ReadbackSubrect) { |
| 488 scoped_refptr<FakePictureLayer> background = | 488 scoped_refptr<FakePictureLayer> background = |
| 489 FakePictureLayer::Create(layer_settings(), &white_client_); | 489 FakePictureLayer::Create(&white_client_); |
| 490 background->SetBounds(gfx::Size(100, 100)); | 490 background->SetBounds(gfx::Size(100, 100)); |
| 491 background->SetIsDrawable(true); | 491 background->SetIsDrawable(true); |
| 492 | 492 |
| 493 scoped_refptr<FakePictureLayer> green = | 493 scoped_refptr<FakePictureLayer> green = |
| 494 FakePictureLayer::Create(layer_settings(), &green_client_); | 494 FakePictureLayer::Create(&green_client_); |
| 495 green->SetBounds(gfx::Size(100, 100)); | 495 green->SetBounds(gfx::Size(100, 100)); |
| 496 green->SetIsDrawable(true); | 496 green->SetIsDrawable(true); |
| 497 background->AddChild(green); | 497 background->AddChild(green); |
| 498 | 498 |
| 499 scoped_refptr<FakePictureLayer> blue = | 499 scoped_refptr<FakePictureLayer> blue = |
| 500 FakePictureLayer::Create(layer_settings(), &blue_client_); | 500 FakePictureLayer::Create(&blue_client_); |
| 501 blue->SetPosition(gfx::PointF(50.f, 50.f)); | 501 blue->SetPosition(gfx::PointF(50.f, 50.f)); |
| 502 blue->SetBounds(gfx::Size(25, 25)); | 502 blue->SetBounds(gfx::Size(25, 25)); |
| 503 blue->SetIsDrawable(true); | 503 blue->SetIsDrawable(true); |
| 504 green->AddChild(blue); | 504 green->AddChild(blue); |
| 505 | 505 |
| 506 // Grab the middle of the root layer. | 506 // Grab the middle of the root layer. |
| 507 copy_subrect_ = gfx::Rect(25, 25, 50, 50); | 507 copy_subrect_ = gfx::Rect(25, 25, 50, 50); |
| 508 device_scale_factor_ = 2.f; | 508 device_scale_factor_ = 2.f; |
| 509 RunReadbackTest( | 509 RunReadbackTest( |
| 510 GetParam().pixel_test_type, GetParam().readback_type, background, | 510 GetParam().pixel_test_type, GetParam().readback_type, background, |
| 511 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png"))); | 511 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png"))); |
| 512 } | 512 } |
| 513 | 513 |
| 514 TEST_P(LayerTreeHostReadbackDeviceScalePixelTest, ReadbackNonRootLayerSubrect) { | 514 TEST_P(LayerTreeHostReadbackDeviceScalePixelTest, ReadbackNonRootLayerSubrect) { |
| 515 scoped_refptr<FakePictureLayer> background = | 515 scoped_refptr<FakePictureLayer> background = |
| 516 FakePictureLayer::Create(layer_settings(), &white_client_); | 516 FakePictureLayer::Create(&white_client_); |
| 517 background->SetBounds(gfx::Size(100, 100)); | 517 background->SetBounds(gfx::Size(100, 100)); |
| 518 background->SetIsDrawable(true); | 518 background->SetIsDrawable(true); |
| 519 | 519 |
| 520 scoped_refptr<FakePictureLayer> green = | 520 scoped_refptr<FakePictureLayer> green = |
| 521 FakePictureLayer::Create(layer_settings(), &green_client_); | 521 FakePictureLayer::Create(&green_client_); |
| 522 green->SetPosition(gfx::PointF(10.f, 20.f)); | 522 green->SetPosition(gfx::PointF(10.f, 20.f)); |
| 523 green->SetBounds(gfx::Size(90, 80)); | 523 green->SetBounds(gfx::Size(90, 80)); |
| 524 green->SetIsDrawable(true); | 524 green->SetIsDrawable(true); |
| 525 background->AddChild(green); | 525 background->AddChild(green); |
| 526 | 526 |
| 527 scoped_refptr<FakePictureLayer> blue = | 527 scoped_refptr<FakePictureLayer> blue = |
| 528 FakePictureLayer::Create(layer_settings(), &blue_client_); | 528 FakePictureLayer::Create(&blue_client_); |
| 529 blue->SetPosition(gfx::PointF(50.f, 50.f)); | 529 blue->SetPosition(gfx::PointF(50.f, 50.f)); |
| 530 blue->SetBounds(gfx::Size(25, 25)); | 530 blue->SetBounds(gfx::Size(25, 25)); |
| 531 blue->SetIsDrawable(true); | 531 blue->SetIsDrawable(true); |
| 532 green->AddChild(blue); | 532 green->AddChild(blue); |
| 533 | 533 |
| 534 // Grab the green layer's content with blue in the bottom right. | 534 // Grab the green layer's content with blue in the bottom right. |
| 535 copy_subrect_ = gfx::Rect(25, 25, 50, 50); | 535 copy_subrect_ = gfx::Rect(25, 25, 50, 50); |
| 536 device_scale_factor_ = 2.f; | 536 device_scale_factor_ = 2.f; |
| 537 RunReadbackTestWithReadbackTarget( | 537 RunReadbackTestWithReadbackTarget( |
| 538 GetParam().pixel_test_type, GetParam().readback_type, background, | 538 GetParam().pixel_test_type, GetParam().readback_type, background, |
| 539 green.get(), | 539 green.get(), |
| 540 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png"))); | 540 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png"))); |
| 541 } | 541 } |
| 542 | 542 |
| 543 INSTANTIATE_TEST_CASE_P( | 543 INSTANTIATE_TEST_CASE_P( |
| 544 LayerTreeHostReadbackDeviceScalePixelTests, | 544 LayerTreeHostReadbackDeviceScalePixelTests, |
| 545 LayerTreeHostReadbackDeviceScalePixelTest, | 545 LayerTreeHostReadbackDeviceScalePixelTest, |
| 546 ::testing::Values( | 546 ::testing::Values( |
| 547 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_SOFTWARE, | 547 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_SOFTWARE, |
| 548 READBACK_DEFAULT), | 548 READBACK_DEFAULT), |
| 549 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL, | 549 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL, |
| 550 READBACK_DEFAULT), | 550 READBACK_DEFAULT), |
| 551 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL, | 551 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_GL, |
| 552 READBACK_BITMAP))); | 552 READBACK_BITMAP))); |
| 553 | 553 |
| 554 } // namespace | 554 } // namespace |
| 555 } // namespace cc | 555 } // namespace cc |
| 556 | 556 |
| 557 #endif // OS_ANDROID | 557 #endif // OS_ANDROID |
| OLD | NEW |