Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / ozone / public / surface_ozone_canvas.h
blobd02338b70e1ca1a9fce27a2ab8359736ea18ae7c
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_OZONE_PUBLIC_SURFACE_OZONE_CANVAS_H_
6 #define UI_OZONE_PUBLIC_SURFACE_OZONE_CANVAS_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "skia/ext/refptr.h"
11 #include "ui/ozone/ozone_base_export.h"
13 class SkCanvas;
15 namespace gfx {
16 class Size;
17 class VSyncProvider;
20 namespace ui {
22 // The platform-specific part of an software output. The class is intended
23 // for use when no EGL/GLES2 acceleration is possible.
24 // This class owns any bits that the ozone implementation needs freed when
25 // the software output is destroyed.
26 class OZONE_BASE_EXPORT SurfaceOzoneCanvas {
27 public:
28 virtual ~SurfaceOzoneCanvas() {}
30 // Returns an SkCanvas for drawing on the window.
31 virtual skia::RefPtr<SkCanvas> GetCanvas() = 0;
33 // Attempts to resize the canvas to match the viewport size. After
34 // resizing, the compositor must call GetCanvas() to get the next
35 // canvas - this invalidates any previous canvas from GetCanvas().
36 virtual void ResizeCanvas(const gfx::Size& viewport_size) = 0;
38 // Present the current canvas. After presenting, the compositor must
39 // call GetCanvas() to get the next canvas - this invalidates any
40 // previous canvas from GetCanvas().
42 // The implementation may assume that any pixels outside the damage
43 // rectangle are unchanged since the previous call to PresentCanvas().
44 virtual void PresentCanvas(const gfx::Rect& damage) = 0;
46 // Returns a gfx::VsyncProvider for this surface. Note that this may be
47 // called after we have entered the sandbox so if there are operations (e.g.
48 // opening a file descriptor providing vsync events) that must be done
49 // outside of the sandbox, they must have been completed in
50 // InitializeHardware. Returns an empty scoped_ptr on error.
51 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() = 0;
54 } // namespace ui
56 #endif // UI_OZONE_PUBLIC_SURFACE_OZONE_CANVAS_H_