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..14fcba7ca0257bd15284218bd4b5ecf21eaa802a |
| --- /dev/null |
| +++ b/ui/gfx/ozone/surface_ozone.h |
| @@ -0,0 +1,73 @@ |
| +// 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, as the base class will fail initialization for |
|
rjkroege
2014/03/26 19:59:02
nit: "will provide no-op implementations for all m
spang
2014/03/26 22:21:28
My idea was that InitializeFoo() in the base class
|
| +// all modes. |
| +class GFX_EXPORT SurfaceOzone { |
| + 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 of initialization |
|
rjkroege
2014/03/26 19:59:02
s/of/if/
spang
2014/03/26 22:21:28
Doh! I swear I did this already..
|
| + // 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/26 19:59:02
GetDrawableCanvas?
spang
2014/03/26 22:21:28
If we had both GetDrawableCanvas and GetCanvas, wh
|
| + |
| + // 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 SwapCanvas(); |
|
rjkroege
2014/03/26 19:59:02
call this "PresentCurrentCanvas" and reduce the co
spang
2014/03/26 22:21:28
Hah, I was thinking it should say Present as well.
|
| + |
| + // 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_ |