Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
shm_buffer.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by:
17  * Alexandros Frantzis <alexandros.frantzis@canonical.com>
18  */
19 
20 #ifndef MIR_GRAPHICS_MESA_SHM_BUFFER_H_
21 #define MIR_GRAPHICS_MESA_SHM_BUFFER_H_
22 
25 #include "mir/geometry/size.h"
26 #include "mir_toolkit/common.h"
27 
28 namespace mir
29 {
30 namespace graphics
31 {
32 namespace mesa
33 {
34 
35 class ShmFile;
36 
37 class ShmBuffer : public BufferBasic
38 {
39 public:
40  ShmBuffer(std::shared_ptr<ShmFile> const& shm_file,
41  geometry::Size const& size,
43  ~ShmBuffer() noexcept;
44 
45  geometry::Size size() const;
46  geometry::Stride stride() const;
48  std::shared_ptr<MirNativeBuffer> native_buffer_handle() const;
49  void gl_bind_to_texture() override;
50  bool can_bypass() const;
51 
52  void write(unsigned char const* data, size_t size);
53 
54 private:
55  ShmBuffer(ShmBuffer const&) = delete;
56  ShmBuffer& operator=(ShmBuffer const&) = delete;
57 
58  std::shared_ptr<ShmFile> const shm_file;
59  geometry::Size const size_;
60  MirPixelFormat const pixel_format_;
61  geometry::Stride const stride_;
62  void* const pixels;
63 };
64 
65 }
66 }
67 }
68 
69 #endif /* MIR_GRAPHICS_MESA_SHM_BUFFER_H_ */
Definition: size.h:30
All things Mir.
Definition: aging_buffer.h:24
bool can_bypass() const
Definition: shm_buffer.cpp:90
void gl_bind_to_texture() override
Definition: shm_buffer.cpp:66
Definition: shm_buffer.h:37
geometry::Stride stride() const
Definition: shm_buffer.cpp:56
std::shared_ptr< MirNativeBuffer > native_buffer_handle() const
Definition: shm_buffer.cpp:74
~ShmBuffer() noexcept
Definition: shm_buffer.cpp:47
ShmBuffer(std::shared_ptr< ShmFile > const &shm_file, geometry::Size const &size, MirPixelFormat const &pixel_format)
Definition: shm_buffer.cpp:35
MirPixelFormat
The order of components in a format enum matches the order of the components as they would be written...
Definition: common.h:119
MirPixelFormat pixel_format() const
Definition: shm_buffer.cpp:61
Definition: buffer_basic.h:29
geometry::Size size() const
Definition: shm_buffer.cpp:51
void write(unsigned char const *data, size_t size)
Definition: shm_buffer.cpp:95
Definition: dimensions.h:38

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Oct 10 14:07:14 UTC 2014