| 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 "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/native_library.h" | 10 #include "base/native_library.h" |
| 11 #include "ui/gfx/buffer_types.h" |
| 11 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
| 13 #include "ui/gfx/overlay_transform.h" | 14 #include "ui/gfx/overlay_transform.h" |
| 14 #include "ui/ozone/ozone_base_export.h" | 15 #include "ui/ozone/ozone_base_export.h" |
| 15 | 16 |
| 16 namespace ui { | 17 namespace ui { |
| 17 | 18 |
| 18 class NativePixmap; | 19 class NativePixmap; |
| 19 class SurfaceOzoneCanvas; | 20 class SurfaceOzoneCanvas; |
| 20 class SurfaceOzoneEGL; | 21 class SurfaceOzoneEGL; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 45 // The following function is specific to the software path: | 46 // The following function is specific to the software path: |
| 46 // - CreateCanvasForWidget | 47 // - CreateCanvasForWidget |
| 47 // | 48 // |
| 48 // The accelerated path can optionally provide support for the software drawing | 49 // The accelerated path can optionally provide support for the software drawing |
| 49 // path. | 50 // path. |
| 50 // | 51 // |
| 51 // The remaining functions are not covered since they are needed in both drawing | 52 // The remaining functions are not covered since they are needed in both drawing |
| 52 // modes (See comments bellow for descriptions). | 53 // modes (See comments bellow for descriptions). |
| 53 class OZONE_BASE_EXPORT SurfaceFactoryOzone { | 54 class OZONE_BASE_EXPORT SurfaceFactoryOzone { |
| 54 public: | 55 public: |
| 55 // Describes overlay buffer format. | |
| 56 // TODO: this is a placeholder for now and will be populated with more | |
| 57 // formats once we know what sorts of content, video, etc. we can support. | |
| 58 enum BufferFormat { | |
| 59 UNKNOWN, | |
| 60 BGRA_8888, | |
| 61 RGBX_8888, | |
| 62 BUFFER_FORMAT_LAST = RGBX_8888 | |
| 63 }; | |
| 64 | |
| 65 enum BufferUsage { | |
| 66 MAP, | |
| 67 PERSISTENT_MAP, | |
| 68 SCANOUT, | |
| 69 }; | |
| 70 | |
| 71 typedef void* (*GLGetProcAddressProc)(const char* name); | 56 typedef void* (*GLGetProcAddressProc)(const char* name); |
| 72 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; | 57 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; |
| 73 typedef base::Callback<void(GLGetProcAddressProc)> | 58 typedef base::Callback<void(GLGetProcAddressProc)> |
| 74 SetGLGetProcAddressProcCallback; | 59 SetGLGetProcAddressProcCallback; |
| 75 | 60 |
| 76 // Returns native platform display handle. This is used to obtain the EGL | 61 // Returns native platform display handle. This is used to obtain the EGL |
| 77 // display connection for the native display. | 62 // display connection for the native display. |
| 78 virtual intptr_t GetNativeDisplay(); | 63 virtual intptr_t GetNativeDisplay(); |
| 79 | 64 |
| 80 // Create SurfaceOzoneEGL for the specified gfx::AcceleratedWidget. | 65 // Create SurfaceOzoneEGL for the specified gfx::AcceleratedWidget. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 111 // caller. desired_list contains list of desired EGL properties and values. | 96 // caller. desired_list contains list of desired EGL properties and values. |
| 112 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); | 97 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); |
| 113 | 98 |
| 114 // Create a single native buffer to be used for overlay planes or zero copy | 99 // Create a single native buffer to be used for overlay planes or zero copy |
| 115 // for |widget| representing a particular display controller or default | 100 // for |widget| representing a particular display controller or default |
| 116 // display controller for kNullAcceleratedWidget. | 101 // display controller for kNullAcceleratedWidget. |
| 117 // It can be called on any thread. | 102 // It can be called on any thread. |
| 118 virtual scoped_refptr<NativePixmap> CreateNativePixmap( | 103 virtual scoped_refptr<NativePixmap> CreateNativePixmap( |
| 119 gfx::AcceleratedWidget widget, | 104 gfx::AcceleratedWidget widget, |
| 120 gfx::Size size, | 105 gfx::Size size, |
| 121 BufferFormat format, | 106 gfx::BufferFormat format, |
| 122 BufferUsage usage); | 107 gfx::BufferUsage usage); |
| 123 | 108 |
| 124 // Returns true if overlays can be shown at z-index 0, replacing the main | 109 // Returns true if overlays can be shown at z-index 0, replacing the main |
| 125 // surface. Combined with surfaceless extensions, it allows for an | 110 // surface. Combined with surfaceless extensions, it allows for an |
| 126 // overlay-only mode. | 111 // overlay-only mode. |
| 127 virtual bool CanShowPrimaryPlaneAsOverlay(); | 112 virtual bool CanShowPrimaryPlaneAsOverlay(); |
| 128 | 113 |
| 129 // Returns true if the platform is able to create buffers for a specific usage | 114 // Returns true if the platform is able to create buffers for a specific usage |
| 130 // such as MAP for zero copy or SCANOUT for display controller. | 115 // such as MAP for zero copy or SCANOUT for display controller. |
| 131 virtual bool CanCreateNativePixmap(BufferUsage usage); | 116 virtual bool CanCreateNativePixmap(gfx::BufferUsage usage); |
| 132 | 117 |
| 133 protected: | 118 protected: |
| 134 SurfaceFactoryOzone(); | 119 SurfaceFactoryOzone(); |
| 135 virtual ~SurfaceFactoryOzone(); | 120 virtual ~SurfaceFactoryOzone(); |
| 136 | 121 |
| 137 private: | 122 private: |
| 138 DISALLOW_COPY_AND_ASSIGN(SurfaceFactoryOzone); | 123 DISALLOW_COPY_AND_ASSIGN(SurfaceFactoryOzone); |
| 139 }; | 124 }; |
| 140 | 125 |
| 141 } // namespace ui | 126 } // namespace ui |
| 142 | 127 |
| 143 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ | 128 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ |
| OLD | NEW |