OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
bajones
2016/09/22 22:13:30
Given that these icons will probably be removed ve
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 // | |
5 // Helper for loading bitmaps created by Gimp's "export as .c file" function. | |
bajones
2016/09/22 22:13:30
I hate to ask, but it seems like there's some lice
| |
6 // | |
7 // This is a temporary placeholder since a prerequisite patch which we | |
8 // need for creating these images from text strings is not yet landed. | |
9 // TODO(klausw): delete this file and the icon files ASAP. | |
10 | |
11 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_ICONS_H_ | |
12 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_ICONS_H_ | |
13 | |
14 typedef struct { | |
15 unsigned int width; | |
16 unsigned int height; | |
17 unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */ | |
18 const char* rle_pixel_data; | |
19 } icon_rle_image_t; | |
20 | |
21 // Load the two individual image files. | |
22 #include "chrome/browser/android/vr_shell/icon_not_secure_small.h" | |
23 #include "chrome/browser/android/vr_shell/icon_not_secure_verbose.h" | |
24 | |
25 // Run length decoding macro. This is as generated by Gimp's export, | |
26 // just reformatted for line length limits. | |
27 | |
28 #define ICON_RUN_LENGTH_DECODE(image_buf, rle_data, size, bpp) \ | |
29 do { \ | |
30 unsigned int __bpp; \ | |
31 char* __ip; \ | |
32 const char *__il, *__rd; \ | |
33 __bpp = (bpp); \ | |
34 __ip = (image_buf); \ | |
35 __il = __ip + (size)*__bpp; \ | |
36 __rd = (rle_data); \ | |
37 if (__bpp > 3) { /* RGBA */ \ | |
38 while (__ip < __il) { \ | |
39 unsigned int __l = *(__rd++); \ | |
40 if (__l & 128) { \ | |
41 __l = __l - 128; \ | |
42 do { \ | |
43 memcpy(__ip, __rd, 4); \ | |
44 __ip += 4; \ | |
45 } while (--__l); \ | |
46 __rd += 4; \ | |
47 } else { \ | |
48 __l *= 4; \ | |
49 memcpy(__ip, __rd, __l); \ | |
50 __ip += __l; \ | |
51 __rd += __l; \ | |
52 } \ | |
53 } \ | |
54 } else { /* RGB */ \ | |
55 while (__ip < __il) { \ | |
56 unsigned int __l = *(__rd++); \ | |
57 if (__l & 128) { \ | |
58 __l = __l - 128; \ | |
59 do { \ | |
60 memcpy(__ip, __rd, 3); \ | |
61 __ip += 3; \ | |
62 } while (--__l); \ | |
63 __rd += 3; \ | |
64 } else { \ | |
65 __l *= 3; \ | |
66 memcpy(__ip, __rd, __l); \ | |
67 __ip += __l; \ | |
68 __rd += __l; \ | |
69 } \ | |
70 } \ | |
71 } \ | |
72 } while (0) | |
73 | |
74 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_ICONS_H_ | |
OLD | NEW |