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/content_layer.h" | 6 #include "cc/layers/content_layer.h" |
7 #include "cc/layers/solid_color_layer.h" | 7 #include "cc/layers/solid_color_layer.h" |
8 #include "cc/layers/texture_layer.h" | 8 #include "cc/layers/texture_layer.h" |
9 #include "cc/output/copy_output_request.h" | 9 #include "cc/output/copy_output_request.h" |
10 #include "cc/output/copy_output_result.h" | 10 #include "cc/output/copy_output_result.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 EXPECT_TRUE(texture_mailbox->IsValid()); | 62 EXPECT_TRUE(texture_mailbox->IsValid()); |
63 EXPECT_TRUE(texture_mailbox->IsTexture()); | 63 EXPECT_TRUE(texture_mailbox->IsTexture()); |
64 | 64 |
65 scoped_ptr<SkBitmap> bitmap = | 65 scoped_ptr<SkBitmap> bitmap = |
66 CopyTextureMailboxToBitmap(result->size(), *texture_mailbox); | 66 CopyTextureMailboxToBitmap(result->size(), *texture_mailbox); |
67 texture_mailbox->RunReleaseCallback(0, false); | 67 texture_mailbox->RunReleaseCallback(0, false); |
68 | 68 |
69 ReadbackResultAsBitmap(CopyOutputResult::CreateBitmapResult(bitmap.Pass())); | 69 ReadbackResultAsBitmap(CopyOutputResult::CreateBitmapResult(bitmap.Pass())); |
70 } | 70 } |
71 | 71 |
| 72 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
| 73 settings->max_bytes_pending_upload = 16 * 1024 * 1024; |
| 74 } |
| 75 |
72 gfx::Rect copy_subrect_; | 76 gfx::Rect copy_subrect_; |
73 }; | 77 }; |
74 | 78 |
75 TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayer_Software) { | 79 TEST_F(LayerTreeHostReadbackPixelTest, ReadbackRootLayer_Software) { |
76 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( | 80 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
77 gfx::Rect(200, 200), SK_ColorWHITE); | 81 gfx::Rect(200, 200), SK_ColorWHITE); |
78 | 82 |
79 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayer( | 83 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayer( |
80 gfx::Rect(200, 200), SK_ColorGREEN); | 84 gfx::Rect(200, 200), SK_ColorGREEN); |
81 background->AddChild(green); | 85 background->AddChild(green); |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 protected: | 471 protected: |
468 LayerTreeHostReadbackDeviceScalePixelTest() | 472 LayerTreeHostReadbackDeviceScalePixelTest() |
469 : device_scale_factor_(1.f), | 473 : device_scale_factor_(1.f), |
470 white_client_(SK_ColorWHITE), | 474 white_client_(SK_ColorWHITE), |
471 green_client_(SK_ColorGREEN), | 475 green_client_(SK_ColorGREEN), |
472 blue_client_(SK_ColorBLUE) {} | 476 blue_client_(SK_ColorBLUE) {} |
473 | 477 |
474 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 478 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
475 // Cause the device scale factor to be inherited by contents scales. | 479 // Cause the device scale factor to be inherited by contents scales. |
476 settings->layer_transforms_should_scale_layer_contents = true; | 480 settings->layer_transforms_should_scale_layer_contents = true; |
| 481 settings->max_bytes_pending_upload = 16 * 1024 * 1024; |
477 } | 482 } |
478 | 483 |
479 virtual void SetupTree() OVERRIDE { | 484 virtual void SetupTree() OVERRIDE { |
480 layer_tree_host()->SetDeviceScaleFactor(device_scale_factor_); | 485 layer_tree_host()->SetDeviceScaleFactor(device_scale_factor_); |
481 LayerTreePixelTest::SetupTree(); | 486 LayerTreePixelTest::SetupTree(); |
482 } | 487 } |
483 | 488 |
484 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 489 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
485 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); | 490 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); |
486 | 491 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 protected: | 637 protected: |
633 LayerTreeHostReadbackViaCompositeAndReadbackPixelTest() | 638 LayerTreeHostReadbackViaCompositeAndReadbackPixelTest() |
634 : device_scale_factor_(1.f), | 639 : device_scale_factor_(1.f), |
635 white_client_(SK_ColorWHITE), | 640 white_client_(SK_ColorWHITE), |
636 green_client_(SK_ColorGREEN), | 641 green_client_(SK_ColorGREEN), |
637 blue_client_(SK_ColorBLUE) {} | 642 blue_client_(SK_ColorBLUE) {} |
638 | 643 |
639 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 644 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
640 // Cause the device scale factor to be inherited by contents scales. | 645 // Cause the device scale factor to be inherited by contents scales. |
641 settings->layer_transforms_should_scale_layer_contents = true; | 646 settings->layer_transforms_should_scale_layer_contents = true; |
| 647 settings->max_bytes_pending_upload = 16 * 1024 * 1024; |
642 } | 648 } |
643 | 649 |
644 virtual void SetupTree() OVERRIDE { | 650 virtual void SetupTree() OVERRIDE { |
645 layer_tree_host()->SetDeviceScaleFactor(device_scale_factor_); | 651 layer_tree_host()->SetDeviceScaleFactor(device_scale_factor_); |
646 LayerTreePixelTest::SetupTree(); | 652 LayerTreePixelTest::SetupTree(); |
647 } | 653 } |
648 | 654 |
649 virtual void BeginTest() OVERRIDE { | 655 virtual void BeginTest() OVERRIDE { |
650 EXPECT_EQ(device_scale_factor_, layer_tree_host()->device_scale_factor()); | 656 EXPECT_EQ(device_scale_factor_, layer_tree_host()->device_scale_factor()); |
651 if (TestEnded()) | 657 if (TestEnded()) |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 background, | 883 background, |
878 texture.get(), | 884 texture.get(), |
879 base::FilePath(FILE_PATH_LITERAL( | 885 base::FilePath(FILE_PATH_LITERAL( |
880 "green_with_blue_corner.png"))); | 886 "green_with_blue_corner.png"))); |
881 } | 887 } |
882 | 888 |
883 } // namespace | 889 } // namespace |
884 } // namespace cc | 890 } // namespace cc |
885 | 891 |
886 #endif // OS_ANDROID | 892 #endif // OS_ANDROID |
OLD | NEW |