struct fb_fix_screeninfo 该结构体保存的是关于屏幕固定的参数
struct fb_var_screeninfo 该结构体保存的是关于屏幕变化的参数,需要获取frame buffer之前,这个结构体需要更新。
fb_var_screeninfo 的参数介绍
xres 可见矩形的width
yres 可见矩形的height
xres_virtual
yres_virtual
xoffset
yoffset
void copyFromFrameBuffer() { kesyPrintf("copyFromFrameBuffer\n"); update_fb_info(); char* vfd = (char*)readBufferFB(); void const* base = 0; int bytespp = 4; size_t offset = fscrinfo.line_length * scrinfo.yoffset + (scrinfo.xoffset) * bytespp; base = (void const *)((char const *)vfd + offset); int w = scrinfo.xres; int h = scrinfo.yres; int s = scrinfo.xres_virtual; kesyPrintf("w=%d,h=%d,s=%d\n", w, h, s); int y = 0; for (y=0 ; y<h ; y++) { memcpy(gNewBuf + y*w*bytespp, base, w*bytespp); base = (void *)((char *)base + fscrinfo.line_length); } }
原文:http://my.oschina.net/u/1445604/blog/492172