Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: ui/ozone/public/surface_factory_ozone.h

Issue 2122243002: Add new Ozone surface API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gl_egl
Patch Set: Even more deps. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/ozone/ozone.gyp ('k') | ui/ozone/public/surface_factory_ozone.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/native_library.h" 16 #include "base/native_library.h"
16 #include "ui/gfx/buffer_types.h" 17 #include "ui/gfx/buffer_types.h"
17 #include "ui/gfx/geometry/rect.h" 18 #include "ui/gfx/geometry/rect.h"
18 #include "ui/gfx/native_widget_types.h" 19 #include "ui/gfx/native_widget_types.h"
19 #include "ui/gfx/overlay_transform.h" 20 #include "ui/gfx/overlay_transform.h"
21 #include "ui/gl/gl_implementation.h"
22 #include "ui/gl/gl_surface.h"
20 #include "ui/ozone/ozone_base_export.h" 23 #include "ui/ozone/ozone_base_export.h"
21 #include "ui/ozone/public/native_pixmap.h" 24 #include "ui/ozone/public/native_pixmap.h"
22 25
23 namespace ui { 26 namespace ui {
24 27
25 class NativePixmap; 28 class NativePixmap;
26 class SurfaceOzoneCanvas; 29 class SurfaceOzoneCanvas;
27 class SurfaceOzoneEGL; 30 class SurfaceOzoneEGL;
28 31
29 // The Ozone interface allows external implementations to hook into Chromium to 32 // The Ozone interface allows external implementations to hook into Chromium to
30 // provide a system specific implementation. The Ozone interface supports two 33 // provide a system specific implementation. The Ozone interface supports two
31 // drawing modes: 1) accelerated drawing through EGL and 2) software drawing 34 // drawing modes: 1) accelerated drawing using GL and 2) software drawing
32 // through Skia. 35 // through Skia.
33 // 36 //
34 // If you want to paint on a window with ozone, you need to create a 37 // If you want to paint on a window with ozone, you need to create a GLSurface
35 // SurfaceOzoneEGL or SurfaceOzoneCanvas for that window. The platform can 38 // or SurfaceOzoneCanvas for that window. The platform can support software, GL,
36 // support software, EGL, or both for painting on the window. 39 // or both for painting on the window. The following functionality is specific
37 // The following functionality is specific to the drawing mode and may not have 40 // to the drawing mode and may not have any meaningful implementation in the
38 // any meaningful implementation in the other mode. An implementation must 41 // other mode. An implementation must provide functionality for at least one
39 // provide functionality for at least one mode. 42 // mode.
40 // 43 //
41 // 1) Accelerated Drawing (EGL path): 44 // 1) Accelerated Drawing (GL path):
42 // 45 //
43 // The following functions are specific to EGL: 46 // The following functions are specific to GL:
44 // - GetNativeDisplay 47 // - GetNativeDisplay (EGL only)
45 // - LoadEGLGLES2Bindings 48 // - LoadEGLGLES2Bindings (EGL only)
46 // - CreateEGLSurfaceForWidget 49 // - CreateViewGLSurface (all GL implementations)
50 // - CreateSurfacelessViewGLSurface (EGL only)
51 // - CreateOffscreenGLSurface (all GL implementations)
47 // 52 //
48 // 2) Software Drawing (Skia): 53 // 2) Software Drawing (Skia):
49 // 54 //
50 // The following function is specific to the software path: 55 // The following function is specific to the software path:
51 // - CreateCanvasForWidget 56 // - CreateCanvasForWidget
52 // 57 //
53 // The accelerated path can optionally provide support for the software drawing 58 // The accelerated path can optionally provide support for the software drawing
54 // path. 59 // path.
55 // 60 //
56 // The remaining functions are not covered since they are needed in both drawing 61 // The remaining functions are not covered since they are needed in both drawing
57 // modes (See comments bellow for descriptions). 62 // modes (See comments bellow for descriptions).
58 class OZONE_BASE_EXPORT SurfaceFactoryOzone { 63 class OZONE_BASE_EXPORT SurfaceFactoryOzone {
59 public: 64 public:
60 typedef void* (*GLGetProcAddressProc)(const char* name); 65 typedef void* (*GLGetProcAddressProc)(const char* name);
61 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; 66 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback;
62 typedef base::Callback<void(GLGetProcAddressProc)> 67 typedef base::Callback<void(GLGetProcAddressProc)>
63 SetGLGetProcAddressProcCallback; 68 SetGLGetProcAddressProcCallback;
64 69
65 // Returns native platform display handle. This is used to obtain the EGL 70 // Returns native platform display handle. This is used to obtain the EGL
66 // display connection for the native display. 71 // display connection for the native display.
67 virtual intptr_t GetNativeDisplay(); 72 virtual intptr_t GetNativeDisplay();
68 73
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
79 // implementation.
80 virtual scoped_refptr<gl::GLSurface> CreateViewGLSurface(
81 gl::GLImplementation implementation,
82 gfx::AcceleratedWidget widget);
83
84 // Creates a GL surface that renders directly into a window with surfaceless
85 // semantics for the specified GL implementation.
86 virtual scoped_refptr<gl::GLSurface> CreateSurfacelessViewGLSurface(
87 gl::GLImplementation implementation,
88 gfx::AcceleratedWidget widget);
89
90 // Creates a GL surface used for offscreen rendering for the specified GL
91 // implementation.
92 virtual scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface(
93 gl::GLImplementation implementation,
94 const gfx::Size& size);
95
69 // Create SurfaceOzoneEGL for the specified gfx::AcceleratedWidget. 96 // Create SurfaceOzoneEGL for the specified gfx::AcceleratedWidget.
70 // 97 //
71 // Note: When used from content, this is called in the GPU process. The 98 // Note: When used from content, this is called in the GPU process. The
72 // platform must support creation of SurfaceOzoneEGL from the GPU process 99 // platform must support creation of SurfaceOzoneEGL from the GPU process
73 // using only the handle contained in gfx::AcceleratedWidget. 100 // using only the handle contained in gfx::AcceleratedWidget.
74 virtual std::unique_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget( 101 virtual std::unique_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget(
75 gfx::AcceleratedWidget widget); 102 gfx::AcceleratedWidget widget);
76 103
77 // Create an EGL surface that isn't backed by any buffers, and is used 104 // Create an EGL surface that isn't backed by any buffers, and is used
78 // for overlay-only displays. This will return NULL if this mode is 105 // for overlay-only displays. This will return NULL if this mode is
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 SurfaceFactoryOzone(); 147 SurfaceFactoryOzone();
121 virtual ~SurfaceFactoryOzone(); 148 virtual ~SurfaceFactoryOzone();
122 149
123 private: 150 private:
124 DISALLOW_COPY_AND_ASSIGN(SurfaceFactoryOzone); 151 DISALLOW_COPY_AND_ASSIGN(SurfaceFactoryOzone);
125 }; 152 };
126 153
127 } // namespace ui 154 } // namespace ui
128 155
129 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ 156 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_
OLDNEW
« no previous file with comments | « ui/ozone/ozone.gyp ('k') | ui/ozone/public/surface_factory_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698