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