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/path_service.h" | 7 #include "base/path_service.h" |
8 #include "cc/layers/solid_color_layer.h" | 8 #include "cc/layers/solid_color_layer.h" |
9 #include "cc/layers/texture_layer.h" | 9 #include "cc/layers/texture_layer.h" |
10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 software_output_device.PassAs<SoftwareOutputDevice>())); | 47 software_output_device.PassAs<SoftwareOutputDevice>())); |
48 break; | 48 break; |
49 } | 49 } |
50 | 50 |
51 case GL_WITH_DEFAULT: | 51 case GL_WITH_DEFAULT: |
52 case GL_WITH_BITMAP: { | 52 case GL_WITH_BITMAP: { |
53 CHECK(gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL)); | 53 CHECK(gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL)); |
54 | 54 |
55 using WebKit::WebGraphicsContext3D; | 55 using WebKit::WebGraphicsContext3D; |
56 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; | 56 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; |
57 output_surface = make_scoped_ptr(new PixelTestOutputSurface( | 57 scoped_ptr<WebGraphicsContext3D> context( |
58 WebGraphicsContext3DInProcessCommandBufferImpl:: | 58 WebGraphicsContext3DInProcessCommandBufferImpl:: |
59 CreateOffscreenContext(WebGraphicsContext3D::Attributes()))); | 59 CreateOffscreenContext(WebGraphicsContext3D::Attributes())); |
| 60 output_surface.reset(new PixelTestOutputSurface(context.Pass())); |
60 break; | 61 break; |
61 } | 62 } |
62 } | 63 } |
63 | 64 |
64 output_surface->set_viewport_offset(viewport_offset); | 65 output_surface->set_viewport_offset(viewport_offset); |
65 output_surface->set_surface_expansion_size(surface_expansion_size); | 66 output_surface->set_surface_expansion_size(surface_expansion_size); |
66 return output_surface.PassAs<OutputSurface>(); | 67 return output_surface.PassAs<OutputSurface>(); |
67 } | 68 } |
68 | 69 |
69 scoped_refptr<cc::ContextProvider> | 70 scoped_refptr<cc::ContextProvider> |
70 LayerTreePixelTest::OffscreenContextProviderForMainThread() { | 71 LayerTreePixelTest::OffscreenContextProviderForMainThread() { |
71 scoped_refptr<webkit::gpu::ContextProviderInProcess> provider = | 72 scoped_refptr<webkit::gpu::ContextProviderInProcess> provider = |
72 webkit::gpu::ContextProviderInProcess::Create(); | 73 webkit::gpu::ContextProviderInProcess::CreateOffscreen(); |
73 CHECK(provider->BindToCurrentThread()); | 74 CHECK(provider->BindToCurrentThread()); |
74 return provider; | 75 return provider; |
75 } | 76 } |
76 | 77 |
77 scoped_refptr<cc::ContextProvider> | 78 scoped_refptr<cc::ContextProvider> |
78 LayerTreePixelTest::OffscreenContextProviderForCompositorThread() { | 79 LayerTreePixelTest::OffscreenContextProviderForCompositorThread() { |
79 scoped_refptr<webkit::gpu::ContextProviderInProcess> provider = | 80 scoped_refptr<webkit::gpu::ContextProviderInProcess> provider = |
80 webkit::gpu::ContextProviderInProcess::Create(); | 81 webkit::gpu::ContextProviderInProcess::CreateOffscreen(); |
81 CHECK(provider.get()); | 82 CHECK(provider.get()); |
82 return provider; | 83 return provider; |
83 } | 84 } |
84 | 85 |
85 scoped_ptr<CopyOutputRequest> LayerTreePixelTest::CreateCopyOutputRequest() { | 86 scoped_ptr<CopyOutputRequest> LayerTreePixelTest::CreateCopyOutputRequest() { |
86 return CopyOutputRequest::CreateBitmapRequest( | 87 return CopyOutputRequest::CreateBitmapRequest( |
87 base::Bind(&LayerTreePixelTest::ReadbackResult, base::Unretained(this))); | 88 base::Bind(&LayerTreePixelTest::ReadbackResult, base::Unretained(this))); |
88 } | 89 } |
89 | 90 |
90 void LayerTreePixelTest::ReadbackResult(scoped_ptr<CopyOutputResult> result) { | 91 void LayerTreePixelTest::ReadbackResult(scoped_ptr<CopyOutputResult> result) { |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 return TextureMailbox( | 370 return TextureMailbox( |
370 mailbox, | 371 mailbox, |
371 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, | 372 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, |
372 base::Unretained(this), | 373 base::Unretained(this), |
373 base::Passed(&context3d), | 374 base::Passed(&context3d), |
374 texture_id), | 375 texture_id), |
375 sync_point); | 376 sync_point); |
376 } | 377 } |
377 | 378 |
378 } // namespace cc | 379 } // namespace cc |
OLD | NEW |