Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Unified Diff: ui/gfx/ozone/surface_ozone.h

Issue 205433002: ozone: Add OzoneSurface object that is owned by compositor, GLSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing InitializeCanvas to FileSurface Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..f2f5b5b37f8040a177c8aafdab5106164a7a67d8
--- /dev/null
+++ b/ui/gfx/ozone/surface_ozone.h
@@ -0,0 +1,75 @@
+// 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 "ui/gfx/gfx_export.h"
+
+class SkCanvas;
+
+namespace gfx {
+
+class Rect;
+class VSyncProvider;
+
+// The platform-specific part of a EGL or software surface.
+//
+// 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 fails initialization
rjkroege 2014/03/24 16:07:04 nit: "fails initialization" is weird grammar.
spang 2014/03/24 16:42:11 Done.
+// for 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.
+ // can be used to to create a GLSurface. This method may only be called in
+ // a process that has a valid GL context.
+ virtual intptr_t /* EGLNativeWindowType */ GetEGLNativeWindow();
+
+ // Initialize canvas for software output. Returns true of initialization
rjkroege 2014/03/24 16:07:04 s/of/if/
spang 2014/03/24 16:42:11 Done.
+ // was successful.
+ virtual bool InitializeCanvas();
+
+ // Returns a SkCanvas for the backing buffers. Drawing to the canvas will draw
rjkroege 2014/03/24 16:07:04 For better compatibility with Skia, the long term
spang 2014/03/24 16:42:11 Agreed, let's break the API slightly more now to a
spang 2014/03/26 19:02:10 I've coordinated with dnicoara to update the API h
+ // to the native surface. The canvas is intended for use when no EGL
+ // acceleration is possible. Its implementation is optional when an EGL
+ // backend is provided for rendering.
+ virtual SkCanvas* GetCanvas();
+
+ // Attempts to resize the canvas to match the viewport size. Returns true if
+ // resizing was successful, otherwise false (native hardware may only support
+ // a single fixed size). If successful, you must call GetCanvas() again.
+ virtual bool ResizeCanvas(const gfx::Rect& viewport_size);
+
+ // Swap buffers in the SkCanvas. This back buffer becomes the new front
rjkroege 2014/03/24 16:07:04 This too needs to be adjusted to reflect the "two
spang 2014/03/26 19:02:10 Done.
+ // buffer and is presented, and the front buffer becomes the back buffer
+ // for subsequent draw operations.
+ virtual bool SwapCanvas();
rjkroege 2014/03/24 16:07:04 Ozone will need to intercept SwapBuffers from EGL
spang 2014/03/24 16:42:11 We can add [On]SwapBuffersEGL(void *display, void
rjkroege 2014/03/24 20:23:15 that sounds reasonable.
+
+ // Returns a gfx::VsyncProvider for the provided AcceleratedWidget. 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_

Powered by Google App Engine
This is Rietveld 408576698