1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
Index: src/arch/unix/x11/gnome/uicolor.c
===================================================================
--- src/arch/unix/x11/gnome/uicolor.c (revision 19058)
+++ src/arch/unix/x11/gnome/uicolor.c (working copy)
@@ -101,14 +101,12 @@
for (i = 0; i < palette->num_entries; i++) {
palette_entry_t color = palette->entries[i];
- DWORD color_pixel;
-
- unsigned char *col = (unsigned char *)&color_pixel;
- col[0] = color.red ;
- col[1] = color.green;
- col[2] = color.blue ;
- video_render_setphysicalcolor(((video_canvas_t*)c)->videoconfig, i,
- color_pixel, 24);
+ DWORD color_pixel =
+ (DWORD)color.red |
+ (DWORD)color.green << 8 |
+ (DWORD)color.blue << 16;
+ video_render_setphysicalcolor(((video_canvas_t*)c)->videoconfig, i,
+ color_pixel, 24);
}
return 0;
}
@@ -116,27 +114,11 @@
static void uicolor_init_video_colors()
{
short i;
- DWORD pixelr, pixelg, pixelb;
- for (i = 0; i < 256; i++)
- {
- unsigned char* pixelrbyte = (unsigned char*)&pixelr;
- unsigned char* pixelgbyte = (unsigned char*)&pixelg;
- unsigned char* pixelbbyte = (unsigned char*)&pixelb;
- pixelrbyte[0] = i;
- pixelrbyte[1] = 0;
- pixelrbyte[2] = 0;
- pixelgbyte[0] = 0;
- pixelgbyte[1] = i;
- pixelgbyte[2] = 0;
- pixelbbyte[0] = 0;
- pixelbbyte[1] = 0;
- pixelbbyte[2] = i;
-
- video_render_setrawrgb(i,
- pixelr,
- pixelg,
- pixelb);
+ for (i = 0; i < 256; i++) {
+ video_render_setrawrgb(i,
+ (DWORD)i, (DWORD)i << 8, (DWORD)i << 16
+ );
}
video_render_initraw();
|