OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_GFX_OZONE_SURFACE_OZONE_H_ |
| 6 #define UI_GFX_OZONE_SURFACE_OZONE_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "skia/ext/refptr.h" |
| 11 #include "ui/gfx/gfx_export.h" |
| 12 |
| 13 class SkCanvas; |
| 14 |
| 15 namespace gfx { |
| 16 |
| 17 class Size; |
| 18 class VSyncProvider; |
| 19 |
| 20 // The platform-specific part of an EGL surface or software output. |
| 21 // |
| 22 // This class owns any bits that the ozone implementation needs freed when |
| 23 // the software output or EGL surface is destroyed. |
| 24 // |
| 25 // If you want to paint on a window with ozone, you need to create a |
| 26 // SurfaceOzone for that window. |
| 27 // |
| 28 // The platform can support software, EGL, or both for painting on the |
| 29 // window. The initializer for unsupported modes should return false. |
| 30 class GFX_EXPORT SurfaceOzone { |
| 31 public: |
| 32 virtual ~SurfaceOzone() {} |
| 33 |
| 34 // Initialize the surface for output using EGL/GLES2. Returns true if |
| 35 // initialization was successful. |
| 36 virtual bool InitializeEGL() = 0; |
| 37 |
| 38 // Returns the EGL native window for rendering onto this surface. |
| 39 // This can be used to to create a GLSurface. |
| 40 virtual intptr_t /* EGLNativeWindowType */ GetEGLNativeWindow() = 0; |
| 41 |
| 42 // Initialize canvas for software output. Returns true if initialization |
| 43 // was successful. |
| 44 virtual bool InitializeCanvas() = 0; |
| 45 |
| 46 // Returns an SkCanvas for drawing on the window. The canvas is intended |
| 47 // for use when no EGL/GLES2 acceleration is possible. |
| 48 virtual skia::RefPtr<SkCanvas> GetCanvas() = 0; |
| 49 |
| 50 // Attempts to resize the canvas to match the viewport size. Returns true if |
| 51 // resizing was successful, otherwise false (platforms may require a fixed |
| 52 // size canvas). After resizing, the compositor must call GetCanvas() to get |
| 53 // the next canvas. |
| 54 virtual bool ResizeCanvas(const gfx::Size& viewport_size) = 0; |
| 55 |
| 56 // Present the current canvas. After presenting, the compositor must call |
| 57 // GetCanvas() to get the next canvas. |
| 58 virtual bool PresentCanvas() = 0; |
| 59 |
| 60 // Returns a gfx::VsyncProvider for this surface. Note that this may be |
| 61 // called after we have entered the sandbox so if there are operations (e.g. |
| 62 // opening a file descriptor providing vsync events) that must be done |
| 63 // outside of the sandbox, they must have been completed in |
| 64 // InitializeHardware. Returns an empty scoped_ptr on error. |
| 65 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() = 0; |
| 66 }; |
| 67 |
| 68 } // namespace gfx |
| 69 |
| 70 #endif // UI_GFX_OZONE_SURFACE_OZONE_H_ |
OLD | NEW |