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/ref_counted.h" | |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "base/native_library.h" | 11 #include "base/native_library.h" |
11 #include "ui/gfx/geometry/point.h" | 12 #include "ui/gfx/geometry/point.h" |
12 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
13 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
14 #include "ui/gfx/overlay_transform.h" | 15 #include "ui/gfx/overlay_transform.h" |
15 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.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 typedef intptr_t NativeBufferOzone; | |
24 class OverlayCandidatesOzone; | 24 class OverlayCandidatesOzone; |
25 class SurfaceOzoneCanvas; | 25 class SurfaceOzoneCanvas; |
26 class SurfaceOzoneEGL; | 26 class SurfaceOzoneEGL; |
27 | 27 |
28 // TODO: find a better spot for this to live. | |
29 class NativePixmap : public base::RefCounted<NativePixmap> { | |
dnicoara
2014/07/03 18:30:17
Just move it in it's own file.
And add some comme
| |
30 public: | |
31 NativePixmap() {} | |
32 | |
33 virtual void* /* EGLClientBuffer */ native_handle() = 0; | |
spang
2014/07/03 18:29:09
If this is "get me the handle to pass to EGL" then
dnicoara
2014/07/03 18:30:17
I believe these should follow the normal naming co
achaulk
2014/07/03 19:49:43
Done.
| |
34 virtual int dma_buf_fd() = 0; | |
35 | |
36 protected: | |
37 virtual ~NativePixmap() {} | |
38 | |
39 friend class base::RefCounted<NativePixmap>; | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(NativePixmap); | |
42 }; | |
43 | |
28 // The Ozone interface allows external implementations to hook into Chromium to | 44 // The Ozone interface allows external implementations to hook into Chromium to |
29 // provide a system specific implementation. The Ozone interface supports two | 45 // provide a system specific implementation. The Ozone interface supports two |
30 // drawing modes: 1) accelerated drawing through EGL and 2) software drawing | 46 // drawing modes: 1) accelerated drawing through EGL and 2) software drawing |
31 // through Skia. | 47 // through Skia. |
32 // | 48 // |
33 // If you want to paint on a window with ozone, you need to create a | 49 // If you want to paint on a window with ozone, you need to create a |
34 // SurfaceOzoneEGL or SurfaceOzoneCanvas for that window. The platform can | 50 // SurfaceOzoneEGL or SurfaceOzoneCanvas for that window. The platform can |
35 // support software, EGL, or both for painting on the window. | 51 // support software, EGL, or both for painting on the window. |
36 // The following functionality is specific to the drawing mode and may not have | 52 // The following functionality is specific to the drawing mode and may not have |
37 // any meaningful implementation in the other mode. An implementation must | 53 // any meaningful implementation in the other mode. An implementation must |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 // used to select a display configuration. Note that all properties should be | 143 // used to select a display configuration. Note that all properties should be |
128 // immediately followed by the corresponding desired value and array should be | 144 // immediately followed by the corresponding desired value and array should be |
129 // terminated with EGL_NONE. Ownership of the array is not transferred to | 145 // terminated with EGL_NONE. Ownership of the array is not transferred to |
130 // caller. desired_list contains list of desired EGL properties and values. | 146 // caller. desired_list contains list of desired EGL properties and values. |
131 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); | 147 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); |
132 | 148 |
133 // Get the hal struct to check for overlay support. | 149 // Get the hal struct to check for overlay support. |
134 virtual OverlayCandidatesOzone* GetOverlayCandidates( | 150 virtual OverlayCandidatesOzone* GetOverlayCandidates( |
135 gfx::AcceleratedWidget w); | 151 gfx::AcceleratedWidget w); |
136 | 152 |
137 // Sets the overlay plane to switch to at the next page flip. | 153 // Cleate a single native buffer to be used for overlay planes. |
138 // |plane_z_order| specifies the stacking order of the plane relative to the | 154 virtual scoped_refptr<ui::NativePixmap> CreateNativeBuffer( |
139 // main framebuffer located at index 0. | 155 gfx::Size size, BufferFormat format); |
spang
2014/07/03 18:29:09
seems rather inconsistent. CreateNativePixmap
achaulk
2014/07/03 19:49:44
Done.
| |
140 // |plane_transform| specifies how the buffer is to be transformed during. | |
141 // composition. | |
142 // |buffer| to be presented by the overlay. | |
143 // |display_bounds| specify where it is supposed to be on the screen. | |
144 // |crop_rect| specifies the region within the buffer to be placed inside | |
145 // |display_bounds|. | |
146 virtual void ScheduleOverlayPlane(gfx::AcceleratedWidget w, | |
147 int plane_z_order, | |
148 gfx::OverlayTransform plane_transform, | |
149 ui::NativeBufferOzone buffer, | |
150 const gfx::Rect& display_bounds, | |
151 gfx::RectF crop_rect); | |
152 | 156 |
153 // Cleate a single native buffer to be used for overlay planes. | 157 // Returns true if overlays can be shown at z-index 0, replacing the main |
154 virtual ui::NativeBufferOzone CreateNativeBuffer(gfx::Size size, | 158 // surface. Combined with surfaceless extensions, it allows for an |
155 BufferFormat format); | 159 // overlay-only mode. |
160 virtual bool CanShowPrimaryPlaneAsOverlay(); | |
spang
2014/07/03 18:29:09
thanks
| |
156 | 161 |
157 private: | 162 private: |
158 static SurfaceFactoryOzone* impl_; // not owned | 163 static SurfaceFactoryOzone* impl_; // not owned |
159 }; | 164 }; |
160 | 165 |
161 } // namespace ui | 166 } // namespace ui |
162 | 167 |
163 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ | 168 #endif // UI_OZONE_PUBLIC_SURFACE_FACTORY_OZONE_H_ |
OLD | NEW |