214 |
|
* Utility functions |
215 |
|
*/ |
216 |
|
|
217 |
+ |
// Map video_mode depth ID to numerical depth value |
218 |
+ |
static inline int depth_of_video_mode(video_mode const & mode) |
219 |
+ |
{ |
220 |
+ |
int depth = -1; |
221 |
+ |
switch (mode.depth) { |
222 |
+ |
case VDEPTH_1BIT: |
223 |
+ |
depth = 1; |
224 |
+ |
break; |
225 |
+ |
case VDEPTH_2BIT: |
226 |
+ |
depth = 2; |
227 |
+ |
break; |
228 |
+ |
case VDEPTH_4BIT: |
229 |
+ |
depth = 4; |
230 |
+ |
break; |
231 |
+ |
case VDEPTH_8BIT: |
232 |
+ |
depth = 8; |
233 |
+ |
break; |
234 |
+ |
case VDEPTH_16BIT: |
235 |
+ |
depth = 16; |
236 |
+ |
break; |
237 |
+ |
case VDEPTH_32BIT: |
238 |
+ |
depth = 32; |
239 |
+ |
break; |
240 |
+ |
default: |
241 |
+ |
abort(); |
242 |
+ |
} |
243 |
+ |
return depth; |
244 |
+ |
} |
245 |
+ |
|
246 |
|
// Map RGB color to pixel value (this only works in TrueColor/DirectColor visuals) |
247 |
|
static inline uint32 map_rgb(uint8 red, uint8 green, uint8 blue) |
248 |
|
{ |
754 |
|
native_byte_order = (XImageByteOrder(x_display) == LSBFirst); |
755 |
|
#endif |
756 |
|
#ifdef ENABLE_VOSF |
757 |
< |
Screen_blitter_init(&visualInfo, native_byte_order, mode.depth); |
757 |
> |
Screen_blitter_init(&visualInfo, native_byte_order, depth_of_video_mode(mode)); |
758 |
|
#endif |
759 |
|
|
760 |
|
// Set frame buffer base |
1255 |
|
#if REAL_ADDRESSING || DIRECT_ADDRESSING |
1256 |
|
// Screen_blitter_init() returns TRUE if VOSF is mandatory |
1257 |
|
// i.e. the framebuffer update function is not Blit_Copy_Raw |
1258 |
< |
use_vosf = Screen_blitter_init(&visualInfo, native_byte_order, mode.depth); |
1258 |
> |
use_vosf = Screen_blitter_init(&visualInfo, native_byte_order, depth_of_video_mode(mode)); |
1259 |
|
|
1260 |
|
if (use_vosf) { |
1261 |
|
// Allocate memory for frame buffer (SIZE is extended to page-boundary) |