[linux/aura] Supports IBus in async mode.
[chromium-blink-merge.git] / ui / gfx / ozone / surface_ozone.h
blobdc3c64bc780d971401b31f811a8d2cb8b11d4779
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.
5 #ifndef UI_GFX_OZONE_SURFACE_OZONE_H_
6 #define UI_GFX_OZONE_SURFACE_OZONE_H_
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"
13 class SkCanvas;
15 namespace gfx {
17 class Size;
18 class VSyncProvider;
20 // The platform-specific part of an EGL surface or software output.
22 // This class owns any bits that the ozone implementation needs freed when
23 // the software output or EGL surface is destroyed.
25 // If you want to paint on a window with ozone, you need to create a
26 // SurfaceOzone for that window.
28 // The platform can support software, EGL, or both for painting on the
29 // window. The initializer for unsupported modes should return false.
30 class GFX_EXPORT SurfaceOzone {
31 public:
32 virtual ~SurfaceOzone() {}
34 // Initialize the surface for output using EGL/GLES2. Returns true if
35 // initialization was successful.
36 virtual bool InitializeEGL() = 0;
38 // Returns the EGL native window for rendering onto this surface.
39 // This can be used to to create a GLSurface.
40 virtual intptr_t /* EGLNativeWindowType */ GetEGLNativeWindow() = 0;
42 // Initialize canvas for software output. Returns true if initialization
43 // was successful.
44 virtual bool InitializeCanvas() = 0;
46 // Returns an SkCanvas for drawing on the window. The canvas is intended
47 // for use when no EGL/GLES2 acceleration is possible.
48 virtual skia::RefPtr<SkCanvas> GetCanvas() = 0;
50 // Attempts to resize the canvas to match the viewport size. Returns true if
51 // resizing was successful, otherwise false (platforms may require a fixed
52 // size canvas). After resizing, the compositor must call GetCanvas() to get
53 // the next canvas.
54 virtual bool ResizeCanvas(const gfx::Size& viewport_size) = 0;
56 // Present the current canvas. After presenting, the compositor must call
57 // GetCanvas() to get the next canvas.
58 virtual bool PresentCanvas() = 0;
60 // Returns a gfx::VsyncProvider for this surface. Note that this may be
61 // called after we have entered the sandbox so if there are operations (e.g.
62 // opening a file descriptor providing vsync events) that must be done
63 // outside of the sandbox, they must have been completed in
64 // InitializeHardware. Returns an empty scoped_ptr on error.
65 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() = 0;
68 } // namespace gfx
70 #endif // UI_GFX_OZONE_SURFACE_OZONE_H_