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
draw
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 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
#ifndef MIR_TEST_DRAW_PATTERNS_H
19
#define MIR_TEST_DRAW_PATTERNS_H
20
21
#include "
mir_toolkit/mir_client_library.h
"
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
36
class
DrawPattern
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
49
class
DrawPatternSolid
:
public
DrawPattern
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>
63
class
DrawPatternCheckered
:
public
DrawPattern
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
};
75
#include "
mir_test/draw/draw_pattern_checkered-inl.h
"
76
77
}
78
}
79
}
80
81
#endif
/*MIR_TEST_DRAW_PATTERNS_H */
Copyright © 2012,2013 Canonical Ltd.
Generated on Wed Oct 30 18:52:19 UTC 2013