Exemple #1
0
static uint32_t svga_draw_image(mp_image_t *mpi){
int i,x,y,w,h;
int stride;
uint8_t *rgbplane, *base;
int bytesperline;
int page;

  if(mpi->flags & MP_IMGFLAG_DIRECT){
    if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
      mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: drawing direct rendered surface\n");
    cpage=(uint32_t)mpi->priv;
    assert((cpage>=0)&&(cpage<max_pages));
    return VO_TRUE; //it's already done
  }
//  if (mpi->flags&MP_IMGFLAGS_DRAWBACK) 
//  return VO_TRUE;//direct render method 2

//find a free page to draw into
//if there is no one then use the current one
  page = page_find_free();
  if(page>=0) cpage=page;
  PageStore[cpage].locks=PAGE_BUSY;

// these variables are used in loops  
  x = mpi->x;
  y = mpi->y;
  w = mpi->w;
  h = mpi->h;
  stride = mpi->stride[0]; 
  rgbplane = mpi->planes[0] + y*stride + (x*mpi->bpp)/8;
  x+=x_pos;//center
  y+=y_pos;
  
  if(mpi->bpp >= 8){//for modes<8 use only native
    if( (mode_capabilities&CAP_ACCEL_PUTIMAGE) && (x==0) && (w==mpi->width) &&
        (stride == mode_stride) ){ //only monolite image can be accelerated
      w=(stride*8)/mpi->bpp;//we transfer pixels in the stride so the source
//ACCELERATE
      if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
        mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: using HW PutImage (x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h);
      if(mode_capabilities & CAP_ACCEL_BACKGR)
        vga_accel(ACCEL_SYNC);

      vga_accel(ACCEL_PUTIMAGE,x,y+PageStore[cpage].yoffset,w,h,rgbplane);
      return VO_TRUE;
    }
  
    if( mode_capabilities&CAP_LINEAR){
//DIRECT  
      if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
        mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: using Direct memcpy (x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h);
      bytesperline=(w*mpi->bpp)/8;
      base=PageStore[cpage].vbase + (y*mode_stride) + (x*mpi->bpp)/8;     

      for(i=0;i<h;i++){
        mem2agpcpy(base,rgbplane,bytesperline);
        base+=mode_stride;
        rgbplane+=stride;
      }
      return VO_TRUE;
    }  
  }//(modebpp>=8
  

//NATIVE
  {
  int length;
    length=(w*mpi->bpp)/8;
  //one byte per pixel! svgalib innovation
    if(mpi->imgfmt==IMGFMT_RG4B || mpi->imgfmt==IMGFMT_BG4B) length=w;
  
    if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
      mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: using Native vga_draw(x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h);
    y+=PageStore[cpage].yoffset;//y position of the page beggining
    for(i=0;i<h;i++){
      vga_drawscansegment(rgbplane,x,y+i,length);
      rgbplane+=stride;
    }
  }
  return VO_TRUE;
}
Exemple #2
0
static int draw_frame(uint8_t *src[])
{
    mem2agpcpy(inpage, src[0], in_width * in_depth * in_height);
    return 0;
}