xoreos  0.0.5
icon.cpp
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifdef WIN32
26  #define WIN32_LEAN_AND_MEAN
27  #include <windows.h>
28 
29  #include "src/common/fallthrough.h"
31  #include <SDL_syswm.h>
33 #endif
34 
35 #include <cstring>
36 
37 #include "src/graphics/icon.h"
38 
39 namespace Graphics {
40 
42 static const byte kStaticIcon[32 * 32 * 4] = {
43  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
44  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
45  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
46  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
47  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
48  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
49  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
50  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
51  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
52  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
53  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
54  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
55  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
56  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
57  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
58  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
59  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
60  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
61  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
62  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
63  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
64  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
65  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
66  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
67  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x33,0x33,0x0A,
68  0x28,0x28,0x28,0x33,0x28,0x28,0x28,0x33,0x27,0x27,0x27,0x27,0x2B,0x2B,0x2B,0x1E,
69  0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
70  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
71  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
72  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
73  0x2C,0x2C,0x2C,0x17,0x26,0x26,0x26,0x22,0x28,0x28,0x28,0x33,0x28,0x28,0x28,0x33,
74  0x2C,0x2C,0x2C,0x17,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
75  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2A,0x2A,0x2A,0x31,
76  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
77  0x28,0x28,0x28,0xF3,0x28,0x28,0x28,0xBD,0x27,0x27,0x27,0x6F,0x22,0x22,0x22,0x0F,
78  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
79  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
80  0x40,0x40,0x40,0x04,0x29,0x29,0x29,0x57,0x29,0x29,0x29,0xAA,0x28,0x28,0x28,0xE9,
81  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
82  0x29,0x29,0x29,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
83  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2A,0x2A,0x2A,0x31,
84  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
85  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xF1,
86  0x27,0x27,0x27,0x75,0x33,0x33,0x33,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
87  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x28,0x28,0x28,0x4D,
88  0x28,0x28,0x28,0xDD,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
89  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
90  0x29,0x29,0x29,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
91  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2A,0x2A,0x2A,0x31,
92  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
93  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
94  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xC5,0x27,0x27,0x27,0x1A,0x00,0x00,0x00,0x00,
95  0x00,0x00,0x00,0x00,0x33,0x33,0x33,0x05,0x28,0x28,0x28,0x94,0x28,0x28,0x28,0xFF,
96  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
97  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
98  0x29,0x29,0x29,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
99  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2A,0x2A,0x2A,0x31,
100  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
101  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
102  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xE0,0x24,0x24,0x24,0x23,
103  0x2B,0x2B,0x2B,0x06,0x28,0x28,0x28,0xB3,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
104  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
105  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
106  0x29,0x29,0x29,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
107  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0x27,0x27,0x21,
108  0x29,0x29,0x29,0xAA,0x29,0x29,0x29,0xAA,0x29,0x29,0x29,0xB6,0x28,0x28,0x28,0xD1,
109  0x28,0x28,0x28,0xFC,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
110  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xD5,
111  0x29,0x29,0x29,0x9D,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
112  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
113  0x28,0x28,0x28,0xDD,0x28,0x28,0x28,0xC0,0x29,0x29,0x29,0xAA,0x29,0x29,0x29,0xAA,
114  0x29,0x29,0x29,0x4B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
115  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
116  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
117  0x29,0x29,0x29,0x19,0x28,0x28,0x28,0x7E,0x28,0x28,0x28,0xF1,0x28,0x28,0x28,0xFF,
118  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
119  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
120  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFB,0x28,0x28,0x28,0x9E,0x29,0x29,0x29,0x2C,
121  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
122  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
123  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
124  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
125  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x26,0x26,0x22,0x28,0x28,0x28,0xD8,
126  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
127  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
128  0x28,0x28,0x28,0xED,0x27,0x27,0x27,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
129  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
130  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
131  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
132  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
133  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x26,0x26,0x1B,
134  0x28,0x28,0x28,0xE3,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
135  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xF8,
136  0x27,0x27,0x27,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
137  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
138  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
139  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
140  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
141  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
142  0x29,0x29,0x29,0x4B,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
143  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0x7F,
144  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
145  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
146  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
147  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
148  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
149  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
150  0x00,0x00,0x00,0x00,0x29,0x29,0x29,0xD6,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
151  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xF9,0x30,0x30,0x30,0x10,
152  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
153  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
154  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
155  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
156  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
157  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
158  0x00,0x00,0x00,0x00,0x28,0x28,0x28,0x87,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
159  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xC0,0x00,0x00,0x00,0x00,
160  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
161  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
162  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
163  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
164  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
165  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
166  0x00,0x00,0x00,0x00,0x28,0x28,0x28,0x60,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
167  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x29,0x29,0x29,0x9D,0x00,0x00,0x00,0x00,
168  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
169  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
170  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
171  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
172  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
173  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
174  0x00,0x00,0x00,0x00,0x27,0x27,0x27,0x5C,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
175  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0x99,0x00,0x00,0x00,0x00,
176  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
177  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
178  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
179  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
180  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
181  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
182  0x00,0x00,0x00,0x00,0x27,0x27,0x27,0x7B,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
183  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x27,0x27,0x27,0xB5,0x00,0x00,0x00,0x00,
184  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
185  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
186  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
187  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
188  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
189  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
190  0x00,0x00,0x00,0x00,0x29,0x29,0x29,0xC3,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
191  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xF2,0x2B,0x2B,0x2B,0x06,
192  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
193  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
194  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
195  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
196  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
197  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
198  0x28,0x28,0x28,0x2D,0x28,0x28,0x28,0xFD,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
199  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x29,0x29,0x29,0x5E,
200  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
201  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
202  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
203  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
204  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
205  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x04,
206  0x28,0x28,0x28,0xC0,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
207  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xE4,
208  0x24,0x24,0x24,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
209  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
210  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
211  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
212  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
213  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x33,0x33,0x05,0x28,0x28,0x28,0x9E,
214  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
215  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
216  0x29,0x29,0x29,0xC3,0x28,0x28,0x28,0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
217  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
218  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
219  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
220  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
221  0x00,0x00,0x00,0x00,0x2A,0x2A,0x2A,0x31,0x28,0x28,0x28,0xC6,0x28,0x28,0x28,0xFF,
222  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
223  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
224  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xE1,0x29,0x29,0x29,0x51,0x00,0x00,0x00,0x00,
225  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
226  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
227  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2C,0x2C,0x2C,0x17,
228  0x29,0x29,0x29,0x77,0x29,0x29,0x29,0x77,0x29,0x29,0x29,0x77,0x28,0x28,0x28,0x8C,
229  0x28,0x28,0x28,0xC8,0x28,0x28,0x28,0xFD,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
230  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xF0,
231  0x28,0x28,0x28,0xCD,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
232  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xDB,
233  0x29,0x29,0x29,0x97,0x27,0x27,0x27,0x7C,0x29,0x29,0x29,0x77,0x29,0x29,0x29,0x77,
234  0x26,0x26,0x26,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
235  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2A,0x2A,0x2A,0x31,
236  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
237  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
238  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xF9,0x29,0x29,0x29,0x4B,
239  0x27,0x27,0x27,0x1A,0x28,0x28,0x28,0xE0,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
240  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
241  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
242  0x29,0x29,0x29,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
243  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2A,0x2A,0x2A,0x31,
244  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
245  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
246  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xEE,0x29,0x29,0x29,0x45,0x00,0x00,0x00,0x00,
247  0x00,0x00,0x00,0x00,0x24,0x24,0x24,0x1C,0x27,0x27,0x27,0xCF,0x28,0x28,0x28,0xFF,
248  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
249  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
250  0x29,0x29,0x29,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
251  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2A,0x2A,0x2A,0x31,
252  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
253  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
254  0x28,0x28,0x28,0xB9,0x27,0x27,0x27,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
255  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x1C,0x1C,0x09,0x28,0x28,0x28,0x91,
256  0x28,0x28,0x28,0xFC,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
257  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
258  0x29,0x29,0x29,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
259  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2A,0x2A,0x2A,0x31,
260  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
261  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xF7,0x28,0x28,0x28,0xB3,0x29,0x29,0x29,0x44,
262  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
263  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
264  0x25,0x25,0x25,0x29,0x27,0x27,0x27,0x9B,0x28,0x28,0x28,0xEB,0x28,0x28,0x28,0xFF,
265  0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,0x28,0x28,0x28,0xFF,
266  0x29,0x29,0x29,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
267  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x26,0x26,0x14,
268  0x28,0x28,0x28,0x66,0x28,0x28,0x28,0x66,0x28,0x28,0x28,0x66,0x27,0x27,0x27,0x62,
269  0x28,0x28,0x28,0x3A,0x33,0x33,0x33,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
270  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
271  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
272  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x27,0x27,0x27,0x2E,
273  0x27,0x27,0x27,0x5B,0x28,0x28,0x28,0x66,0x28,0x28,0x28,0x66,0x28,0x28,0x28,0x66,
274  0x28,0x28,0x28,0x2D,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
275  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
276  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
277  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
278  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
279  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
280  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
281  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
282  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
283  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
284  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
285  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
286  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
287  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
288  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
289  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
290  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
291  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
292  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
293  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
294  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
295  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
296  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
297  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
298  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
299 };
300 
301 static SDL_Surface *createStaticIconSurface() {
302  uint32 rMask, gMask, bMask, aMask;
303 
304 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
305  rMask = 0xFF000000;
306  gMask = 0x00FF0000;
307  bMask = 0x0000FF00;
308  aMask = 0x000000FF;
309 #else
310  rMask = 0x000000FF;
311  gMask = 0x0000FF00;
312  bMask = 0x00FF0000;
313  aMask = 0xFF000000;
314 #endif
315 
316  SDL_Surface *surface = SDL_CreateRGBSurface(0, 32, 32, 32, rMask, gMask, bMask, aMask);
317  memcpy(surface->pixels, kStaticIcon, sizeof(kStaticIcon));
318 
319  return surface;
320 }
321 
322 static void setStaticIcon(SDL_Window &window) {
323  SDL_Surface *icon = createStaticIconSurface();
324 
325  SDL_SetWindowIcon(&window, icon);
326 
327  SDL_FreeSurface(icon);
328 }
329 
330 #if defined(WIN32)
331 static bool setWindowsIcon(SDL_Window &window) {
332  HMODULE handle = GetModuleHandle(0);
333  HICON ico = LoadIcon(handle, MAKEINTRESOURCE(1001 /* IDI_ICON */));
334 
335  if (!ico)
336  return false;
337 
338  SDL_SysWMinfo sdlWMInfo;
339 
340  SDL_VERSION(&sdlWMInfo.version);
341  if (!SDL_GetWindowWMInfo(&window, &sdlWMInfo))
342  return false;
343 
344  SetClassLongPtr(sdlWMInfo.info.win.window, GCLP_HICON, (ULONG_PTR)ico);
345 
346  return GetLastError() == ERROR_SUCCESS;
347 }
348 #endif
349 
350 void setWindowIcon(SDL_Window &window) {
351 #if defined(WIN32)
352  // Try to set the windows icon from the ICO in the resources.
353  // If that fails, use the static icon.
354 
355  if (!setWindowsIcon(window))
356  setStaticIcon(window);
357 
358 #elif defined(MACOSX)
359  // Do nothing on Mac OS X. The external icon is pulled in by default already.
360 
361 #else
362  /* TODO: We should try setting _NET_WM_ICON on GNU/Linux to get support for scalable
363  * icons there as well. Additionally, XSetWMHints() should be used for
364  * window manager that do not support _NET_WM_ICON (like e16).
365  */
366 
367  setStaticIcon(window);
368 #endif
369 }
370 
371 } // End of namespace Graphics
Make the render window display our icon.
void setWindowIcon(SDL_Window &window)
Definition: icon.cpp:350
#define START_IGNORE_IMPLICIT_FALLTHROUGH
Definition: fallthrough.h:79
static const byte kStaticIcon[32 *32 *4]
Static version of the xoreos icon.
Definition: icon.cpp:42
static SDL_Surface * createStaticIconSurface()
Definition: icon.cpp:301
#define STOP_IGNORE_IMPLICIT_FALLTHROUGH
Definition: fallthrough.h:80
uint32_t uint32
Definition: types.h:204
Compiler-specific defines to mark an implicit switch-case fallthrough.
uint8 byte
Definition: types.h:209
static void setStaticIcon(SDL_Window &window)
Definition: icon.cpp:322