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" |
(...skipping 29 matching lines...) Expand all Loading... |
40 scoped_ptr<PixelTestOutputSurface> output_surface; | 40 scoped_ptr<PixelTestOutputSurface> output_surface; |
41 | 41 |
42 switch (test_type_) { | 42 switch (test_type_) { |
43 case SOFTWARE_WITH_DEFAULT: | 43 case SOFTWARE_WITH_DEFAULT: |
44 case SOFTWARE_WITH_BITMAP: { | 44 case SOFTWARE_WITH_BITMAP: { |
45 scoped_ptr<PixelTestSoftwareOutputDevice> software_output_device( | 45 scoped_ptr<PixelTestSoftwareOutputDevice> software_output_device( |
46 new PixelTestSoftwareOutputDevice); | 46 new PixelTestSoftwareOutputDevice); |
47 software_output_device->set_surface_expansion_size( | 47 software_output_device->set_surface_expansion_size( |
48 surface_expansion_size); | 48 surface_expansion_size); |
49 output_surface = make_scoped_ptr( | 49 output_surface = make_scoped_ptr( |
50 new PixelTestOutputSurface( | 50 new PixelTestOutputSurface(software_output_device.Pass())); |
51 software_output_device.PassAs<SoftwareOutputDevice>())); | |
52 break; | 51 break; |
53 } | 52 } |
54 | 53 |
55 case GL_WITH_DEFAULT: | 54 case GL_WITH_DEFAULT: |
56 case GL_WITH_BITMAP: { | 55 case GL_WITH_BITMAP: { |
57 output_surface = make_scoped_ptr( | 56 output_surface = make_scoped_ptr( |
58 new PixelTestOutputSurface(new TestInProcessContextProvider)); | 57 new PixelTestOutputSurface(new TestInProcessContextProvider)); |
59 break; | 58 break; |
60 } | 59 } |
61 } | 60 } |
62 | 61 |
63 output_surface->set_surface_expansion_size(surface_expansion_size); | 62 output_surface->set_surface_expansion_size(surface_expansion_size); |
64 return output_surface.PassAs<OutputSurface>(); | 63 return output_surface.Pass(); |
65 } | 64 } |
66 | 65 |
67 void LayerTreePixelTest::CommitCompleteOnThread(LayerTreeHostImpl* impl) { | 66 void LayerTreePixelTest::CommitCompleteOnThread(LayerTreeHostImpl* impl) { |
68 LayerTreeImpl* commit_tree = | 67 LayerTreeImpl* commit_tree = |
69 impl->pending_tree() ? impl->pending_tree() : impl->active_tree(); | 68 impl->pending_tree() ? impl->pending_tree() : impl->active_tree(); |
70 if (commit_tree->source_frame_number() != 0) | 69 if (commit_tree->source_frame_number() != 0) |
71 return; | 70 return; |
72 | 71 |
73 gfx::Rect viewport = impl->DeviceViewport(); | 72 gfx::Rect viewport = impl->DeviceViewport(); |
74 // The viewport has a 0,0 origin without external influence. | 73 // The viewport has a 0,0 origin without external influence. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 root->AddChild(content_root_); | 221 root->AddChild(content_root_); |
223 layer_tree_host()->SetRootLayer(root); | 222 layer_tree_host()->SetRootLayer(root); |
224 LayerTreeTest::SetupTree(); | 223 LayerTreeTest::SetupTree(); |
225 } | 224 } |
226 | 225 |
227 scoped_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap( | 226 scoped_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap( |
228 const gfx::Size& size, | 227 const gfx::Size& size, |
229 const TextureMailbox& texture_mailbox) { | 228 const TextureMailbox& texture_mailbox) { |
230 DCHECK(texture_mailbox.IsTexture()); | 229 DCHECK(texture_mailbox.IsTexture()); |
231 if (!texture_mailbox.IsTexture()) | 230 if (!texture_mailbox.IsTexture()) |
232 return scoped_ptr<SkBitmap>(); | 231 return nullptr; |
233 | 232 |
234 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); | 233 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); |
235 GLES2Interface* gl = context->GetImplementation(); | 234 GLES2Interface* gl = context->GetImplementation(); |
236 | 235 |
237 if (texture_mailbox.sync_point()) | 236 if (texture_mailbox.sync_point()) |
238 gl->WaitSyncPointCHROMIUM(texture_mailbox.sync_point()); | 237 gl->WaitSyncPointCHROMIUM(texture_mailbox.sync_point()); |
239 | 238 |
240 GLuint texture_id = 0; | 239 GLuint texture_id = 0; |
241 gl->GenTextures(1, &texture_id); | 240 gl->GenTextures(1, &texture_id); |
242 gl->BindTexture(GL_TEXTURE_2D, texture_id); | 241 gl->BindTexture(GL_TEXTURE_2D, texture_id); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 361 |
363 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); | 362 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); |
364 *release_callback = SingleReleaseCallback::Create( | 363 *release_callback = SingleReleaseCallback::Create( |
365 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, | 364 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, |
366 base::Unretained(this), | 365 base::Unretained(this), |
367 base::Passed(&context), | 366 base::Passed(&context), |
368 texture_id)); | 367 texture_id)); |
369 } | 368 } |
370 | 369 |
371 } // namespace cc | 370 } // namespace cc |
OLD | NEW |