Subversion Repositories HelenOS

Rev

Rev 3826 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3826 Rev 3861
Line 370... Line 370...
370
        return false;
370
        return false;
371
   
371
   
372
    return true;
372
    return true;
373
}
373
}
374
 
374
 
-
 
375
#define RED(i)    (((i) >> 5) & ((1 << 3) - 1))
-
 
376
#define GREEN(i)  (((i) >> 3) & ((1 << 2) - 1))
-
 
377
#define BLUE(i)   ((i) & ((1 << 3) - 1))
-
 
378
#define CLIP(i)   ((i) <= 255 ? (i) : 255)
-
 
379
 
-
 
380
 
375
/**
381
/**
376
 * Sets up the palette for the 8-bit color depth configuration so that the
382
 * Sets up the palette for the 8-bit color depth configuration so that the
377
 * 3:2:3 color scheme can be used. Checks that setting the palette makes sense
383
 * 3:2:3 color scheme can be used. Checks that setting the palette makes sense
378
 * (appropriate nodes exist in the OBP tree and the color depth is not greater
384
 * (appropriate nodes exist in the OBP tree and the color depth is not greater
379
 * than 8).
385
 * than 8).
380
 *
386
 *
381
 * @return  true if the palette has been set, false otherwise
387
 * @return true if the palette has been set, false otherwise
-
 
388
 *
382
 */
389
 */
383
int setup_palette(void)
390
int ofw_setup_palette(void)
384
{
391
{
385
    char device_name[BUF_SIZE];
392
    char device_name[BUF_SIZE];
386
   
393
   
387
    /* resolve alias */
394
    /* resolve alias */
388
    if (ofw_get_property(ofw_aliases, "screen", device_name,
395
    if (ofw_get_property(ofw_aliases, "screen", device_name,
Line 405... Line 412...
405
        return false;
412
        return false;
406
 
413
   
407
    /* setup the palette so that the (inverted) 3:2:3 scheme is usable */
414
    /* setup the palette so that the (inverted) 3:2:3 scheme is usable */
408
    unsigned int i;
415
    unsigned int i;
409
    for (i = 0; i < 256; i++)
416
    for (i = 0; i < 256; i++)
410
        if (ofw_call("call-method", 6, 1, NULL, "color!", screen,
417
        ofw_call("call-method", 6, 1, NULL, "color!", screen,
411
            255 - i,
-
 
412
            i << 5,
-
 
413
            (i >> 3) << 6,
-
 
414
            (i >> 5) << 5) != 0);
418
            255 - i, CLIP(BLUE(i) * 37), GREEN(i) * 85, CLIP(RED(i) * 37));
415
    return true;
419
    return true;
416
}
420
}
417
 
421
 
418
void ofw_quiesce(void)
422
void ofw_quiesce(void)
419
{
423
{