1 |
#include "builtinpix.h" |
2 |
|
3 |
Glib::RefPtr<Gdk::Pixbuf> redDot; |
4 |
Glib::RefPtr<Gdk::Pixbuf> yellowDot; |
5 |
Glib::RefPtr<Gdk::Pixbuf> blackLoop; |
6 |
Glib::RefPtr<Gdk::Pixbuf> grayLoop; |
7 |
|
8 |
extern const unsigned char red_dot_rgba[]; |
9 |
extern const unsigned char yellow_dot_rgba[]; |
10 |
extern const unsigned char black_loop_rgba[]; |
11 |
extern const unsigned char gray_loop_rgba[]; |
12 |
|
13 |
extern const int red_dot_rgba_size; |
14 |
extern const int yellow_dot_rgba_size; |
15 |
extern const int black_loop_rgba_size; |
16 |
extern const int gray_loop_rgba_size; |
17 |
|
18 |
static struct _BuiltInPixMap { |
19 |
Glib::RefPtr<Gdk::Pixbuf>* pixbuf; |
20 |
const unsigned char* raw; |
21 |
int size; |
22 |
} builtInPixMap[] = { |
23 |
{ &redDot, red_dot_rgba, red_dot_rgba_size }, |
24 |
{ &yellowDot, yellow_dot_rgba, yellow_dot_rgba_size }, |
25 |
{ &blackLoop, black_loop_rgba, black_loop_rgba_size }, |
26 |
{ &grayLoop, gray_loop_rgba, gray_loop_rgba_size }, |
27 |
}; |
28 |
|
29 |
void loadBuiltInPix() { |
30 |
if (*builtInPixMap[0].pixbuf) return; |
31 |
const int n = sizeof(builtInPixMap) / sizeof(_BuiltInPixMap); |
32 |
for (int i = 0; i < n; ++i) { |
33 |
*builtInPixMap[i].pixbuf = Gdk::Pixbuf::create_from_inline( |
34 |
builtInPixMap[i].size, |
35 |
builtInPixMap[i].raw |
36 |
); |
37 |
} |
38 |
} |