Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stub_driver_interpreter.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_DRIVER_INTERPRETER_H_
20 #define MIR_TEST_DOUBLES_STUB_DRIVER_INTERPRETER_H_
21 
23 
24 namespace mir
25 {
26 namespace test
27 {
28 namespace doubles
29 {
30 
31 class StubDriverInterpreter : public graphics::android::AndroidDriverInterpreter
32 {
33 public:
35  : sz{sz},
36  visual_id{visual_id}
37  {
38  }
39 
41  : StubDriverInterpreter(mir::geometry::Size{44,22}, 5)
42  {
43  }
44 
46  {
47  return nullptr;
48  }
49  void driver_returns_buffer(ANativeWindowBuffer*, int)
50  {
51  }
53  {
54  }
55  int driver_requests_info(int index) const
56  {
57  if (index == NATIVE_WINDOW_WIDTH)
58  return sz.width.as_uint32_t();
59  if (index == NATIVE_WINDOW_HEIGHT)
60  return sz.height.as_uint32_t();
61  if (index == NATIVE_WINDOW_FORMAT)
62  return visual_id;
63  return 0;
64  }
65  void sync_to_display(bool)
66  {
67  }
68 private:
70  int visual_id;
71 };
72 }
73 }
74 }
75 #endif /* MIR_TEST_DOUBLES_STUB_BUFFER_H_ */
StubDriverInterpreter(mir::geometry::Size sz, int visual_id)
Definition: stub_driver_interpreter.h:34
Definition: size.h:30
StubDriverInterpreter()
Definition: stub_driver_interpreter.h:40
Definition: native_buffer.h:30
Definition: stub_driver_interpreter.h:31
void sync_to_display(bool)
Definition: stub_driver_interpreter.h:65
uint32_t as_uint32_t() const
Definition: dimensions.h:47
void driver_returns_buffer(ANativeWindowBuffer *, int)
Definition: stub_driver_interpreter.h:49
int driver_requests_info(int index) const
Definition: stub_driver_interpreter.h:55
Height height
Definition: size.h:40
void dispatch_driver_request_format(int)
Definition: stub_driver_interpreter.h:52
Width width
Definition: size.h:39
mir::graphics::NativeBuffer * driver_requests_buffer()
Definition: stub_driver_interpreter.h:45

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