Chromium Code Reviews| Index: ui/gfx/ozone/surface_ozone.h |
| diff --git a/ui/gfx/ozone/surface_ozone.h b/ui/gfx/ozone/surface_ozone.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..530f4476b3f4f20ef715e1eb472a19cdcef5b4b3 |
| --- /dev/null |
| +++ b/ui/gfx/ozone/surface_ozone.h |
| @@ -0,0 +1,72 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_GFX_OZONE_EGL_SURFACE_OZONE_H_ |
| +#define UI_GFX_OZONE_EGL_SURFACE_OZONE_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "skia/ext/refptr.h" |
| +#include "ui/gfx/gfx_export.h" |
| + |
| +class SkCanvas; |
| + |
| +namespace gfx { |
| + |
| +class Size; |
| +class VSyncProvider; |
| + |
| +// The platform-specific part of an EGL surface or software output. |
| +// |
| +// This class owns any bits that the ozone implementation needs freed when |
| +// the software output or EGL surface is destroyed. |
| +// |
| +// If you want to paint on a window with ozone, you need to create a |
| +// SurfaceOzone for that window. |
| +// |
| +// The platform can support software, EGL, or both for painting on the |
| +// window. It is not necessary to override any methods for modes the |
| +// platform doesn't support. |
| +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.
|
| + public: |
| + SurfaceOzone(); |
| + virtual ~SurfaceOzone(); |
| + |
| + // Initialize the surface for output using EGL/GLES2. Returns true if |
| + // initialization was successful. |
| + virtual bool InitializeEGL(); |
| + |
| + // Returns the EGL native window for rendering onto this surface. |
| + // This can be used to to create a GLSurface. |
| + virtual intptr_t /* EGLNativeWindowType */ GetEGLNativeWindow(); |
| + |
| + // Initialize canvas for software output. Returns true if initialization |
| + // was successful. |
| + virtual bool InitializeCanvas(); |
| + |
| + // Returns an SkCanvas for drawing on the window. The canvas is intended |
| + // for use when no EGL/GLES2 acceleration is possible. |
| + 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
|
| + |
| + // Attempts to resize the canvas to match the viewport size. Returns true if |
| + // resizing was successful, otherwise false (platforms may require a fixed |
| + // size canvas). After resizing, the compositor must call GetCanvas() to get |
| + // the next canvas. |
| + virtual bool ResizeCanvas(const gfx::Size& viewport_size); |
| + |
| + // Present the current canvas. After presenting, the compositor must call |
| + // GetCanvas() to get the next canvas. |
| + virtual bool PresentCanvas(); |
| + |
| + // Returns a gfx::VsyncProvider for this surface. Note that this may be |
| + // called after we have entered the sandbox so if there are operations (e.g. |
| + // opening a file descriptor providing vsync events) that must be done |
| + // outside of the sandbox, they must have been completed in |
| + // InitializeHardware. Returns an empty scoped_ptr on error. |
| + virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider(); |
| +}; |
| + |
| +} // namespace gfx |
| + |
| +#endif // UI_GFX_OZONE_SURFACE_OZONE_H_ |