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, 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
| |
| 31 // all modes. | |
| 32 class GFX_EXPORT SurfaceOzone { | |
| 33 public: | |
| 34 SurfaceOzone(); | |
| 35 virtual ~SurfaceOzone(); | |
| 36 | |
| 37 // Initialize the surface for output using EGL/GLES2. Returns true if | |
| 38 // initialization was successful. | |
| 39 virtual bool InitializeEGL(); | |
| 40 | |
| 41 // Returns the EGL native window for rendering onto this surface. | |
| 42 // This can be used to to create a GLSurface. | |
| 43 virtual intptr_t /* EGLNativeWindowType */ GetEGLNativeWindow(); | |
| 44 | |
| 45 // 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..
| |
| 46 // was successful. | |
| 47 virtual bool InitializeCanvas(); | |
| 48 | |
| 49 // Returns an SkCanvas for drawing on the window. The canvas is intended | |
| 50 // for use when no EGL/GLES2 acceleration is possible. | |
| 51 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
| |
| 52 | |
| 53 // Attempts to resize the canvas to match the viewport size. Returns true if | |
| 54 // resizing was successful, otherwise false (platforms may require a fixed | |
| 55 // size canvas). After resizing, the compositor must call GetCanvas() to get | |
| 56 // the next canvas. | |
| 57 virtual bool ResizeCanvas(const gfx::Size& viewport_size); | |
| 58 | |
| 59 // Present the current canvas. After presenting, the compositor must call | |
| 60 // GetCanvas() to get the next canvas. | |
| 61 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.
| |
| 62 | |
| 63 // Returns a gfx::VsyncProvider for this surface. Note that this may be | |
| 64 // called after we have entered the sandbox so if there are operations (e.g. | |
| 65 // opening a file descriptor providing vsync events) that must be done | |
| 66 // outside of the sandbox, they must have been completed in | |
| 67 // InitializeHardware. Returns an empty scoped_ptr on error. | |
| 68 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider(); | |
| 69 }; | |
| 70 | |
| 71 } // namespace gfx | |
| 72 | |
| 73 #endif // UI_GFX_OZONE_SURFACE_OZONE_H_ | |
| OLD | NEW |