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_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 5 #ifndef UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
6 #define UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 6 #define UI_GFX_OZONE_SURFACE_LNUX_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/gfx_export.h" | 13 #include "ui/gfx/gfx_export.h" |
14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
15 #include "ui/gfx/rect.h" | |
15 | 16 |
16 class SkBitmap; | 17 class SkBitmap; |
17 class SkCanvas; | 18 class SkCanvas; |
18 | 19 |
19 namespace gfx { | 20 namespace gfx { |
20 class VSyncProvider; | 21 class VSyncProvider; |
22 class OverlayCandidatesOzone; | |
23 typedef intptr_t NativeBufferOzone; | |
21 | 24 |
22 // The Ozone interface allows external implementations to hook into Chromium to | 25 // The Ozone interface allows external implementations to hook into Chromium to |
23 // provide a system specific implementation. The Ozone interface supports two | 26 // provide a system specific implementation. The Ozone interface supports two |
24 // drawing modes: 1) accelerated drawing through EGL and 2) software drawing | 27 // drawing modes: 1) accelerated drawing through EGL and 2) software drawing |
25 // through Skia. | 28 // through Skia. |
26 // | 29 // |
27 // The following functionality is specific to the drawing mode and may not have | 30 // The following functionality is specific to the drawing mode and may not have |
28 // any meaningful implementation in the other mode. An implementation must | 31 // any meaningful implementation in the other mode. An implementation must |
29 // provide functionality for at least one mode. | 32 // provide functionality for at least one mode. |
30 // | 33 // |
(...skipping 17 matching lines...) Expand all Loading... | |
48 // modes (See comments bellow for descriptions). | 51 // modes (See comments bellow for descriptions). |
49 class GFX_EXPORT SurfaceFactoryOzone { | 52 class GFX_EXPORT SurfaceFactoryOzone { |
50 public: | 53 public: |
51 // Describes the state of the hardware after initialization. | 54 // Describes the state of the hardware after initialization. |
52 enum HardwareState { | 55 enum HardwareState { |
53 UNINITIALIZED, | 56 UNINITIALIZED, |
54 INITIALIZED, | 57 INITIALIZED, |
55 FAILED, | 58 FAILED, |
56 }; | 59 }; |
57 | 60 |
61 // Describes overlay buffer format. | |
62 // TODO: this is a placeholder for now and will be populated with more | |
63 // formats once we know what sorts of content, video, etc. we can support. | |
64 enum BufferFormat { | |
65 UNKNOWN, | |
66 RGBA_8888, | |
67 RGB_888, | |
68 }; | |
69 | |
70 // Describes transformation to be applied to the buffer before presenting | |
71 // to screen. | |
72 enum OverlayTransform { | |
73 NONE, | |
74 FLIP_HORIZONTAL, | |
75 FLIP_VERTICAL, | |
76 ROTATE_90, | |
77 ROTATE_180, | |
78 ROTATE_270, | |
79 }; | |
80 | |
58 typedef void*(*GLGetProcAddressProc)(const char* name); | 81 typedef void*(*GLGetProcAddressProc)(const char* name); |
59 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; | 82 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; |
60 typedef base::Callback<void(GLGetProcAddressProc)> | 83 typedef base::Callback<void(GLGetProcAddressProc)> |
61 SetGLGetProcAddressProcCallback; | 84 SetGLGetProcAddressProcCallback; |
62 | 85 |
63 SurfaceFactoryOzone(); | 86 SurfaceFactoryOzone(); |
64 virtual ~SurfaceFactoryOzone(); | 87 virtual ~SurfaceFactoryOzone(); |
65 | 88 |
66 // Returns the instance | 89 // Returns the instance |
67 static SurfaceFactoryOzone* GetInstance(); | 90 static SurfaceFactoryOzone* GetInstance(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 // terminated with EGL_NONE. Ownership of the array is not transferred to | 152 // terminated with EGL_NONE. Ownership of the array is not transferred to |
130 // caller. desired_list contains list of desired EGL properties and values. | 153 // caller. desired_list contains list of desired EGL properties and values. |
131 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); | 154 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); |
132 | 155 |
133 // Sets the cursor image to |image|. | 156 // Sets the cursor image to |image|. |
134 virtual void SetCursorImage(const SkBitmap& image); | 157 virtual void SetCursorImage(const SkBitmap& image); |
135 | 158 |
136 // Sets the cursor position to |location|. | 159 // Sets the cursor position to |location|. |
137 virtual void MoveCursorTo(const gfx::Point& location); | 160 virtual void MoveCursorTo(const gfx::Point& location); |
138 | 161 |
162 // Get the hal struct to check for overlay support. | |
163 virtual gfx::OverlayCandidatesOzone* GetOverlayCandidates(); | |
rjkroege
2014/03/04 18:54:08
there is conceptually a separate OCOz per display
| |
164 | |
165 // Sets the overlay plane to switch to at the next page flip. | |
166 // |plane_id| specifies the location of the plane above the main framebuffer. | |
rjkroege
2014/03/04 18:54:08
the id is merely to specify the the stacking order
alexst (slow to review)
2014/03/04 20:04:53
This is z_order, I'll rename.
We get the base pla
| |
167 // |plane_transform| specifies how the buffer is to be transformed during. | |
168 // composition. | |
169 // |buffer| to be presented by the overlay. | |
170 // |display_bounds| specify where it is supposed to be on the screen. | |
171 // |crop_rect| specifies the region within the buffer to be placed inside | |
172 // |display_bounds|. | |
173 virtual void ScheduleOverlayPlane(int plane_id, | |
174 OverlayTransform plane_transform, | |
175 gfx::NativeBufferOzone buffer, | |
176 const gfx::Rect& display_bounds, | |
177 gfx::RectF crop_rect); | |
178 | |
179 // Cleate a single native buffer to be used for overlay planes. | |
180 virtual gfx::NativeBufferOzone CreateNativeBuffer(gfx::Size size, | |
181 BufferFormat format); | |
182 | |
139 private: | 183 private: |
140 static SurfaceFactoryOzone* impl_; // not owned | 184 static SurfaceFactoryOzone* impl_; // not owned |
141 }; | 185 }; |
142 | 186 |
143 } // namespace gfx | 187 } // namespace gfx |
144 | 188 |
145 #endif // UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 189 #endif // UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
OLD | NEW |