| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ | 5 #ifndef UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ |
| 6 #define UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ | 6 #define UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/native_library.h" | 16 #include "base/native_library.h" |
| 17 #include "ui/gfx/buffer_types.h" | 17 #include "ui/gfx/buffer_types.h" |
| 18 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
| 19 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
| 20 #include "ui/gfx/overlay_transform.h" | 20 #include "ui/gfx/overlay_transform.h" |
| 21 #include "ui/gl/gl_implementation.h" | 21 #include "ui/gl/gl_implementation.h" |
| 22 #include "ui/gl/gl_surface.h" | 22 #include "ui/gl/gl_surface.h" |
| 23 #include "ui/ozone/ozone_base_export.h" | 23 #include "ui/ozone/ozone_base_export.h" |
| 24 #include "ui/ozone/public/native_pixmap.h" | 24 #include "ui/ozone/public/native_pixmap.h" |
| 25 | 25 |
| 26 namespace ui { | 26 namespace ui { |
| 27 | 27 |
| 28 class NativePixmap; | 28 class NativePixmap; |
| 29 class SurfaceOzoneCanvas; | 29 class SurfaceOzoneCanvas; |
| 30 class SurfaceOzoneEGL; | |
| 31 | 30 |
| 32 // The Ozone interface allows external implementations to hook into Chromium to | 31 // The Ozone interface allows external implementations to hook into Chromium to |
| 33 // provide a system specific implementation. The Ozone interface supports two | 32 // provide a system specific implementation. The Ozone interface supports two |
| 34 // drawing modes: 1) accelerated drawing using GL and 2) software drawing | 33 // drawing modes: 1) accelerated drawing using GL and 2) software drawing |
| 35 // through Skia. | 34 // through Skia. |
| 36 // | 35 // |
| 37 // If you want to paint on a window with ozone, you need to create a GLSurface | 36 // If you want to paint on a window with ozone, you need to create a GLSurface |
| 38 // or SurfaceOzoneCanvas for that window. The platform can support software, GL, | 37 // or SurfaceOzoneCanvas for that window. The platform can support software, GL, |
| 39 // or both for painting on the window. The following functionality is specific | 38 // or both for painting on the window. The following functionality is specific |
| 40 // to the drawing mode and may not have any meaningful implementation in the | 39 // to the drawing mode and may not have any meaningful implementation in the |
| (...skipping 23 matching lines...) Expand all Loading... |
| 64 public: | 63 public: |
| 65 typedef void* (*GLGetProcAddressProc)(const char* name); | 64 typedef void* (*GLGetProcAddressProc)(const char* name); |
| 66 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; | 65 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; |
| 67 typedef base::Callback<void(GLGetProcAddressProc)> | 66 typedef base::Callback<void(GLGetProcAddressProc)> |
| 68 SetGLGetProcAddressProcCallback; | 67 SetGLGetProcAddressProcCallback; |
| 69 | 68 |
| 70 // Returns native platform display handle. This is used to obtain the EGL | 69 // Returns native platform display handle. This is used to obtain the EGL |
| 71 // display connection for the native display. | 70 // display connection for the native display. |
| 72 virtual intptr_t GetNativeDisplay(); | 71 virtual intptr_t GetNativeDisplay(); |
| 73 | 72 |
| 74 // Checks if platform uses the new surface creation API. | |
| 75 // TODO(kylechar): Delete when using all implementations use new surface API. | |
| 76 virtual bool UseNewSurfaceAPI(); | |
| 77 | |
| 78 // Creates a GL surface that renders directly to a view for the specified GL | 73 // Creates a GL surface that renders directly to a view for the specified GL |
| 79 // implementation. | 74 // implementation. |
| 80 virtual scoped_refptr<gl::GLSurface> CreateViewGLSurface( | 75 virtual scoped_refptr<gl::GLSurface> CreateViewGLSurface( |
| 81 gl::GLImplementation implementation, | 76 gl::GLImplementation implementation, |
| 82 gfx::AcceleratedWidget widget); | 77 gfx::AcceleratedWidget widget); |
| 83 | 78 |
| 84 // Creates a GL surface that renders directly into a window with surfaceless | 79 // Creates a GL surface that renders directly into a window with surfaceless |
| 85 // semantics for the specified GL implementation. | 80 // semantics for the specified GL implementation. The surface is not backed |
| 81 // by any buffers and is used for overlay-only displays. This will return |
| 82 // nullptr if surfaceless mode unsupported. |
| 86 virtual scoped_refptr<gl::GLSurface> CreateSurfacelessViewGLSurface( | 83 virtual scoped_refptr<gl::GLSurface> CreateSurfacelessViewGLSurface( |
| 87 gl::GLImplementation implementation, | 84 gl::GLImplementation implementation, |
| 88 gfx::AcceleratedWidget widget); | 85 gfx::AcceleratedWidget widget); |
| 89 | 86 |
| 90 // Creates a GL surface used for offscreen rendering for the specified GL | 87 // Creates a GL surface used for offscreen rendering for the specified GL |
| 91 // implementation. | 88 // implementation. |
| 92 virtual scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface( | 89 virtual scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface( |
| 93 gl::GLImplementation implementation, | 90 gl::GLImplementation implementation, |
| 94 const gfx::Size& size); | 91 const gfx::Size& size); |
| 95 | 92 |
| 96 // Create SurfaceOzoneEGL for the specified gfx::AcceleratedWidget. | |
| 97 // | |
| 98 // Note: When used from content, this is called in the GPU process. The | |
| 99 // platform must support creation of SurfaceOzoneEGL from the GPU process | |
| 100 // using only the handle contained in gfx::AcceleratedWidget. | |
| 101 virtual std::unique_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget( | |
| 102 gfx::AcceleratedWidget widget); | |
| 103 | |
| 104 // Create an EGL surface that isn't backed by any buffers, and is used | |
| 105 // for overlay-only displays. This will return NULL if this mode is | |
| 106 // not supported. | |
| 107 virtual std::unique_ptr<SurfaceOzoneEGL> CreateSurfacelessEGLSurfaceForWidget( | |
| 108 gfx::AcceleratedWidget widget); | |
| 109 | |
| 110 // Create SurfaceOzoneCanvas for the specified gfx::AcceleratedWidget. | 93 // Create SurfaceOzoneCanvas for the specified gfx::AcceleratedWidget. |
| 111 // | 94 // |
| 112 // Note: The platform must support creation of SurfaceOzoneCanvas from the | 95 // Note: The platform must support creation of SurfaceOzoneCanvas from the |
| 113 // Browser Process using only the handle contained in gfx::AcceleratedWidget. | 96 // Browser Process using only the handle contained in gfx::AcceleratedWidget. |
| 114 virtual std::unique_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( | 97 virtual std::unique_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( |
| 115 gfx::AcceleratedWidget widget); | 98 gfx::AcceleratedWidget widget); |
| 116 | 99 |
| 117 // Sets up GL bindings for the native surface. Takes two callback parameters | 100 // Sets up GL bindings for the native surface. Takes two callback parameters |
| 118 // that allow Ozone to register the GL bindings. | 101 // that allow Ozone to register the GL bindings. |
| 119 virtual bool LoadEGLGLES2Bindings( | 102 virtual bool LoadEGLGLES2Bindings( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 147 SurfaceFactoryOzone(); | 130 SurfaceFactoryOzone(); |
| 148 virtual ~SurfaceFactoryOzone(); | 131 virtual ~SurfaceFactoryOzone(); |
| 149 | 132 |
| 150 private: | 133 private: |
| 151 DISALLOW_COPY_AND_ASSIGN(SurfaceFactoryOzone); | 134 DISALLOW_COPY_AND_ASSIGN(SurfaceFactoryOzone); |
| 152 }; | 135 }; |
| 153 | 136 |
| 154 } // namespace ui | 137 } // namespace ui |
| 155 | 138 |
| 156 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ | 139 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ |
| OLD | NEW |