Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
patterns.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 Lesser 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 Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser 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 /* todo: replace with color value types */
26 #include <stdint.h>
27 #include <cstring>
28 
29 namespace mir
30 {
31 namespace test
32 {
33 namespace draw
34 {
35 
37 {
38 public:
39  virtual ~DrawPattern() {};
40  virtual void draw(MirGraphicsRegion const& region) const = 0;
41  virtual bool check(MirGraphicsRegion const& region) const = 0;
42 
43 protected:
44  DrawPattern() = default;
45  DrawPattern(DrawPattern const&) = delete;
46  DrawPattern& operator=(DrawPattern const&) = delete;
47 };
48 
50 {
51 public:
52  /* todo: should construct with a color value type, not an uint32 */
53  DrawPatternSolid(uint32_t color_value);
54 
55  void draw(MirGraphicsRegion const& region) const;
56  bool check(MirGraphicsRegion const& region) const;
57 
58 private:
59  const uint32_t color_value;
60 };
61 
62 template<size_t Rows, size_t Cols>
64 {
65 public:
66  /* todo: should construct with a color value type, not an uint32 */
67  DrawPatternCheckered(uint32_t (&pattern) [Rows][Cols]);
68 
69  void draw(MirGraphicsRegion const& region) const;
70  bool check(MirGraphicsRegion const& region) const;
71 
72 private:
73  uint32_t color_pattern [Rows][Cols];
74 };
76 
77 }
78 }
79 }
80 
81 #endif /*MIR_TEST_DRAW_PATTERNS_H */
Definition: patterns.h:36
bool check(MirGraphicsRegion const &region) const
Definition: patterns.cpp:45
Definition: patterns.h:63
virtual bool check(MirGraphicsRegion const &region) const =0
Definition: patterns.h:49
bool check(MirGraphicsRegion const &region) const
Definition: draw_pattern_checkered-inl.h:48
virtual void draw(MirGraphicsRegion const &region) const =0
void draw(MirGraphicsRegion const &region) const
Definition: draw_pattern_checkered-inl.h:29
DrawPatternCheckered(uint32_t(&pattern)[Rows][Cols])
Definition: draw_pattern_checkered-inl.h:22
Retrieved information about a MirSurface.
Definition: client_types.h:164
DrawPattern & operator=(DrawPattern const &)=delete
virtual ~DrawPattern()
Definition: patterns.h:39
void draw(MirGraphicsRegion const &region) const
Definition: patterns.cpp:29
DrawPatternSolid(uint32_t color_value)
Definition: patterns.cpp:24

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