summaryrefslogtreecommitdiff
path: root/chromium/components/exo/display.h
blob: f54179998428610d1b01bcd6214203b521d09809 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright 2015 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 COMPONENTS_EXO_DISPLAY_H_
#define COMPONENTS_EXO_DISPLAY_H_

#include <stddef.h>

#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/shared_memory_handle.h"

#if defined(USE_OZONE)
#include "base/files/scoped_file.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/size.h"
#endif

namespace gfx {
class Point;
}

namespace exo {
class SharedMemory;
class ShellSurface;
class SubSurface;
class Surface;

#if defined(USE_OZONE)
class Buffer;
#endif

// The core display class. This class provides functions for creating surfaces
// and is in charge of combining the contents of multiple surfaces into one
// displayable output.
class Display {
 public:
  Display();
  ~Display();

  // Creates a new surface.
  scoped_ptr<Surface> CreateSurface();

  // Creates a shared memory segment from |handle| of |size| with the
  // given |id|. This function takes ownership of |handle|.
  scoped_ptr<SharedMemory> CreateSharedMemory(
      const base::SharedMemoryHandle& handle,
      size_t size);

#if defined(USE_OZONE)
  // Creates a buffer for a Linux DMA-buf file descriptor.
  scoped_ptr<Buffer> CreateLinuxDMABufBuffer(base::ScopedFD fd,
                                             const gfx::Size& size,
                                             gfx::BufferFormat format,
                                             int stride);
#endif

  // Creates a shell surface for an existing surface.
  scoped_ptr<ShellSurface> CreateShellSurface(Surface* surface);

  // Creates a popup shell surface for an existing surface at |position| and
  // with |parent|. |position| is in |parent| surface local coordinates.
  scoped_ptr<ShellSurface> CreatePopupShellSurface(Surface* surface,
                                                   ShellSurface* parent,
                                                   const gfx::Point& position);

  // Creates a sub-surface for an existing surface. The sub-surface will be
  // a child of |parent|.
  scoped_ptr<SubSurface> CreateSubSurface(Surface* surface, Surface* parent);

 private:
  DISALLOW_COPY_AND_ASSIGN(Display);
};

}  // namespace exo

#endif  // COMPONENTS_EXO_DISPLAY_H_