OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_OZONE_PUBLIC_SURFACE_OZONE_CANVAS_H_ | 5 #ifndef UI_OZONE_PUBLIC_SURFACE_OZONE_CANVAS_H_ |
6 #define UI_OZONE_PUBLIC_SURFACE_OZONE_CANVAS_H_ | 6 #define UI_OZONE_PUBLIC_SURFACE_OZONE_CANVAS_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "skia/ext/refptr.h" | 9 #include "skia/ext/refptr.h" |
10 #include "ui/ozone/ozone_base_export.h" | 10 #include "ui/ozone/ozone_base_export.h" |
11 | 11 |
12 class SkSurface; | 12 class SkSurface; |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 class Size; | 15 class Size; |
16 class VSyncProvider; | 16 class VSyncProvider; |
17 } | 17 } |
18 | 18 |
19 namespace ui { | 19 namespace ui { |
20 | 20 |
21 // The platform-specific part of an software output. The class is intended | 21 // The platform-specific part of an software output. The class is intended |
22 // for use when no EGL/GLES2 acceleration is possible. | 22 // for use when no EGL/GLES2 acceleration is possible. |
23 // This class owns any bits that the ozone implementation needs freed when | 23 // This class owns any bits that the ozone implementation needs freed when |
24 // the software output is destroyed. | 24 // the software output is destroyed. |
25 class OZONE_BASE_EXPORT SurfaceOzoneCanvas { | 25 class OZONE_BASE_EXPORT SurfaceOzoneCanvas { |
26 public: | 26 public: |
27 virtual ~SurfaceOzoneCanvas() {} | 27 virtual ~SurfaceOzoneCanvas() {} |
28 | 28 |
29 // Returns an SkSurface for drawing on the window. | 29 // Returns an SkSurface for drawing on the window. |
30 virtual skia::RefPtr<SkSurface> GetSurface() = 0; | 30 virtual sk_sp<SkSurface> GetSurface() = 0; |
31 | 31 |
32 // Attempts to resize the canvas to match the viewport size. After | 32 // Attempts to resize the canvas to match the viewport size. After |
33 // resizing, the compositor must call GetCanvas() to get the next | 33 // resizing, the compositor must call GetCanvas() to get the next |
34 // canvas - this invalidates any previous canvas from GetCanvas(). | 34 // canvas - this invalidates any previous canvas from GetCanvas(). |
35 virtual void ResizeCanvas(const gfx::Size& viewport_size) = 0; | 35 virtual void ResizeCanvas(const gfx::Size& viewport_size) = 0; |
36 | 36 |
37 // Present the current canvas. After presenting, the compositor must | 37 // Present the current canvas. After presenting, the compositor must |
38 // call GetCanvas() to get the next canvas - this invalidates any | 38 // call GetCanvas() to get the next canvas - this invalidates any |
39 // previous canvas from GetCanvas(). | 39 // previous canvas from GetCanvas(). |
40 // | 40 // |
41 // The implementation may assume that any pixels outside the damage | 41 // The implementation may assume that any pixels outside the damage |
42 // rectangle are unchanged since the previous call to PresentCanvas(). | 42 // rectangle are unchanged since the previous call to PresentCanvas(). |
43 virtual void PresentCanvas(const gfx::Rect& damage) = 0; | 43 virtual void PresentCanvas(const gfx::Rect& damage) = 0; |
44 | 44 |
45 // Returns a gfx::VsyncProvider for this surface. Note that this may be | 45 // Returns a gfx::VsyncProvider for this surface. Note that this may be |
46 // called after we have entered the sandbox so if there are operations (e.g. | 46 // called after we have entered the sandbox so if there are operations (e.g. |
47 // opening a file descriptor providing vsync events) that must be done | 47 // opening a file descriptor providing vsync events) that must be done |
48 // outside of the sandbox, they must have been completed in | 48 // outside of the sandbox, they must have been completed in |
49 // InitializeHardware. Returns an empty scoped_ptr on error. | 49 // InitializeHardware. Returns an empty scoped_ptr on error. |
50 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() = 0; | 50 virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() = 0; |
51 }; | 51 }; |
52 | 52 |
53 } // namespace ui | 53 } // namespace ui |
54 | 54 |
55 #endif // UI_OZONE_PUBLIC_SURFACE_OZONE_CANVAS_H_ | 55 #endif // UI_OZONE_PUBLIC_SURFACE_OZONE_CANVAS_H_ |
OLD | NEW |