| 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 } | 384 } |
| 385 | 385 |
| 386 TEST_P(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayerOutsideViewport) { | 386 TEST_P(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayerOutsideViewport) { |
| 387 scoped_refptr<SolidColorLayer> background = | 387 scoped_refptr<SolidColorLayer> background = |
| 388 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorWHITE); | 388 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorWHITE); |
| 389 | 389 |
| 390 scoped_refptr<SolidColorLayer> green = | 390 scoped_refptr<SolidColorLayer> green = |
| 391 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN); | 391 CreateSolidColorLayer(gfx::Rect(200, 200), SK_ColorGREEN); |
| 392 // Only the top left quarter of the layer is inside the viewport, so the | 392 // Only the top left quarter of the layer is inside the viewport, so the |
| 393 // blue layer is entirely outside. | 393 // blue layer is entirely outside. |
| 394 green->SetPosition(gfx::Point(100, 100)); | 394 green->SetPosition(gfx::PointF(100.f, 100.f)); |
| 395 background->AddChild(green); | 395 background->AddChild(green); |
| 396 | 396 |
| 397 scoped_refptr<SolidColorLayer> blue = | 397 scoped_refptr<SolidColorLayer> blue = |
| 398 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE); | 398 CreateSolidColorLayer(gfx::Rect(150, 150, 50, 50), SK_ColorBLUE); |
| 399 green->AddChild(blue); | 399 green->AddChild(blue); |
| 400 | 400 |
| 401 RunReadbackTestWithReadbackTarget( | 401 RunReadbackTestWithReadbackTarget( |
| 402 GetParam().pixel_test_type, GetParam().readback_type, background, | 402 GetParam().pixel_test_type, GetParam().readback_type, background, |
| 403 green.get(), | 403 green.get(), |
| 404 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png"))); | 404 base::FilePath(FILE_PATH_LITERAL("green_with_blue_corner.png"))); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 background->SetIsDrawable(true); | 490 background->SetIsDrawable(true); |
| 491 | 491 |
| 492 scoped_refptr<FakePictureLayer> green = | 492 scoped_refptr<FakePictureLayer> green = |
| 493 FakePictureLayer::Create(layer_settings(), &green_client_); | 493 FakePictureLayer::Create(layer_settings(), &green_client_); |
| 494 green->SetBounds(gfx::Size(100, 100)); | 494 green->SetBounds(gfx::Size(100, 100)); |
| 495 green->SetIsDrawable(true); | 495 green->SetIsDrawable(true); |
| 496 background->AddChild(green); | 496 background->AddChild(green); |
| 497 | 497 |
| 498 scoped_refptr<FakePictureLayer> blue = | 498 scoped_refptr<FakePictureLayer> blue = |
| 499 FakePictureLayer::Create(layer_settings(), &blue_client_); | 499 FakePictureLayer::Create(layer_settings(), &blue_client_); |
| 500 blue->SetPosition(gfx::Point(50, 50)); | 500 blue->SetPosition(gfx::PointF(50.f, 50.f)); |
| 501 blue->SetBounds(gfx::Size(25, 25)); | 501 blue->SetBounds(gfx::Size(25, 25)); |
| 502 blue->SetIsDrawable(true); | 502 blue->SetIsDrawable(true); |
| 503 green->AddChild(blue); | 503 green->AddChild(blue); |
| 504 | 504 |
| 505 // Grab the middle of the root layer. | 505 // Grab the middle of the root layer. |
| 506 copy_subrect_ = gfx::Rect(25, 25, 50, 50); | 506 copy_subrect_ = gfx::Rect(25, 25, 50, 50); |
| 507 device_scale_factor_ = 2.f; | 507 device_scale_factor_ = 2.f; |
| 508 RunReadbackTest( | 508 RunReadbackTest( |
| 509 GetParam().pixel_test_type, GetParam().readback_type, background, | 509 GetParam().pixel_test_type, GetParam().readback_type, background, |
| 510 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png"))); | 510 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png"))); |
| 511 } | 511 } |
| 512 | 512 |
| 513 TEST_P(LayerTreeHostReadbackDeviceScalePixelTest, ReadbackNonRootLayerSubrect) { | 513 TEST_P(LayerTreeHostReadbackDeviceScalePixelTest, ReadbackNonRootLayerSubrect) { |
| 514 scoped_refptr<FakePictureLayer> background = | 514 scoped_refptr<FakePictureLayer> background = |
| 515 FakePictureLayer::Create(layer_settings(), &white_client_); | 515 FakePictureLayer::Create(layer_settings(), &white_client_); |
| 516 background->SetBounds(gfx::Size(100, 100)); | 516 background->SetBounds(gfx::Size(100, 100)); |
| 517 background->SetIsDrawable(true); | 517 background->SetIsDrawable(true); |
| 518 | 518 |
| 519 scoped_refptr<FakePictureLayer> green = | 519 scoped_refptr<FakePictureLayer> green = |
| 520 FakePictureLayer::Create(layer_settings(), &green_client_); | 520 FakePictureLayer::Create(layer_settings(), &green_client_); |
| 521 green->SetPosition(gfx::Point(10, 20)); | 521 green->SetPosition(gfx::PointF(10.f, 20.f)); |
| 522 green->SetBounds(gfx::Size(90, 80)); | 522 green->SetBounds(gfx::Size(90, 80)); |
| 523 green->SetIsDrawable(true); | 523 green->SetIsDrawable(true); |
| 524 background->AddChild(green); | 524 background->AddChild(green); |
| 525 | 525 |
| 526 scoped_refptr<FakePictureLayer> blue = | 526 scoped_refptr<FakePictureLayer> blue = |
| 527 FakePictureLayer::Create(layer_settings(), &blue_client_); | 527 FakePictureLayer::Create(layer_settings(), &blue_client_); |
| 528 blue->SetPosition(gfx::Point(50, 50)); | 528 blue->SetPosition(gfx::PointF(50.f, 50.f)); |
| 529 blue->SetBounds(gfx::Size(25, 25)); | 529 blue->SetBounds(gfx::Size(25, 25)); |
| 530 blue->SetIsDrawable(true); | 530 blue->SetIsDrawable(true); |
| 531 green->AddChild(blue); | 531 green->AddChild(blue); |
| 532 | 532 |
| 533 // Grab the green layer's content with blue in the bottom right. | 533 // Grab the green layer's content with blue in the bottom right. |
| 534 copy_subrect_ = gfx::Rect(25, 25, 50, 50); | 534 copy_subrect_ = gfx::Rect(25, 25, 50, 50); |
| 535 device_scale_factor_ = 2.f; | 535 device_scale_factor_ = 2.f; |
| 536 RunReadbackTestWithReadbackTarget( | 536 RunReadbackTestWithReadbackTarget( |
| 537 GetParam().pixel_test_type, GetParam().readback_type, background, | 537 GetParam().pixel_test_type, GetParam().readback_type, background, |
| 538 green.get(), | 538 green.get(), |
| 539 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png"))); | 539 base::FilePath(FILE_PATH_LITERAL("green_small_with_blue_corner.png"))); |
| 540 } | 540 } |
| 541 | 541 |
| 542 INSTANTIATE_TEST_CASE_P( | 542 INSTANTIATE_TEST_CASE_P( |
| 543 LayerTreeHostReadbackDeviceScalePixelTests, | 543 LayerTreeHostReadbackDeviceScalePixelTests, |
| 544 LayerTreeHostReadbackDeviceScalePixelTest, | 544 LayerTreeHostReadbackDeviceScalePixelTest, |
| 545 ::testing::Values( | 545 ::testing::Values( |
| 546 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_SOFTWARE, | 546 ReadbackTestConfig(LayerTreeHostReadbackPixelTest::PIXEL_TEST_SOFTWARE, |
| 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 |