/*
 * ubicom32vfbUpdateRegion
 *	Called by the system to update the region to the panel
 */
static DFBResult
ubicom32vfbUpdateRegion( CoreLayer             *layer,
			 void                  *driver_data,
			 void                  *layer_data,
			 void                  *region_data,
			 CoreSurface           *surface,
			 const DFBRegion       *update,
			 CoreSurfaceBufferLock *lock )
{
	struct ubicom32vfb_driver_data *data = driver_data;
	DFBRectangle rect;

	D_DEBUG_AT(ubicom32vfb, "%s()\n", __FUNCTION__);

	dfb_rectangle_from_region(&rect, update);

	/*
	 * Check for full screen (at some point, it is better to update the whole
	 * screen, but for now we will just simply check the w/h against the xres/yres)
	 */
	if ((rect.w == data->panel->xres) && (rect.h == data->panel->yres)) {
		ubicom32vfb_lcd_update(data->panel, lock->addr);
	} else {
		ubicom32vfb_lcd_update_region(data->panel, lock->addr, rect.x, rect.y, rect.w, rect.h);
	}

	return DFB_OK;
}
示例#2
0
static DFBResult
omapUpdateRegion( CoreLayer             *layer,
                  void                  *driver_data,
                  void                  *layer_data,
                  void                  *region_data,
                  CoreSurface           *surface,
                  const DFBRegion       *update,
                  CoreSurfaceBufferLock *lock )
{
     FBDev *dfb_fbdev = dfb_system_data();
     struct omapfb_update_window window;
     DFBRectangle rect;

     dfb_rectangle_from_region( &rect, update );

     D_DEBUG_AT( omap, "Update rectangle %d %d %dx%d\n",
                 rect.x, rect.y, rect.w, rect.h );

     if (rect.x & 1)
          rect.w++;
     if (rect.y & 1)
          rect.h++;

     window.x = rect.x & ~1;
     window.y = rect.y & ~1;

     window.width  = (rect.w + 1) & ~1;
     window.height = (rect.h + 1) & ~1;

     window.out_x = window.x;
     window.out_y = window.y;

     window.out_width  = window.width;
     window.out_height = window.height;

     window.format = 0;

     D_DEBUG_AT( omap, "Update window %d %d %dx%d\n",
                 window.x, window.y, window.width, window.height );

     if (ioctl( dfb_fbdev->fd, OMAPFB_UPDATE_WINDOW, &window ))
          D_DEBUG_AT( omap, "Can't update window -> %s\n", strerror( errno ) );

     return DFB_OK;
}
示例#3
0
static void
root_update( StretRegion     *region,
             void            *region_data,
             void            *update_data,
             unsigned long    arg,
             int              x,
             int              y,
             const DFBRegion *updates,
             int              num )
{
     int              i;
     CoreWindowStack *stack;
     UniqueContext   *context = region_data;
     CardState       *state   = update_data;

     D_ASSERT( region != NULL );
     D_ASSERT( region_data != NULL );
     D_ASSERT( update_data != NULL );
     D_ASSERT( updates != NULL );

     D_ASSERT( x == 0 );
     D_ASSERT( y == 0 );

     D_MAGIC_ASSERT( context, UniqueContext );
     D_MAGIC_ASSERT( state, CardState );

     stack = context->stack;

     D_ASSERT( stack != NULL );
     D_ASSERT( stack->bg.image != NULL || (stack->bg.mode != DLBM_IMAGE &&
                                           stack->bg.mode != DLBM_TILE) );

     D_DEBUG_AT( UniQuE_Root, "root_update( region %p, num %d )\n", region, num );
#if D_DEBUG_ENABLED
     for (i=0; i<num; i++) {
          D_DEBUG_AT( UniQuE_Root, "    (%d)  %4d,%4d - %4dx%4d\n",
                      i, DFB_RECTANGLE_VALS_FROM_REGION( &updates[i] ) );
     }
#endif

     switch (stack->bg.mode) {
          case DLBM_COLOR: {
               CoreSurface *dest  = state->destination;
               DFBColor    *color = &stack->bg.color;
               DFBRectangle rects[num];

               /* Set the background color. */
               if (DFB_PIXELFORMAT_IS_INDEXED( dest->config.format ))
                    dfb_state_set_color_index( state,
                                               dfb_palette_search( dest->palette, color->r,
                                                                   color->g, color->b, color->a ) );
               else
                    dfb_state_set_color( state, color );

               for (i=0; i<num; i++)
                    dfb_rectangle_from_region( &rects[i], &updates[i] );

               /* Simply fill the background. */
               dfb_gfxcard_fillrectangles( rects, num, state );

               break;
          }

          case DLBM_IMAGE: {
               CoreSurface *bg = stack->bg.image;

               /* Set blitting source. */
               state->source    = bg;
               state->modified |= SMF_SOURCE;

               /* Set blitting flags. */
               dfb_state_set_blitting_flags( state, DSBLIT_NOFX );

               /* Check the size of the background image. */
               if (bg->config.size.w == stack->width && bg->config.size.h == stack->height) {
                    for (i=0; i<num; i++) {
                         DFBRectangle dst = DFB_RECTANGLE_INIT_FROM_REGION( &updates[i] );

                         /* Simple blit for 100% fitting background image. */
                         dfb_gfxcard_blit( &dst, dst.x, dst.y, state );
                    }
               }
               else {
                    DFBRegion clip = state->clip;

                    for (i=0; i<num; i++) {
                         DFBRectangle src = { 0, 0, bg->config.size.w, bg->config.size.h };
                         DFBRectangle dst = { 0, 0, stack->width, stack->height };

                         /* Change clipping region. */
                         dfb_state_set_clip( state, &updates[i] );

                         /* Stretch blit for non fitting background images. */
                         dfb_gfxcard_stretchblit( &src, &dst, state );
                    }

                    /* Restore clipping region. */
                    dfb_state_set_clip( state, &clip );
               }

               /* Reset blitting source. */
               state->source    = NULL;
               state->modified |= SMF_SOURCE;

               break;
          }

          case DLBM_TILE: {
               CoreSurface  *bg   = stack->bg.image;
               DFBRegion     clip = state->clip;

               /* Set blitting source. */
               state->source    = bg;
               state->modified |= SMF_SOURCE;

               /* Set blitting flags. */
               dfb_state_set_blitting_flags( state, DSBLIT_NOFX );

               for (i=0; i<num; i++) {
                    DFBRectangle src = { 0, 0, bg->config.size.w, bg->config.size.h };

                    /* Change clipping region. */
                    dfb_state_set_clip( state, &updates[i] );

                    /* Tiled blit (aligned). */
                    dfb_gfxcard_tileblit( &src, 0, 0, stack->width, stack->height, state );
               }

               /* Restore clipping region. */
               dfb_state_set_clip( state, &clip );

               /* Reset blitting source. */
               state->source    = NULL;
               state->modified |= SMF_SOURCE;

               break;
          }

          case DLBM_DONTCARE:
               break;

          default:
               D_BUG( "unknown background mode" );
               break;
     }
}
示例#4
0
void
dfb_clip_blit_flipped_rotated( const DFBRegion *clip,
                               DFBRectangle *srect, DFBRectangle *drect, DFBSurfaceBlittingFlags flags )
{

    DFBRegion dest    = DFB_REGION_INIT_FROM_RECTANGLE( drect );
    DFBRegion clipped = dest;

    D_ASSERT( !(flags & (DSBLIT_ROTATE270 | DSBLIT_ROTATE180)) );

    if (flags & DSBLIT_ROTATE90) {
        D_ASSERT( srect->w == drect->h );
        D_ASSERT( srect->h == drect->w );
    }
    else {
        D_ASSERT( srect->w == drect->w );
        D_ASSERT( srect->h == drect->h );
    }

    dfb_region_region_intersect( &clipped, clip );
    dfb_rectangle_from_region( drect, &clipped );

    switch (flags & (DSBLIT_FLIP_HORIZONTAL | DSBLIT_FLIP_VERTICAL | DSBLIT_ROTATE90)) {
    case DSBLIT_NOFX:
        srect->x += clipped.x1 - dest.x1;
        srect->y += clipped.y1 - dest.y1;
        break;
    case DSBLIT_FLIP_HORIZONTAL:
        srect->x += dest.x2 - clipped.x2;
        srect->y += clipped.y1 - dest.y1;
        break;
    case DSBLIT_FLIP_VERTICAL:
        srect->x += clipped.x1 - dest.x1;
        srect->y += dest.y2 - clipped.y2;
        break;
    case DSBLIT_ROTATE90:
        srect->x += dest.y2 - clipped.y2;
        srect->y += clipped.x1 - dest.x1;
        break;
    case (DSBLIT_FLIP_HORIZONTAL | DSBLIT_FLIP_VERTICAL): // ROTATE180
        srect->x += dest.x2 - clipped.x2;
        srect->y += dest.y2 - clipped.y2;
        break;
    case (DSBLIT_ROTATE90 | DSBLIT_FLIP_VERTICAL | DSBLIT_FLIP_HORIZONTAL): // ROTATE270
        srect->x += clipped.y1 - dest.y1;
        srect->y += dest.x2 - clipped.x2;
        break;
    case (DSBLIT_ROTATE90 | DSBLIT_FLIP_HORIZONTAL):
        srect->x += clipped.y1 - dest.y1;
        srect->y += clipped.x1 - dest.x1;
        break;
    case (DSBLIT_ROTATE90 | DSBLIT_FLIP_VERTICAL):
        srect->x += dest.y2 - clipped.y2;
        srect->y += dest.x2 - clipped.x2;
        break;
    }

    if (flags & DSBLIT_ROTATE90) {
        srect->w  = drect->h;
        srect->h  = drect->w;
    }
    else {
        srect->w = drect->w;
        srect->h = drect->h;
    }

    D_DEBUG_AT( Core_Clipping, "  => %4d,%4d-%4dx%4d -> %4d,%4d-%4dx%4d\n",
                DFB_RECTANGLE_VALS(srect), DFB_RECTANGLE_VALS(drect) );
}