linux 函数疑问
int save_mem(unsigned char *hDC, RECT rc) //
{
pthread_mutex_lock(&draw_mt);
if (NULL == hDC)
{
pthread_mutex_unlock(&draw_mt);
return -1;
}
int y = 0;
long location = 0;
long size = (rc.x2-rc.x1) * (fbdev.fb_bpp / 8);
for (y=rc.y1; y<rc.y2; y++)
{
location = rc.x1 * (fbdev.fb_bpp / 8) + y * fb_finfo.line_length;
memcpy(hDC+location,fbdev.fb_mem+location,size);
}
pthread_mutex_unlock(&draw_mt);
return 0;
}
注:typedef struct rect_ //矩形
{
USHORT x1,
y1,
x2,
y2;
}RECT;
求大神指点:
1.这段代码的意思,详细点
2.这是什么内容的代码 是帧缓冲器吗?
[解决办法]
就是输出这个矩形。
bpp就是bits per pixel
size就是矩形x1到x2一行的字节数
fb_finfo.line_length 是每一行的长度
location计算的事每行的开始地址
http://blog.csdn.net/godspirits/article/details/4031748