| 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/output/copy_output_request.h" | 8 #include "cc/output/copy_output_request.h" |
| 9 #include "cc/output/copy_output_result.h" | 9 #include "cc/output/copy_output_result.h" |
| 10 #include "cc/resources/texture_mailbox.h" | 10 #include "cc/resources/texture_mailbox.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 software_output_device.PassAs<SoftwareOutputDevice>())); | 43 software_output_device.PassAs<SoftwareOutputDevice>())); |
| 44 break; | 44 break; |
| 45 } | 45 } |
| 46 | 46 |
| 47 case GL_WITH_DEFAULT: | 47 case GL_WITH_DEFAULT: |
| 48 case GL_WITH_BITMAP: { | 48 case GL_WITH_BITMAP: { |
| 49 CHECK(gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL)); | 49 CHECK(gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL)); |
| 50 | 50 |
| 51 using WebKit::WebGraphicsContext3D; | 51 using WebKit::WebGraphicsContext3D; |
| 52 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; | 52 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; |
| 53 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d( | 53 output_surface = make_scoped_ptr(new PixelTestOutputSurface( |
| 54 WebGraphicsContext3DInProcessCommandBufferImpl:: | 54 WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 55 CreateOffscreenContext(WebGraphicsContext3D::Attributes())); | 55 CreateOffscreenContext(WebGraphicsContext3D::Attributes()))); |
| 56 output_surface = make_scoped_ptr( | |
| 57 new PixelTestOutputSurface(context3d.PassAs<WebGraphicsContext3D>())); | |
| 58 break; | 56 break; |
| 59 } | 57 } |
| 60 } | 58 } |
| 61 | 59 |
| 62 output_surface->set_viewport_offset(viewport_offset); | 60 output_surface->set_viewport_offset(viewport_offset); |
| 63 output_surface->set_surface_expansion_size(surface_expansion_size); | 61 output_surface->set_surface_expansion_size(surface_expansion_size); |
| 64 return output_surface.PassAs<OutputSurface>(); | 62 return output_surface.PassAs<OutputSurface>(); |
| 65 } | 63 } |
| 66 | 64 |
| 67 scoped_refptr<cc::ContextProvider> | 65 scoped_refptr<cc::ContextProvider> |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 180 } |
| 183 | 181 |
| 184 scoped_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap( | 182 scoped_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap( |
| 185 gfx::Size size, | 183 gfx::Size size, |
| 186 const TextureMailbox& texture_mailbox) { | 184 const TextureMailbox& texture_mailbox) { |
| 187 DCHECK(texture_mailbox.IsTexture()); | 185 DCHECK(texture_mailbox.IsTexture()); |
| 188 if (!texture_mailbox.IsTexture()) | 186 if (!texture_mailbox.IsTexture()) |
| 189 return scoped_ptr<SkBitmap>(); | 187 return scoped_ptr<SkBitmap>(); |
| 190 | 188 |
| 191 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; | 189 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; |
| 192 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d( | 190 scoped_ptr<WebKit::WebGraphicsContext3D> context3d( |
| 193 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( | 191 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( |
| 194 WebKit::WebGraphicsContext3D::Attributes())); | 192 WebKit::WebGraphicsContext3D::Attributes())); |
| 195 | 193 |
| 196 EXPECT_TRUE(context3d->makeContextCurrent()); | 194 EXPECT_TRUE(context3d->makeContextCurrent()); |
| 197 | 195 |
| 198 if (texture_mailbox.sync_point()) | 196 if (texture_mailbox.sync_point()) |
| 199 context3d->waitSyncPoint(texture_mailbox.sync_point()); | 197 context3d->waitSyncPoint(texture_mailbox.sync_point()); |
| 200 | 198 |
| 201 unsigned texture_id = context3d->createTexture(); | 199 unsigned texture_id = context3d->createTexture(); |
| 202 context3d->bindTexture(GL_TEXTURE_2D, texture_id); | 200 context3d->bindTexture(GL_TEXTURE_2D, texture_id); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 out_pixels[dest_y + x + SK_G32_SHIFT/8] = pixels.get()[src_y + x + 1]; | 250 out_pixels[dest_y + x + SK_G32_SHIFT/8] = pixels.get()[src_y + x + 1]; |
| 253 out_pixels[dest_y + x + SK_B32_SHIFT/8] = pixels.get()[src_y + x + 2]; | 251 out_pixels[dest_y + x + SK_B32_SHIFT/8] = pixels.get()[src_y + x + 2]; |
| 254 out_pixels[dest_y + x + SK_A32_SHIFT/8] = pixels.get()[src_y + x + 3]; | 252 out_pixels[dest_y + x + SK_A32_SHIFT/8] = pixels.get()[src_y + x + 3]; |
| 255 } | 253 } |
| 256 } | 254 } |
| 257 | 255 |
| 258 return bitmap.Pass(); | 256 return bitmap.Pass(); |
| 259 } | 257 } |
| 260 | 258 |
| 261 } // namespace cc | 259 } // namespace cc |
| OLD | NEW |