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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 "ui/gfx/gfx_export.h"
11
12 class SkCanvas;
13
14 namespace gfx {
15
16 class Rect;
17 class VSyncProvider;
18
19 // The platform-specific part of a EGL or software surface.
20 //
21 // This class owns any bits that the ozone implementation needs freed when
22 // the software output or EGL surface is destroyed.
23 //
24 // If you want to paint on a window with ozone, you need to create a
25 // SurfaceOzone for that window.
26 //
27 // The platform can support software, EGL, or both for painting on the
28 // window. It is not necessary to override any methods for modes the
29 // 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.
30 // for all modes.
31 class GFX_EXPORT SurfaceOzone {
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 // can be used to to create a GLSurface. This method may only be called in
42 // a process that has a valid GL context.
43 virtual intptr_t /* EGLNativeWindowType */ GetEGLNativeWindow();
44
45 // 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.
46 // was successful.
47 virtual bool InitializeCanvas();
48
49 // 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
50 // to the native surface. The canvas is intended for use when no EGL
51 // acceleration is possible. Its implementation is optional when an EGL
52 // backend is provided for rendering.
53 virtual SkCanvas* GetCanvas();
54
55 // Attempts to resize the canvas to match the viewport size. Returns true if
56 // resizing was successful, otherwise false (native hardware may only support
57 // a single fixed size). If successful, you must call GetCanvas() again.
58 virtual bool ResizeCanvas(const gfx::Rect& viewport_size);
59
60 // 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.
61 // buffer and is presented, and the front buffer becomes the back buffer
62 // for subsequent draw operations.
63 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.
64
65 // Returns a gfx::VsyncProvider for the provided AcceleratedWidget. Note
66 // that this may be called after we have entered the sandbox so if there are
67 // operations (e.g. opening a file descriptor providing vsync events) that
68 // must be done outside of the sandbox, they must have been completed
69 // in InitializeHardware. Returns an empty scoped_ptr on error.
70 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider();
71 };
72
73 } // namespace gfx
74
75 #endif // UI_GFX_OZONE_SURFACE_OZONE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698