Chromium Code Reviews| 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/pixel_test.h" | 5 #include "cc/test/pixel_test.h" |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "cc/output/compositor_frame_metadata.h" | 9 #include "cc/output/compositor_frame_metadata.h" |
| 10 #include "cc/output/gl_renderer.h" | 10 #include "cc/output/gl_renderer.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 return false; | 106 return false; |
| 107 | 107 |
| 108 // To rebaseline: | 108 // To rebaseline: |
| 109 // return WritePNGFile(*result_bitmap_, test_data_dir.Append(ref_file), true); | 109 // return WritePNGFile(*result_bitmap_, test_data_dir.Append(ref_file), true); |
| 110 | 110 |
| 111 return MatchesPNGFile(*result_bitmap_, | 111 return MatchesPNGFile(*result_bitmap_, |
| 112 test_data_dir.Append(ref_file), | 112 test_data_dir.Append(ref_file), |
| 113 comparator); | 113 comparator); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void PixelTest::SetUpGLRenderer() { | 116 void PixelTest::SetUpGLRenderer(bool use_ganesh) { |
|
danakj
2013/05/17 23:36:31
nit: ganesh
enne (OOO)
2013/05/17 23:52:50
Done. Nice catch.
| |
| 117 CHECK(fake_client_); | 117 CHECK(fake_client_); |
| 118 CHECK(gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL)); | 118 CHECK(gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL)); |
| 119 | 119 |
| 120 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; | 120 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; |
| 121 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d( | 121 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d( |
| 122 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( | 122 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( |
| 123 WebKit::WebGraphicsContext3D::Attributes())); | 123 WebKit::WebGraphicsContext3D::Attributes())); |
| 124 output_surface_.reset(new OutputSurface( | 124 output_surface_.reset(new OutputSurface( |
| 125 context3d.PassAs<WebKit::WebGraphicsContext3D>())); | 125 context3d.PassAs<WebKit::WebGraphicsContext3D>())); |
| 126 resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0); | 126 resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0); |
| 127 renderer_ = GLRenderer::Create(fake_client_.get(), | 127 renderer_ = GLRenderer::Create(fake_client_.get(), |
| 128 output_surface_.get(), | 128 output_surface_.get(), |
| 129 resource_provider_.get(), | 129 resource_provider_.get(), |
| 130 0).PassAs<DirectRenderer>(); | 130 0, |
| 131 use_ganesh).PassAs<DirectRenderer>(); | |
| 131 | 132 |
| 132 scoped_refptr<webkit::gpu::ContextProviderInProcess> offscreen_contexts = | 133 scoped_refptr<webkit::gpu::ContextProviderInProcess> offscreen_contexts = |
| 133 webkit::gpu::ContextProviderInProcess::Create(); | 134 webkit::gpu::ContextProviderInProcess::Create(); |
| 134 ASSERT_TRUE(offscreen_contexts->BindToCurrentThread()); | 135 ASSERT_TRUE(offscreen_contexts->BindToCurrentThread()); |
| 135 resource_provider_->set_offscreen_context_provider(offscreen_contexts); | 136 resource_provider_->set_offscreen_context_provider(offscreen_contexts); |
| 136 } | 137 } |
| 137 | 138 |
| 138 void PixelTest::SetUpSoftwareRenderer() { | 139 void PixelTest::SetUpSoftwareRenderer() { |
| 139 CHECK(fake_client_); | 140 CHECK(fake_client_); |
| 140 | 141 |
| 141 scoped_ptr<SoftwareOutputDevice> device(new SoftwareOutputDevice()); | 142 scoped_ptr<SoftwareOutputDevice> device(new SoftwareOutputDevice()); |
| 142 output_surface_.reset(new OutputSurface(device.Pass())); | 143 output_surface_.reset(new OutputSurface(device.Pass())); |
| 143 resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0); | 144 resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0); |
| 144 renderer_ = SoftwareRenderer::Create( | 145 renderer_ = SoftwareRenderer::Create( |
| 145 fake_client_.get(), | 146 fake_client_.get(), |
| 146 output_surface_.get(), | 147 output_surface_.get(), |
| 147 resource_provider_.get()).PassAs<DirectRenderer>(); | 148 resource_provider_.get()).PassAs<DirectRenderer>(); |
| 148 } | 149 } |
| 149 | 150 |
| 150 } // namespace cc | 151 } // namespace cc |
| OLD | NEW |