framebuffer问题
for (y = 100; y < 300; y++)for (x = 100; x < 300; x++) {
location = (x+vinfo.xoffset) * (vinfo.bits_per_pixel/8) +
(y+vinfo.yoffset) * finfo.line_length;
if (vinfo.bits_per_pixel == 32) {
*(fbp + location) = 100; // Some blue
*(fbp + location + 1) = 15+(x-100)/2; // A little green
*(fbp + location + 2) = 200-(y-100)/5; // A lot of red
*(fbp + location + 3) = 0; // No transparency
} else{ //assume 16bpp
int b = 10;
int g = (x-100)/6; // A little green
int r = 31-(y-100)/16; // A lot of red
unsigned short int t = r<<11 | g << 5 | b;
*((unsigned short int*)(fbp + location)) = t;
}
}
这个是网上遍地都是framebuffer的测试程序的一小段,想问一下location是什么,x,y又是什么,可见解析度xres,yres与虚拟解析度xres_virtual,yres_virtual都是什么,是什么关系。xres与xres_virtual,xoffset之间有公式关系吗? framebuffer的大概思想明白了,估计上面应该能看得明白。
x,y对应着屏幕上的坐标,而这些坐标与内存的地址又是一一对应的。
后面那些好像与屏幕特性有关了。
页:
[1]