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 "cc/test/layer_tree_pixel_test.h" | 5 #include "cc/test/layer_tree_pixel_test.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "cc/base/switches.h" | 9 #include "cc/base/switches.h" |
10 #include "cc/layers/solid_color_layer.h" | 10 #include "cc/layers/solid_color_layer.h" |
11 #include "cc/layers/texture_layer.h" | 11 #include "cc/layers/texture_layer.h" |
12 #include "cc/output/copy_output_request.h" | 12 #include "cc/output/copy_output_request.h" |
13 #include "cc/output/copy_output_result.h" | 13 #include "cc/output/copy_output_result.h" |
| 14 #include "cc/output/direct_renderer.h" |
14 #include "cc/resources/texture_mailbox.h" | 15 #include "cc/resources/texture_mailbox.h" |
15 #include "cc/test/paths.h" | 16 #include "cc/test/paths.h" |
16 #include "cc/test/pixel_comparator.h" | 17 #include "cc/test/pixel_comparator.h" |
17 #include "cc/test/pixel_test_output_surface.h" | 18 #include "cc/test/pixel_test_output_surface.h" |
18 #include "cc/test/pixel_test_software_output_device.h" | 19 #include "cc/test/pixel_test_software_output_device.h" |
19 #include "cc/test/pixel_test_utils.h" | 20 #include "cc/test/pixel_test_utils.h" |
20 #include "cc/test/test_in_process_context_provider.h" | 21 #include "cc/test/test_in_process_context_provider.h" |
21 #include "cc/trees/layer_tree_impl.h" | 22 #include "cc/trees/layer_tree_impl.h" |
22 #include "gpu/command_buffer/client/gl_in_process_context.h" | 23 #include "gpu/command_buffer/client/gl_in_process_context.h" |
23 #include "gpu/command_buffer/client/gles2_implementation.h" | 24 #include "gpu/command_buffer/client/gles2_implementation.h" |
(...skipping 21 matching lines...) Expand all Loading... |
45 new PixelTestSoftwareOutputDevice); | 46 new PixelTestSoftwareOutputDevice); |
46 software_output_device->set_surface_expansion_size( | 47 software_output_device->set_surface_expansion_size( |
47 surface_expansion_size); | 48 surface_expansion_size); |
48 output_surface = make_scoped_ptr( | 49 output_surface = make_scoped_ptr( |
49 new PixelTestOutputSurface(software_output_device.Pass())); | 50 new PixelTestOutputSurface(software_output_device.Pass())); |
50 break; | 51 break; |
51 } | 52 } |
52 case PIXEL_TEST_GL: { | 53 case PIXEL_TEST_GL: { |
53 bool flipped_output_surface = false; | 54 bool flipped_output_surface = false; |
54 output_surface = make_scoped_ptr(new PixelTestOutputSurface( | 55 output_surface = make_scoped_ptr(new PixelTestOutputSurface( |
55 new TestInProcessContextProvider, flipped_output_surface)); | 56 new TestInProcessContextProvider, new TestInProcessContextProvider, |
| 57 flipped_output_surface)); |
56 break; | 58 break; |
57 } | 59 } |
58 } | 60 } |
59 | 61 |
60 output_surface->set_surface_expansion_size(surface_expansion_size); | 62 output_surface->set_surface_expansion_size(surface_expansion_size); |
61 return output_surface.Pass(); | 63 return output_surface.Pass(); |
62 } | 64 } |
63 | 65 |
64 void LayerTreePixelTest::CommitCompleteOnThread(LayerTreeHostImpl* impl) { | 66 void LayerTreePixelTest::CommitCompleteOnThread(LayerTreeHostImpl* impl) { |
65 LayerTreeImpl* commit_tree = | 67 LayerTreeImpl* commit_tree = |
66 impl->pending_tree() ? impl->pending_tree() : impl->active_tree(); | 68 impl->pending_tree() ? impl->pending_tree() : impl->active_tree(); |
67 if (commit_tree->source_frame_number() != 0) | 69 if (commit_tree->source_frame_number() != 0) |
68 return; | 70 return; |
69 | 71 |
| 72 DirectRenderer* renderer = static_cast<DirectRenderer*>(impl->renderer()); |
| 73 renderer->SetEnlargePassTextureAmountForTesting(enlarge_texture_amount_); |
| 74 |
70 gfx::Rect viewport = impl->DeviceViewport(); | 75 gfx::Rect viewport = impl->DeviceViewport(); |
71 // The viewport has a 0,0 origin without external influence. | 76 // The viewport has a 0,0 origin without external influence. |
72 EXPECT_EQ(gfx::Point().ToString(), viewport.origin().ToString()); | 77 EXPECT_EQ(gfx::Point().ToString(), viewport.origin().ToString()); |
73 // Be that influence! | 78 // Be that influence! |
74 viewport += gfx::Vector2d(20, 10); | 79 viewport += gfx::Vector2d(20, 10); |
75 bool resourceless_software_draw = false; | 80 bool resourceless_software_draw = false; |
76 gfx::Transform identity = gfx::Transform(); | 81 gfx::Transform identity = gfx::Transform(); |
77 impl->SetExternalDrawConstraints(identity, | 82 impl->SetExternalDrawConstraints(identity, |
78 viewport, | 83 viewport, |
79 viewport, | 84 viewport, |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 376 |
372 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); | 377 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); |
373 *release_callback = SingleReleaseCallback::Create( | 378 *release_callback = SingleReleaseCallback::Create( |
374 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, | 379 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, |
375 base::Unretained(this), | 380 base::Unretained(this), |
376 base::Passed(&context), | 381 base::Passed(&context), |
377 texture_id)); | 382 texture_id)); |
378 } | 383 } |
379 | 384 |
380 } // namespace cc | 385 } // namespace cc |
OLD | NEW |