Esempio n. 1
0
void
dfb_palette_generate_rgb121_map( CorePalette *palette )
{
     unsigned int i;

     D_DEBUG_AT( Core_Palette, "%s( %p )\n", __FUNCTION__, palette );

     D_MAGIC_ASSERT( palette, CorePalette );

     if (!palette->num_entries)
          return;

     for (i=0; i<palette->num_entries; i++) {
          palette->entries[i].a = i ? 0xff : 0x00;
          palette->entries[i].r = (i & 0x8) ? 0xff : 0x00;
          palette->entries[i].g = lookup2to8[ (i & 0x6) >> 1 ];
          palette->entries[i].b = (i & 0x1) ? 0xff : 0x00;

          palette->entries_yuv[i].a = palette->entries[i].a;

          RGB_TO_YCBCR( palette->entries[i].r, palette->entries[i].g, palette->entries[i].b,
                        palette->entries_yuv[i].y, palette->entries_yuv[i].u, palette->entries_yuv[i].v );
     }

     dfb_palette_update( palette, 0, palette->num_entries - 1 );
}
/*
 * Called by davinciSetState() to ensure that the color register is properly set
 * for execution of rendering functions.
 */
static inline void
davinci_validate_FILLCOLOR( DavinciDeviceData *ddev,
                            CardState         *state )
{
     switch (ddev->dst_format) {
          case DSPF_ARGB:
          case DSPF_RGB32:
               ddev->fillcolor = ddev->color_argb;
               break;

          case DSPF_RGB16:
               ddev->fillcolor = PIXEL_RGB16( state->color.r,
                                              state->color.g,
                                              state->color.b );

               ddev->fillcolor |= ddev->fillcolor << 16;
               break;

          case DSPF_UYVY: {
               int y, u, v;

               RGB_TO_YCBCR( state->color.r, state->color.g, state->color.b, y, u, v );

               ddev->fillcolor = PIXEL_UYVY( y, u, v );
               break;
          }

          default:
               D_BUG( "unexpected format %s", dfb_pixelformat_name(ddev->dst_format) );
               return;
     }

     D_DEBUG_AT( Davinci_2D, "  => FILLCOLOR: 0x%08lx\n", ddev->fillcolor );

     /* Set the flag. */
     DAVINCI_VALIDATE( FILLCOLOR );
}