summaryrefslogtreecommitdiffstats
path: root/ui/ozone/public/surface_ozone_canvas.h
blob: 42347c3dba53f2f37845773377c9e6c1d0f39c4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_OZONE_PUBLIC_SURFACE_OZONE_CANVAS_H_
#define UI_OZONE_PUBLIC_SURFACE_OZONE_CANVAS_H_

#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "skia/ext/refptr.h"
#include "ui/ozone/ozone_base_export.h"

class SkSurface;

namespace gfx {
class Size;
class VSyncProvider;
}

namespace ui {

// The platform-specific part of an software output. The class is intended
// for use when no EGL/GLES2 acceleration is possible.
// This class owns any bits that the ozone implementation needs freed when
// the software output is destroyed.
class OZONE_BASE_EXPORT SurfaceOzoneCanvas {
 public:
  virtual ~SurfaceOzoneCanvas() {}

  // Returns an SkSurface for drawing on the window.
  virtual skia::RefPtr<SkSurface> GetSurface() = 0;

  // Attempts to resize the canvas to match the viewport size. After
  // resizing, the compositor must call GetCanvas() to get the next
  // canvas - this invalidates any previous canvas from GetCanvas().
  virtual void ResizeCanvas(const gfx::Size& viewport_size) = 0;

  // Present the current canvas. After presenting, the compositor must
  // call GetCanvas() to get the next canvas - this invalidates any
  // previous canvas from GetCanvas().
  //
  // The implementation may assume that any pixels outside the damage
  // rectangle are unchanged since the previous call to PresentCanvas().
  virtual void PresentCanvas(const gfx::Rect& damage) = 0;

  // Returns a gfx::VsyncProvider for this surface. Note that this may be
  // called after we have entered the sandbox so if there are operations (e.g.
  // opening a file descriptor providing vsync events) that must be done
  // outside of the sandbox, they must have been completed in
  // InitializeHardware. Returns an empty scoped_ptr on error.
  virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() = 0;
};

}  // namespace ui

#endif  // UI_OZONE_PUBLIC_SURFACE_OZONE_CANVAS_H_