Rev 1740 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1740 | Rev 1781 | ||
|---|---|---|---|
| Line 68... | Line 68... | ||
| 68 | 68 | ||
| 69 | typedef void (*conv2scr_fn_t)(void *, int); |
69 | typedef void (*conv2scr_fn_t)(void *, int); |
| 70 | typedef int (*conv2rgb_fn_t)(void *); |
70 | typedef int (*conv2rgb_fn_t)(void *); |
| 71 | 71 | ||
| 72 | struct { |
72 | struct { |
| 73 | __u8 *fbaddress ; |
73 | uint8_t *fbaddress ; |
| 74 | 74 | ||
| 75 | unsigned int xres ; |
75 | unsigned int xres ; |
| 76 | unsigned int yres ; |
76 | unsigned int yres ; |
| 77 | unsigned int scanline ; |
77 | unsigned int scanline ; |
| 78 | unsigned int pixelbytes ; |
78 | unsigned int pixelbytes ; |
| Line 92... | Line 92... | ||
| 92 | style_t style; |
92 | style_t style; |
| 93 | /* Auto-cursor position */ |
93 | /* Auto-cursor position */ |
| 94 | int cursor_active, cur_col, cur_row; |
94 | int cursor_active, cur_col, cur_row; |
| 95 | int cursor_shown; |
95 | int cursor_shown; |
| 96 | /* Double buffering */ |
96 | /* Double buffering */ |
| 97 | __u8 *dbdata; |
97 | uint8_t *dbdata; |
| 98 | unsigned int dboffset; |
98 | unsigned int dboffset; |
| 99 | unsigned int paused; |
99 | unsigned int paused; |
| 100 | } viewport_t; |
100 | } viewport_t; |
| 101 | 101 | ||
| 102 | #define MAX_ANIM_LEN 8 |
102 | #define MAX_ANIM_LEN 8 |
| Line 118... | Line 118... | ||
| 118 | */ |
118 | */ |
| 119 | #define MAX_PIXMAPS 256 |
119 | #define MAX_PIXMAPS 256 |
| 120 | typedef struct { |
120 | typedef struct { |
| 121 | unsigned int width; |
121 | unsigned int width; |
| 122 | unsigned int height; |
122 | unsigned int height; |
| 123 | __u8 *data; |
123 | uint8_t *data; |
| 124 | } pixmap_t; |
124 | } pixmap_t; |
| 125 | static pixmap_t pixmaps[MAX_PIXMAPS]; |
125 | static pixmap_t pixmaps[MAX_PIXMAPS]; |
| 126 | 126 | ||
| 127 | /* Viewport is a rectangular area on the screen */ |
127 | /* Viewport is a rectangular area on the screen */ |
| 128 | #define MAX_VIEWPORTS 128 |
128 | #define MAX_VIEWPORTS 128 |
| Line 151... | Line 151... | ||
| 151 | return (*(int *)src) & 0xffffff; |
151 | return (*(int *)src) & 0xffffff; |
| 152 | } |
152 | } |
| 153 | 153 | ||
| 154 | static void rgb_3byte(void *dst, int rgb) |
154 | static void rgb_3byte(void *dst, int rgb) |
| 155 | { |
155 | { |
| 156 | __u8 *scr = dst; |
156 | uint8_t *scr = dst; |
| 157 | #if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN)) |
157 | #if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN)) |
| 158 | scr[0] = RED(rgb, 8); |
158 | scr[0] = RED(rgb, 8); |
| 159 | scr[1] = GREEN(rgb, 8); |
159 | scr[1] = GREEN(rgb, 8); |
| 160 | scr[2] = BLUE(rgb, 8); |
160 | scr[2] = BLUE(rgb, 8); |
| 161 | #else |
161 | #else |
| Line 167... | Line 167... | ||
| 167 | 167 | ||
| 168 | } |
168 | } |
| 169 | 169 | ||
| 170 | static int byte3_rgb(void *src) |
170 | static int byte3_rgb(void *src) |
| 171 | { |
171 | { |
| 172 | __u8 *scr = src; |
172 | uint8_t *scr = src; |
| 173 | #if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN)) |
173 | #if (defined(BIG_ENDIAN) || defined(FB_BIG_ENDIAN)) |
| 174 | return scr[0] << 16 | scr[1] << 8 | scr[2]; |
174 | return scr[0] << 16 | scr[1] << 8 | scr[2]; |
| 175 | #else |
175 | #else |
| 176 | return scr[2] << 16 | scr[1] << 8 | scr[0]; |
176 | return scr[2] << 16 | scr[1] << 8 | scr[0]; |
| 177 | #endif |
177 | #endif |
| Line 179... | Line 179... | ||
| 179 | 179 | ||
| 180 | /** 16-bit depth (5:6:5) */ |
180 | /** 16-bit depth (5:6:5) */ |
| 181 | static void rgb_2byte(void *dst, int rgb) |
181 | static void rgb_2byte(void *dst, int rgb) |
| 182 | { |
182 | { |
| 183 | /* 5-bit, 6-bits, 5-bits */ |
183 | /* 5-bit, 6-bits, 5-bits */ |
| 184 | *((__u16 *)(dst)) = RED(rgb, 5) << 11 | GREEN(rgb, 6) << 5 | BLUE(rgb, 5); |
184 | *((uint16_t *)(dst)) = RED(rgb, 5) << 11 | GREEN(rgb, 6) << 5 | BLUE(rgb, 5); |
| 185 | } |
185 | } |
| 186 | 186 | ||
| 187 | /** 16-bit depth (5:6:5) */ |
187 | /** 16-bit depth (5:6:5) */ |
| 188 | static int byte2_rgb(void *src) |
188 | static int byte2_rgb(void *src) |
| 189 | { |
189 | { |
| 190 | int color = *(__u16 *)(src); |
190 | int color = *(uint16_t *)(src); |
| 191 | return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3); |
191 | return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3); |
| 192 | } |
192 | } |
| 193 | 193 | ||
| 194 | /** Put pixel - 8-bit depth (3:2:3) */ |
194 | /** Put pixel - 8-bit depth (3:2:3) */ |
| 195 | static void rgb_1byte(void *dst, int rgb) |
195 | static void rgb_1byte(void *dst, int rgb) |
| 196 | { |
196 | { |
| 197 | *(__u8 *)dst = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb, 3); |
197 | *(uint8_t *)dst = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb, 3); |
| 198 | } |
198 | } |
| 199 | 199 | ||
| 200 | /** Return pixel color - 8-bit depth (3:2:3) */ |
200 | /** Return pixel color - 8-bit depth (3:2:3) */ |
| 201 | static int byte1_rgb(void *src) |
201 | static int byte1_rgb(void *src) |
| 202 | { |
202 | { |
| 203 | int color = *(__u8 *)src; |
203 | int color = *(uint8_t *)src; |
| 204 | return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5); |
204 | return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5); |
| 205 | } |
205 | } |
| 206 | 206 | ||
| 207 | /** Put pixel into viewport |
207 | /** Put pixel into viewport |
| 208 | * |
208 | * |
| Line 374... | Line 374... | ||
| 374 | * @param sx Coordinates of top-left of the character |
374 | * @param sx Coordinates of top-left of the character |
| 375 | * @param sy Coordinates of top-left of the character |
375 | * @param sy Coordinates of top-left of the character |
| 376 | * @param style Color of the character |
376 | * @param style Color of the character |
| 377 | * @param transparent If false, print background color |
377 | * @param transparent If false, print background color |
| 378 | */ |
378 | */ |
| 379 | static void draw_glyph(viewport_t *vport,__u8 glyph, unsigned int sx, unsigned int sy, |
379 | static void draw_glyph(viewport_t *vport,uint8_t glyph, unsigned int sx, unsigned int sy, |
| 380 | style_t style, int transparent) |
380 | style_t style, int transparent) |
| 381 | { |
381 | { |
| 382 | int i; |
382 | int i; |
| 383 | unsigned int y; |
383 | unsigned int y; |
| 384 | unsigned int glline; |
384 | unsigned int glline; |