Chromium Code Reviews| 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_EGL_SURFACE_OZONE_H_ | |
| 6 #define UI_GFX_OZONE_EGL_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. It is not necessary to override any methods for modes the | |
| 30 // platform doesn't support. | |
| 31 class GFX_EXPORT SurfaceOzone { | |
|
piman
2014/03/27 21:20:56
nit: can we keep SurfaceOzone a pure virtual inter
spang
2014/03/28 16:09:13
I'm happy to make this a pure interface but I'd li
spang
2014/03/28 19:08:26
Done.
| |
| 32 public: | |
| 33 SurfaceOzone(); | |
| 34 virtual ~SurfaceOzone(); | |
| 35 | |
| 36 // Initialize the surface for output using EGL/GLES2. Returns true if | |
| 37 // initialization was successful. | |
| 38 virtual bool InitializeEGL(); | |
| 39 | |
| 40 // Returns the EGL native window for rendering onto this surface. | |
| 41 // This can be used to to create a GLSurface. | |
| 42 virtual intptr_t /* EGLNativeWindowType */ GetEGLNativeWindow(); | |
| 43 | |
| 44 // Initialize canvas for software output. Returns true if initialization | |
| 45 // was successful. | |
| 46 virtual bool InitializeCanvas(); | |
| 47 | |
| 48 // Returns an SkCanvas for drawing on the window. The canvas is intended | |
| 49 // for use when no EGL/GLES2 acceleration is possible. | |
| 50 virtual skia::RefPtr<SkCanvas> GetCanvas(); | |
|
rjkroege
2014/03/27 19:24:12
if I call GetCanvas twice without an intervening P
spang
2014/03/27 19:43:47
I think "GetFoo" should be assumed idempotent. The
| |
| 51 | |
| 52 // Attempts to resize the canvas to match the viewport size. Returns true if | |
| 53 // resizing was successful, otherwise false (platforms may require a fixed | |
| 54 // size canvas). After resizing, the compositor must call GetCanvas() to get | |
| 55 // the next canvas. | |
| 56 virtual bool ResizeCanvas(const gfx::Size& viewport_size); | |
| 57 | |
| 58 // Present the current canvas. After presenting, the compositor must call | |
| 59 // GetCanvas() to get the next canvas. | |
| 60 virtual bool PresentCanvas(); | |
| 61 | |
| 62 // Returns a gfx::VsyncProvider for this surface. Note that this may be | |
| 63 // called after we have entered the sandbox so if there are operations (e.g. | |
| 64 // opening a file descriptor providing vsync events) that must be done | |
| 65 // outside of the sandbox, they must have been completed in | |
| 66 // InitializeHardware. Returns an empty scoped_ptr on error. | |
| 67 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider(); | |
| 68 }; | |
| 69 | |
| 70 } // namespace gfx | |
| 71 | |
| 72 #endif // UI_GFX_OZONE_SURFACE_OZONE_H_ | |
| OLD | NEW |