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 enum BufferFormat { | |
63 UNKNOWN, | |
64 RGBA_8888, | |
rjkroege
2014/02/28 23:02:47
in little endian?
| |
65 RGB_888, | |
rjkroege
2014/02/28 23:02:47
padded or un-padded?
alexst (slow to review)
2014/03/03 18:36:24
packed.
| |
66 }; | |
67 | |
68 // Describes transformation to be applied to the buffer before presenting | |
69 // to screen. | |
70 enum OverlayTransform { | |
rjkroege
2014/02/28 23:02:47
some kinds of scaling and colour space conversions
alexst (slow to review)
2014/03/03 18:36:24
I think scaling is universally supported and could
| |
71 NONE, | |
72 FLIP_HORIZONTAL, | |
73 FLIP_VERTICAL, | |
74 ROTATE_90, | |
75 ROTATE_180, | |
76 ROTATE_270, | |
77 }; | |
78 | |
58 typedef void*(*GLGetProcAddressProc)(const char* name); | 79 typedef void*(*GLGetProcAddressProc)(const char* name); |
59 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; | 80 typedef base::Callback<void(base::NativeLibrary)> AddGLLibraryCallback; |
60 typedef base::Callback<void(GLGetProcAddressProc)> | 81 typedef base::Callback<void(GLGetProcAddressProc)> |
61 SetGLGetProcAddressProcCallback; | 82 SetGLGetProcAddressProcCallback; |
62 | 83 |
63 SurfaceFactoryOzone(); | 84 SurfaceFactoryOzone(); |
64 virtual ~SurfaceFactoryOzone(); | 85 virtual ~SurfaceFactoryOzone(); |
65 | 86 |
66 // Returns the instance | 87 // Returns the instance |
67 static SurfaceFactoryOzone* GetInstance(); | 88 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 | 150 // terminated with EGL_NONE. Ownership of the array is not transferred to |
130 // caller. desired_list contains list of desired EGL properties and values. | 151 // caller. desired_list contains list of desired EGL properties and values. |
131 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); | 152 virtual const int32* GetEGLSurfaceProperties(const int32* desired_list); |
132 | 153 |
133 // Sets the cursor image to |image|. | 154 // Sets the cursor image to |image|. |
134 virtual void SetCursorImage(const SkBitmap& image); | 155 virtual void SetCursorImage(const SkBitmap& image); |
135 | 156 |
136 // Sets the cursor position to |location|. | 157 // Sets the cursor position to |location|. |
137 virtual void MoveCursorTo(const gfx::Point& location); | 158 virtual void MoveCursorTo(const gfx::Point& location); |
138 | 159 |
160 // Get the hal struct to check for overlay support. | |
161 virtual gfx::OverlayCandidatesOzone* GetOverlayHAL(); | |
rjkroege
2014/02/28 23:02:47
is the name of the method a bit weird now?
alexst (slow to review)
2014/03/03 18:36:24
Oh yean, I'll change.
| |
162 | |
163 // Sets the overlay plane to switch to at the next page flip. | |
rjkroege
2014/02/28 23:02:47
bike-sheddery: I'd call this "ScheduleOverlayPlane
alexst (slow to review)
2014/03/03 18:36:24
Done.
| |
164 // |plane_id| specifies the location of the plane above the main framebuffer. | |
165 // |plane_transform| specifies how the buffer is to be transformed during. | |
166 // composition. | |
167 // |handle| is the native buffer to be presented by the overlay. | |
rjkroege
2014/02/28 23:02:47
you could call it "buffer"
alexst (slow to review)
2014/03/03 18:36:24
Done.
| |
168 // |display_bounds| specify where it is supposed to be on the screen. | |
169 // |crop_rect| specifies the region within the buffer. | |
rjkroege
2014/02/28 23:02:47
per other file comments: what is expected of imple
alexst (slow to review)
2014/03/03 18:36:24
Project crop rect within the buffer into display_r
| |
170 virtual void SetOverlayPlane(int plane_id, | |
rjkroege
2014/02/28 23:02:47
once we have multiple display support, this needs
alexst (slow to review)
2014/03/03 18:36:24
I thought we were going to have one of these facto
| |
171 OverlayTransform plane_transform, | |
172 gfx::NativeBufferOzone handle, | |
173 const gfx::Rect& display_bounds, | |
174 gfx::RectF crop_rect); | |
175 | |
176 // Cleate a single native buffer to be used for overlay planes. | |
177 virtual gfx::NativeBufferOzone CreateNativeBuffer(gfx::Size size, | |
178 BufferFormat format); | |
179 | |
139 private: | 180 private: |
140 static SurfaceFactoryOzone* impl_; // not owned | 181 static SurfaceFactoryOzone* impl_; // not owned |
141 }; | 182 }; |
142 | 183 |
143 } // namespace gfx | 184 } // namespace gfx |
144 | 185 |
145 #endif // UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ | 186 #endif // UI_GFX_OZONE_SURFACE_LNUX_FACTORY_OZONE_H_ |
OLD | NEW |