| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/common/gpu/image_transport_surface.h" | 5 #include "content/common/gpu/image_transport_surface.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "content/common/gpu/gpu_messages.h" | 8 #include "content/common/gpu/gpu_messages.h" |
| 9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
| 10 #include "ui/gl/gl_context.h" | 10 #include "ui/gl/gl_context.h" |
| 11 #include "ui/gl/gl_implementation.h" | 11 #include "ui/gl/gl_implementation.h" |
| 12 #include "ui/gl/gl_surface_osmesa.h" | 12 #include "ui/gl/gl_surface_osmesa.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 scoped_refptr<gfx::GLSurface> ImageTransportSurfaceCreateNativeSurface( | 16 scoped_refptr<gfx::GLSurface> ImageTransportSurfaceCreateNativeSurface( |
| 17 GpuChannelManager* manager, | 17 GpuChannelManager* manager, |
| 18 GpuCommandBufferStub* stub, | 18 GpuCommandBufferStub* stub, |
| 19 gfx::PluginWindowHandle handle); | 19 gfx::PluginWindowHandle handle); |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 // A subclass of GLSurfaceOSMesa that doesn't print an error message when | 23 // A subclass of GLSurfaceOSMesa that doesn't print an error message when |
| 24 // SwapBuffers() is called. | 24 // SwapBuffers() is called. |
| 25 class DRTSurfaceOSMesa : public gfx::GLSurfaceOSMesa { | 25 class DRTSurfaceOSMesa : public gfx::GLSurfaceOSMesa { |
| 26 public: | 26 public: |
| 27 // Size doesn't matter, the surface is resized to the right size later. | 27 // Size doesn't matter, the surface is resized to the right size later. |
| 28 DRTSurfaceOSMesa() | 28 DRTSurfaceOSMesa() |
| 29 : GLSurfaceOSMesa(gfx::OSMesaSurfaceFormatRGBA, gfx::Size(1, 1)) {} | 29 : GLSurfaceOSMesa(gfx::GLSurface::SURFACE_OSMESA_RGBA, gfx::Size(1, 1)) {} |
| 30 | 30 |
| 31 // Implement a subset of GLSurface. | 31 // Implement a subset of GLSurface. |
| 32 gfx::SwapResult SwapBuffers() override; | 32 gfx::SwapResult SwapBuffers() override; |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 ~DRTSurfaceOSMesa() override {} | 35 ~DRTSurfaceOSMesa() override {} |
| 36 DISALLOW_COPY_AND_ASSIGN(DRTSurfaceOSMesa); | 36 DISALLOW_COPY_AND_ASSIGN(DRTSurfaceOSMesa); |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 gfx::SwapResult DRTSurfaceOSMesa::SwapBuffers() { | 39 gfx::SwapResult DRTSurfaceOSMesa::SwapBuffers() { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 manager, stub, surface.get())); | 74 manager, stub, surface.get())); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 // static | 78 // static |
| 79 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { | 79 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { |
| 80 g_allow_os_mesa = allow; | 80 g_allow_os_mesa = allow; |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace content | 83 } // namespace content |
| OLD | NEW |