Chinaunix

标题: framebuffer问题 [打印本页]

作者: embeddedlwp    时间: 2011-06-06 08:48
标题: framebuffer问题
  1. for (y = 100; y < 300; y++)
  2.          for (x = 100; x < 300; x++) {
  3.              location = (x+vinfo.xoffset) * (vinfo.bits_per_pixel/8) +
  4.                         (y+vinfo.yoffset) * finfo.line_length;

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




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2