Mir
patterns.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012-2014 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 3 as
6  * 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 #ifndef MIR_TEST_DRAW_PATTERNS_H
19 #define MIR_TEST_DRAW_PATTERNS_H
20 
22 
23 #include <memory>
24 #include <stdexcept>
25 #include <stdint.h>
26 #include <cstring>
27 
28 namespace mir
29 {
30 namespace test
31 {
32 
34 {
35 public:
36  virtual ~DrawPattern() {};
37  virtual void draw(MirGraphicsRegion const& region) const = 0;
38  virtual bool check(MirGraphicsRegion const& region) const = 0;
39 
40 protected:
41  DrawPattern() = default;
42  DrawPattern(DrawPattern const&) = delete;
43  DrawPattern& operator=(DrawPattern const&) = delete;
44 };
45 
47 {
48 public:
49  /* todo: should construct with a color value type, not an uint32 */
50  DrawPatternSolid(uint32_t color_value);
51 
52  void draw(MirGraphicsRegion const& region) const;
53  bool check(MirGraphicsRegion const& region) const;
54 
55 private:
56  const uint32_t color_value;
57 };
58 
59 template<size_t Rows, size_t Cols>
61 {
62 public:
63  /* todo: should construct with a color value type, not an uint32 */
64  DrawPatternCheckered(uint32_t (&pattern) [Rows][Cols]);
65 
66  void draw(MirGraphicsRegion const& region) const;
67  bool check(MirGraphicsRegion const& region) const;
68 
69 private:
70  uint32_t color_pattern [Rows][Cols];
71 };
73 
74 }
75 }
76 
77 #endif /*MIR_TEST_DRAW_PATTERNS_H */
All things Mir.
Definition: atomic_callback.h:25
Definition: patterns.h:33
virtual ~DrawPattern()
Definition: patterns.h:36
DrawPattern & operator=(DrawPattern const &)=delete
Definition: patterns.h:60
Definition: patterns.h:46
Retrieved information about a MirSurface.
Definition: client_types.h:236
virtual void draw(MirGraphicsRegion const &region) const =0
virtual bool check(MirGraphicsRegion const &region) const =0

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Sep 8 14:50:19 UTC 2016