Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: cc/trees/layer_tree_host_pixeltest_readback.cc

Issue 1122393003: CC: Plumb LayerSettings parameter for cc::Layer construction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 478 }
479 479
480 float device_scale_factor_; 480 float device_scale_factor_;
481 SolidColorContentLayerClient white_client_; 481 SolidColorContentLayerClient white_client_;
482 SolidColorContentLayerClient green_client_; 482 SolidColorContentLayerClient green_client_;
483 SolidColorContentLayerClient blue_client_; 483 SolidColorContentLayerClient blue_client_;
484 }; 484 };
485 485
486 TEST_P(LayerTreeHostReadbackDeviceScalePixelTest, ReadbackSubrect) { 486 TEST_P(LayerTreeHostReadbackDeviceScalePixelTest, ReadbackSubrect) {
487 scoped_refptr<FakePictureLayer> background = 487 scoped_refptr<FakePictureLayer> background =
488 FakePictureLayer::Create(&white_client_); 488 FakePictureLayer::Create(layer_settings(), &white_client_);
489 background->SetBounds(gfx::Size(100, 100)); 489 background->SetBounds(gfx::Size(100, 100));
490 background->SetIsDrawable(true); 490 background->SetIsDrawable(true);
491 491
492 scoped_refptr<FakePictureLayer> green = 492 scoped_refptr<FakePictureLayer> green =
493 FakePictureLayer::Create(&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(&blue_client_); 499 FakePictureLayer::Create(layer_settings(), &blue_client_);
500 blue->SetPosition(gfx::Point(50, 50)); 500 blue->SetPosition(gfx::Point(50, 50));
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(&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(&green_client_); 520 FakePictureLayer::Create(layer_settings(), &green_client_);
521 green->SetPosition(gfx::Point(10, 20)); 521 green->SetPosition(gfx::Point(10, 20));
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(&blue_client_); 527 FakePictureLayer::Create(layer_settings(), &blue_client_);
528 blue->SetPosition(gfx::Point(50, 50)); 528 blue->SetPosition(gfx::Point(50, 50));
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
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_pixeltest_masks.cc ('k') | cc/trees/layer_tree_host_pixeltest_synchronous.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698