Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends 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  : StubBuffer{
47 
48  {
49  }
50 
52  : StubBuffer{properties, geometry::Stride{}}
53  {
54  }
55 
58  : buf_size{properties.size},
59  buf_pixel_format{properties.format},
61  {
62  }
63 
64  virtual geometry::Size size() const { return buf_size; }
65 
66  virtual geometry::Stride stride() const { return buf_stride; }
67 
68  virtual MirPixelFormat pixel_format() const { return buf_pixel_format; }
69 
70  virtual std::shared_ptr<graphics::NativeBuffer> native_buffer_handle() const
71  {
72 #ifndef ANDROID
73  return std::make_shared<graphics::NativeBuffer>();
74 #else
75  return std::make_shared<StubAndroidNativeBuffer>();
76 #endif
77  }
78  virtual void bind_to_texture() {}
79 
80  virtual bool can_bypass() const override { return false; }
81 
85 };
86 }
87 }
88 }
89 #endif /* MIR_TEST_DOUBLES_STUB_BUFFER_H_ */
Definition: size.h:30
virtual void bind_to_texture()
Definition: stub_buffer.h:78
geometry::Size const buf_size
Definition: stub_buffer.h:82
StubBuffer(graphics::BufferProperties const &properties)
Definition: stub_buffer.h:51
geometry::Size size
Definition: buffer_properties.h:66
virtual MirPixelFormat pixel_format() const
Definition: stub_buffer.h:68
Definition: stub_buffer.h:38
virtual geometry::Size size() const
Definition: stub_buffer.h:64
virtual geometry::Stride stride() const
Definition: stub_buffer.h:66
virtual bool can_bypass() const override
Definition: stub_buffer.h:80
StubBuffer()
Definition: stub_buffer.h:41
StubBuffer(graphics::BufferProperties const &properties, geometry::Stride stride)
Definition: stub_buffer.h:56
MirPixelFormat
The order of components in a format enum matches the order of the components as they would be written...
Definition: common.h:99
Definition: common.h:102
MirPixelFormat const buf_pixel_format
Definition: stub_buffer.h:83
virtual std::shared_ptr< graphics::NativeBuffer > native_buffer_handle() const
Definition: stub_buffer.h:70
Buffer creation properties.
Definition: buffer_properties.h:48
Definition: buffer_basic.h:29
Definition: dimensions.h:38
geometry::Stride const buf_stride
Definition: stub_buffer.h:84

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