bool
davinciStretchBlit32( void *drv, void *dev, DFBRectangle *srect, DFBRectangle *drect )
{
     DavinciDriverData *ddrv = drv;
     DavinciDeviceData *ddev = dev;

     DFBRegion clip = DFB_REGION_INIT_FROM_RECTANGLE( drect );

     D_DEBUG_AT( Davinci_2D, "%s( %4d,%4d-%4dx%4d <- %4d,%4d-%4dx%4d )\n",
                 __FUNCTION__, DFB_RECTANGLE_VALS(drect), DFB_RECTANGLE_VALS(srect) );

     if (!dfb_region_region_intersect( &clip, &ddev->clip ))
          return true;

     dfb_region_translate( &clip, -drect->x, -drect->y );

     davinci_c64x_stretch_32__L( &ddrv->tasks,
                                 ddev->dst_phys + ddev->dst_pitch * drect->y + ddev->dst_bpp * drect->x,
                                 ddev->dst_pitch,
                                 ddev->src_phys + ddev->src_pitch * srect->y + ddev->src_bpp * srect->x,
                                 ddev->src_pitch,
                                 drect->w, drect->h,
                                 srect->w, srect->h,
                                 &clip );

     return true;
}
Exemple #2
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) );
}