Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
android_client_buffer.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 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  * Kevin DuBois <kevin.dubois@canonical.com>
18  */
19 
20 #ifndef MIR_CLIENT_ANDROID_ANDROID_CLIENT_BUFFER_H_
21 #define MIR_CLIENT_ANDROID_ANDROID_CLIENT_BUFFER_H_
22 
24 #include "../aging_buffer.h"
25 #include "android_registrar.h"
26 
27 #include <system/window.h>
28 #include <memory>
29 
30 namespace mir
31 {
32 namespace client
33 {
34 namespace android
35 {
36 
37 class AndroidClientBuffer : public AgingBuffer
38 {
39 public:
40  AndroidClientBuffer(std::shared_ptr<AndroidRegistrar> const&,
41  std::shared_ptr<const native_handle_t> const&,
42  geometry::Size size, MirPixelFormat pf, geometry::Stride stride);
43  ~AndroidClientBuffer() noexcept;
44 
45  std::shared_ptr<MemoryRegion> secure_for_cpu_write();
46  geometry::Size size() const;
47  geometry::Stride stride() const;
48  MirPixelFormat pixel_format() const;
49  std::shared_ptr<mir::graphics::NativeBuffer> native_buffer_handle() const;
50 
51  AndroidClientBuffer(const AndroidClientBuffer&) = delete;
52  AndroidClientBuffer& operator=(const AndroidClientBuffer&) = delete;
53 private:
54  void pack_native_window_buffer();
55 
56  std::shared_ptr<AndroidRegistrar> buffer_registrar;
57  std::shared_ptr<graphics::android::AndroidNativeBuffer> native_window_buffer;
58  std::shared_ptr<const native_handle_t> native_handle;
59  const MirPixelFormat buffer_pf;
60  geometry::Stride const buffer_stride;
61  geometry::Size const buffer_size;
62 };
63 
64 }
65 }
66 }
67 #endif /* MIR_CLIENT_ANDROID_ANDROID_CLIENT_BUFFER_H_ */
struct MirBufferPackage NativeBuffer
Definition: native_buffer.h:35
detail::IntWrapper< detail::stride > Stride
Definition: dimensions.h:111
Definition: dimensions.h:35
MirPixelFormat
The order of components in a format enum matches the order of the components as they would be written...
Definition: common.h:99
int const size
Definition: make_socket_rpc_channel.cpp:50

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Apr 11 21:14:53 UTC 2014