Mir
temporary_buffers.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU 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 General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17  */
18 
19 #ifndef MIR_COMPOSITOR_TEMPORARY_BUFFERS_H_
20 #define MIR_COMPOSITOR_TEMPORARY_BUFFERS_H_
21 
22 #include "mir/graphics/buffer.h"
23 #include "mir/graphics/buffer_id.h"
24 
25 namespace mg = mir::graphics;
26 
27 namespace mir
28 {
29 namespace compositor
30 {
31 
32 class BufferAcquisition;
33 class BackBufferStrategy;
34 
36 {
37 public:
38  geometry::Size size() const override;
39  geometry::Stride stride() const override;
40  MirPixelFormat pixel_format() const override;
41  mg::BufferID id() const override;
42  std::shared_ptr<mg::NativeBuffer> native_buffer_handle() const override;
43  void write (unsigned char const* data, size_t size) override;
44  void read (std::function<void(unsigned char const*)> const& do_with_pixels) override;
46 
47 protected:
48  explicit TemporaryBuffer(std::shared_ptr<mg::Buffer> const& real_buffer);
49  std::shared_ptr<mg::Buffer> const buffer;
50 };
51 
53 {
54 public:
56  std::shared_ptr<BufferAcquisition> const& acquisition, void const* user_id);
58 
59 private:
60  std::shared_ptr<BufferAcquisition> const acquisition;
61 };
62 
64 {
65 public:
66  explicit TemporarySnapshotBuffer(
67  std::shared_ptr<BufferAcquisition> const& acquisition);
69 
70 private:
71  std::shared_ptr<BufferAcquisition> const acquisition;
72 };
73 
74 }
75 }
76 
77 #endif /* MIR_COMPOSITOR_TEMPORARY_BUFFERS_H_ */
Definition: size.h:30
Definition: temporary_buffers.h:35
All things Mir.
Definition: atomic_callback.h:25
TemporarySnapshotBuffer(std::shared_ptr< BufferAcquisition > const &acquisition)
Definition: temporary_buffers.cpp:46
std::shared_ptr< mg::Buffer > const buffer
Definition: temporary_buffers.h:49
~TemporarySnapshotBuffer()
Definition: temporary_buffers.cpp:53
geometry::Size size() const override
Definition: temporary_buffers.cpp:58
Definition: buffer.h:35
Graphics subsystem. Mediates interaction between core system and the graphics environment.
Definition: recently_used_cache.h:31
geometry::Stride stride() const override
Definition: temporary_buffers.cpp:63
std::shared_ptr< mg::NativeBuffer > native_buffer_handle() const override
Definition: temporary_buffers.cpp:78
void read(std::function< void(unsigned char const *)> const &do_with_pixels) override
Definition: temporary_buffers.cpp:89
Definition: temporary_buffers.h:52
MirPixelFormat pixel_format() const override
Definition: temporary_buffers.cpp:68
Definition: temporary_buffers.h:63
graphics::NativeBufferBase * native_buffer_base() override
Definition: temporary_buffers.cpp:94
TemporaryBuffer(std::shared_ptr< mg::Buffer > const &real_buffer)
Definition: temporary_buffers.cpp:29
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:134
~TemporaryCompositorBuffer()
Definition: temporary_buffers.cpp:41
mg::BufferID id() const override
Definition: temporary_buffers.cpp:73
void write(unsigned char const *data, size_t size) override
Definition: temporary_buffers.cpp:83
Definition: buffer.h:44
Definition: dimensions.h:36
TemporaryCompositorBuffer(std::shared_ptr< BufferAcquisition > const &acquisition, void const *user_id)
Definition: temporary_buffers.cpp:34

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Oct 8 16:20:16 UTC 2015