Chromium Code Reviews| 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/geometry/point.h" | 11 #include "ui/gfx/geometry/point.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 13 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
| 14 #include "ui/gfx/gpu_memory_buffer.h" | |
|
reveman
2015/05/14 13:22:03
I don't think you should include this here for cir
dshwang
2015/05/14 14:58:15
as I'll remove |device_handle| in GpuMemoryBufferH
| |
| 14 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 15 #include "ui/gfx/overlay_transform.h" | 16 #include "ui/gfx/overlay_transform.h" |
| 16 #include "ui/ozone/ozone_base_export.h" | 17 #include "ui/ozone/ozone_base_export.h" |
| 17 | 18 |
| 18 class SkBitmap; | 19 class SkBitmap; |
| 19 class SkCanvas; | 20 class SkCanvas; |
| 20 | 21 |
| 21 namespace ui { | 22 namespace ui { |
| 22 | 23 |
| 23 class NativePixmap; | 24 class NativePixmap; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 BGRA_8888, | 67 BGRA_8888, |
| 67 RGBX_8888, | 68 RGBX_8888, |
| 68 RGB_888, | 69 RGB_888, |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 enum BufferUsage { | 72 enum BufferUsage { |
| 72 MAP, | 73 MAP, |
| 73 SCANOUT, | 74 SCANOUT, |
| 74 }; | 75 }; |
| 75 | 76 |
| 77 struct Configuration { | |
| 78 BufferFormat format; | |
| 79 BufferUsage usage; | |
| 80 }; | |
| 81 | |
| 76 typedef void* (*GLGetProcAddressProc)(const char* name); | 82 typedef void* (*GLGetProcAddressProc)(const char* name); |
| 77 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; | 83 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; |
| 78 typedef base::Callback<void(GLGetProcAddressProc)> | 84 typedef base::Callback<void(GLGetProcAddressProc)> |
| 79 SetGLGetProcAddressProcCallback; | 85 SetGLGetProcAddressProcCallback; |
| 80 | 86 |
| 81 SurfaceFactoryOzone(); | 87 SurfaceFactoryOzone(); |
| 82 virtual ~SurfaceFactoryOzone(); | 88 virtual ~SurfaceFactoryOzone(); |
| 83 | 89 |
| 84 // Returns the singleton instance. | 90 // Returns the singleton instance. |
| 85 static SurfaceFactoryOzone* GetInstance(); | 91 static SurfaceFactoryOzone* GetInstance(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 | 134 |
| 129 // Create a single native buffer to be used for overlay planes or zero copy | 135 // Create a single native buffer to be used for overlay planes or zero copy |
| 130 // for |widget| representing a particular display controller or default | 136 // for |widget| representing a particular display controller or default |
| 131 // display controller for kNullAcceleratedWidget. | 137 // display controller for kNullAcceleratedWidget. |
| 132 virtual scoped_refptr<NativePixmap> CreateNativePixmap( | 138 virtual scoped_refptr<NativePixmap> CreateNativePixmap( |
| 133 gfx::AcceleratedWidget widget, | 139 gfx::AcceleratedWidget widget, |
| 134 gfx::Size size, | 140 gfx::Size size, |
| 135 BufferFormat format, | 141 BufferFormat format, |
| 136 BufferUsage usage); | 142 BufferUsage usage); |
| 137 | 143 |
| 144 // Export GpuMemoryBufferHandle from |pixmap|. | |
| 145 virtual gfx::GpuMemoryBufferHandle ExportGpuMemoryBufferHandle( | |
| 146 gfx::AcceleratedWidget widget, | |
| 147 scoped_refptr<NativePixmap> pixmap); | |
| 148 | |
| 138 // Sets the overlay plane to switch to at the next page flip. | 149 // Sets the overlay plane to switch to at the next page flip. |
| 139 // |w| specifies the screen to display this overlay plane on. | 150 // |w| specifies the screen to display this overlay plane on. |
| 140 // |plane_z_order| specifies the stacking order of the plane relative to the | 151 // |plane_z_order| specifies the stacking order of the plane relative to the |
| 141 // main framebuffer located at index 0. | 152 // main framebuffer located at index 0. |
| 142 // |plane_transform| specifies how the buffer is to be transformed during. | 153 // |plane_transform| specifies how the buffer is to be transformed during. |
| 143 // composition. | 154 // composition. |
| 144 // |buffer| to be presented by the overlay. | 155 // |buffer| to be presented by the overlay. |
| 145 // |display_bounds| specify where it is supposed to be on the screen. | 156 // |display_bounds| specify where it is supposed to be on the screen. |
| 146 // |crop_rect| specifies the region within the buffer to be placed | 157 // |crop_rect| specifies the region within the buffer to be placed |
| 147 // inside |display_bounds|. This is specified in texture coordinates, in the | 158 // inside |display_bounds|. This is specified in texture coordinates, in the |
| 148 // range of [0,1]. | 159 // range of [0,1]. |
| 149 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 160 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
| 150 int plane_z_order, | 161 int plane_z_order, |
| 151 gfx::OverlayTransform plane_transform, | 162 gfx::OverlayTransform plane_transform, |
| 152 scoped_refptr<NativePixmap> buffer, | 163 scoped_refptr<NativePixmap> buffer, |
| 153 const gfx::Rect& display_bounds, | 164 const gfx::Rect& display_bounds, |
| 154 const gfx::RectF& crop_rect); | 165 const gfx::RectF& crop_rect); |
| 155 | 166 |
| 156 // Returns true if overlays can be shown at z-index 0, replacing the main | 167 // Returns true if overlays can be shown at z-index 0, replacing the main |
| 157 // surface. Combined with surfaceless extensions, it allows for an | 168 // surface. Combined with surfaceless extensions, it allows for an |
| 158 // overlay-only mode. | 169 // overlay-only mode. |
| 159 virtual bool CanShowPrimaryPlaneAsOverlay(); | 170 virtual bool CanShowPrimaryPlaneAsOverlay(); |
| 160 | 171 |
| 161 // Returns true if the platform is able to create buffers for a specific usage | 172 // Gets supported format/usage configurations. |
| 162 // such as MAP for zero copy or SCANOUT for display controller. | 173 virtual std::vector<Configuration> GetSupportedNativePixmapConfigurations() |
| 163 virtual bool CanCreateNativePixmap(BufferUsage usage); | 174 const; |
| 164 | 175 |
| 165 private: | 176 private: |
| 166 static SurfaceFactoryOzone* impl_; // not owned | 177 static SurfaceFactoryOzone* impl_; // not owned |
| 167 }; | 178 }; |
| 168 | 179 |
| 169 } // namespace ui | 180 } // namespace ui |
| 170 | 181 |
| 171 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ | 182 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ |
| OLD | NEW |