Mir
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
include
test
mir_test_doubles
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
23
#include "
mock_android_native_buffer.h
"
24
#endif
25
26
#include "
mir/graphics/buffer_basic.h
"
27
#include "
mir/graphics/buffer_properties.h
"
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
38
class
StubBuffer
:
public
graphics::BufferBasic
39
{
40
public
:
41
StubBuffer
()
42
:
buf_size
{0, 0},
43
buf_pixel_format
{geometry::PixelFormat::abgr_8888}
44
{
45
}
46
47
StubBuffer
(
graphics::BufferProperties
const
& properties)
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
57
virtual
geometry::PixelFormat
pixel_format
()
const
{
return
buf_pixel_format
; }
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
71
geometry::Size
const
buf_size
;
72
geometry::PixelFormat
const
buf_pixel_format
;
73
};
74
}
75
}
76
}
77
#endif
/* MIR_TEST_DOUBLES_STUB_BUFFER_H_ */
Copyright © 2012,2013 Canonical Ltd.
Generated on Wed Oct 30 18:52:19 UTC 2013