Hello devels

I have managed to create my gfx driver and i am now at the stage where i experiment with the blit function. I want to implement the blit with alpha channel blend algorithm. My test code so far is:

bool sciensis_blit(
   void *drv_data,
   void *dev_data,
   DFBRectangle *rect,
   i32 dx,
   i32 dy
)
{
  u32 *dst, *src;
  u32 i, j;
  sciensis_drv_data *scdrv = (sciensis_drv_data *) drv_data;
  sciensis_dev_data *scdev = (sciensis_dev_data *) dev_data;

  /* Software blit/blend implementation */
  dst = scdev->dst_addr + dy * scdev->dst_pitch;
  dst += DFB_BYTES_PER_LINE(scdev->dst_fmt, dx);

  src = scdev->src_addr + rect->y * scdev->src_pitch;
  src += DFB_BYTES_PER_LINE(scdev->src_fmt, rect->x);

  while (rect->h--) {
     direct_memcpy(dst, src, rect->w * scdev->dst_bpp);

     dst += scdev->dst_pitch;
     src += scdev->src_pitch;
  }

  return true;
}


This works fine. But when i replace direct_memcpy with memcpy or any other way of manipulating surface data i get segfaults. That makes me understand that the surface data buffers are not linear but have some other format or data structure. I have seen some of the surface struct declaration code but i can't resolve this. This must be easy for you. Can you help?

Best regards
Tasos Parisinos at sciensis dot com

_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to