Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
stub_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 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_TEST_DOUBLES_STUB_BUFFER_H_
20 #define MIR_TEST_DOUBLES_STUB_BUFFER_H_
21 
22 #ifdef ANDROID
24 #endif
25 
28 #include "mir/geometry/size.h"
29 #include "mir/graphics/buffer_id.h"
30 
31 namespace mir
32 {
33 namespace test
34 {
35 namespace doubles
36 {
37 
39 {
40 public:
42  : buf_size{0, 0},
43  buf_pixel_format{geometry::PixelFormat::abgr_8888}
44  {
45  }
46 
48  : buf_size{properties.size},
49  buf_pixel_format{properties.format}
50  {
51  }
52 
53  virtual geometry::Size size() const { return buf_size; }
54 
55  virtual geometry::Stride stride() const { return geometry::Stride(); }
56 
58 
59  virtual std::shared_ptr<graphics::NativeBuffer> native_buffer_handle() const
60  {
61 #ifndef ANDROID
62  return std::make_shared<graphics::NativeBuffer>();
63 #else
64  return std::make_shared<StubAndroidNativeBuffer>();
65 #endif
66  }
67  virtual void bind_to_texture() {}
68 
69  virtual bool can_bypass() const override { return false; }
70 
73 };
74 }
75 }
76 }
77 #endif /* MIR_TEST_DOUBLES_STUB_BUFFER_H_ */

Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Oct 15 00:23:28 UTC 2013