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/resources/texture_mailbox.h" | 14 #include "cc/resources/texture_mailbox.h" |
15 #include "cc/test/paths.h" | 15 #include "cc/test/paths.h" |
16 #include "cc/test/pixel_comparator.h" | 16 #include "cc/test/pixel_comparator.h" |
17 #include "cc/test/pixel_test_output_surface.h" | 17 #include "cc/test/pixel_test_output_surface.h" |
18 #include "cc/test/pixel_test_software_output_device.h" | 18 #include "cc/test/pixel_test_software_output_device.h" |
19 #include "cc/test/pixel_test_utils.h" | 19 #include "cc/test/pixel_test_utils.h" |
20 #include "cc/test/test_in_process_context_provider.h" | 20 #include "cc/test/test_in_process_context_provider.h" |
21 #include "cc/trees/layer_tree_impl.h" | 21 #include "cc/trees/layer_tree_impl.h" |
22 #include "gpu/command_buffer/client/gl_in_process_context.h" | 22 #include "gpu/command_buffer/client/gl_in_process_context.h" |
23 #include "gpu/command_buffer/client/gles2_implementation.h" | 23 #include "gpu/command_buffer/client/gles2_implementation.h" |
24 #include "ui/gl/gl_implementation.h" | |
25 | 24 |
26 using gpu::gles2::GLES2Interface; | 25 using gpu::gles2::GLES2Interface; |
27 | 26 |
28 namespace cc { | 27 namespace cc { |
29 | 28 |
30 LayerTreePixelTest::LayerTreePixelTest() | 29 LayerTreePixelTest::LayerTreePixelTest() |
31 : pixel_comparator_(new ExactPixelComparator(true)), | 30 : pixel_comparator_(new ExactPixelComparator(true)), |
32 test_type_(GL_WITH_DEFAULT), | 31 test_type_(GL_WITH_DEFAULT), |
33 pending_texture_mailbox_callbacks_(0), | 32 pending_texture_mailbox_callbacks_(0), |
34 impl_side_painting_(true) {} | 33 impl_side_painting_(true) {} |
(...skipping 13 matching lines...) Expand all Loading... |
48 software_output_device->set_surface_expansion_size( | 47 software_output_device->set_surface_expansion_size( |
49 surface_expansion_size); | 48 surface_expansion_size); |
50 output_surface = make_scoped_ptr( | 49 output_surface = make_scoped_ptr( |
51 new PixelTestOutputSurface( | 50 new PixelTestOutputSurface( |
52 software_output_device.PassAs<SoftwareOutputDevice>())); | 51 software_output_device.PassAs<SoftwareOutputDevice>())); |
53 break; | 52 break; |
54 } | 53 } |
55 | 54 |
56 case GL_WITH_DEFAULT: | 55 case GL_WITH_DEFAULT: |
57 case GL_WITH_BITMAP: { | 56 case GL_WITH_BITMAP: { |
58 CHECK(gfx::InitializeStaticGLBindings(gfx::kGLImplementationOSMesaGL)); | |
59 | |
60 output_surface = make_scoped_ptr( | 57 output_surface = make_scoped_ptr( |
61 new PixelTestOutputSurface(new TestInProcessContextProvider)); | 58 new PixelTestOutputSurface(new TestInProcessContextProvider)); |
62 break; | 59 break; |
63 } | 60 } |
64 } | 61 } |
65 | 62 |
66 output_surface->set_surface_expansion_size(surface_expansion_size); | 63 output_surface->set_surface_expansion_size(surface_expansion_size); |
67 return output_surface.PassAs<OutputSurface>(); | 64 return output_surface.PassAs<OutputSurface>(); |
68 } | 65 } |
69 | 66 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 TryEndTest(); | 306 TryEndTest(); |
310 } | 307 } |
311 | 308 |
312 void LayerTreePixelTest::CopyBitmapToTextureMailboxAsTexture( | 309 void LayerTreePixelTest::CopyBitmapToTextureMailboxAsTexture( |
313 const SkBitmap& bitmap, | 310 const SkBitmap& bitmap, |
314 TextureMailbox* texture_mailbox, | 311 TextureMailbox* texture_mailbox, |
315 scoped_ptr<SingleReleaseCallback>* release_callback) { | 312 scoped_ptr<SingleReleaseCallback>* release_callback) { |
316 DCHECK_GT(bitmap.width(), 0); | 313 DCHECK_GT(bitmap.width(), 0); |
317 DCHECK_GT(bitmap.height(), 0); | 314 DCHECK_GT(bitmap.height(), 0); |
318 | 315 |
319 CHECK(gfx::InitializeStaticGLBindings(gfx::kGLImplementationOSMesaGL)); | |
320 | |
321 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); | 316 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); |
322 GLES2Interface* gl = context->GetImplementation(); | 317 GLES2Interface* gl = context->GetImplementation(); |
323 | 318 |
324 GLuint texture_id = 0; | 319 GLuint texture_id = 0; |
325 gl->GenTextures(1, &texture_id); | 320 gl->GenTextures(1, &texture_id); |
326 gl->BindTexture(GL_TEXTURE_2D, texture_id); | 321 gl->BindTexture(GL_TEXTURE_2D, texture_id); |
327 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 322 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
328 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 323 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
329 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 324 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
330 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 325 gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 366 |
372 *texture_mailbox = TextureMailbox(mailbox, sync_point); | 367 *texture_mailbox = TextureMailbox(mailbox, sync_point); |
373 *release_callback = SingleReleaseCallback::Create( | 368 *release_callback = SingleReleaseCallback::Create( |
374 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, | 369 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, |
375 base::Unretained(this), | 370 base::Unretained(this), |
376 base::Passed(&context), | 371 base::Passed(&context), |
377 texture_id)); | 372 texture_id)); |
378 } | 373 } |
379 | 374 |
380 } // namespace cc | 375 } // namespace cc |
OLD | NEW |