comparison Renderer/test_render/fb.h @ 354:cfd20d609ace draft

add example/get_segment and change spe/DrawSpan.cpp
author koba
date Wed, 15 Jul 2009 17:39:51 +0900
parents 15bfacccde99
children
comparison
equal deleted inserted replaced
284:fbc78e36398b 354:cfd20d609ace
29 29
30 //int x , y ; 30 //int x , y ;
31 int xres,yres,vbpp,line_len; 31 int xres,yres,vbpp,line_len;
32 //unsigned short tcolor ; 32 //unsigned short tcolor ;
33 33
34 /* 読み書き用にファイルを開く */ 34 /* 茯炊吾<ゃ */
35 fd_framebuffer = open( DEVICE_NAME , O_RDWR); 35 fd_framebuffer = open( DEVICE_NAME , O_RDWR);
36 if ( !fd_framebuffer ) { 36 if ( !fd_framebuffer ) {
37 send_current_error_msg("Framebuffer device open error !"); 37 send_current_error_msg("Framebuffer device open error !");
38 exit(1); 38 exit(1);
39 } 39 }
40 send_current_information("The framebuffer device was opened !"); 40 send_current_information("The framebuffer device was opened !");
41 41
42 /* 固定スクリーン情報取得 */ 42 /* 阪鴻若恰怨緇 */
43 if ( ioctl( fd_framebuffer , FBIOGET_FSCREENINFO , &finfo ) ) { 43 if ( ioctl( fd_framebuffer , FBIOGET_FSCREENINFO , &finfo ) ) {
44 send_current_error_msg("Fixed information not gotton !"); 44 send_current_error_msg("Fixed information not gotton !");
45 exit(2); 45 exit(2);
46 } 46 }
47 47
48 /* 変動スクリーン情報取得 */ 48 /* 紊鴻若恰怨緇 */
49 if ( ioctl( fd_framebuffer , FBIOGET_VSCREENINFO , &vinfo ) ) { 49 if ( ioctl( fd_framebuffer , FBIOGET_VSCREENINFO , &vinfo ) ) {
50 send_current_error_msg("Variable information not gotton !"); 50 send_current_error_msg("Variable information not gotton !");
51 exit(3); 51 exit(3);
52 } 52 }
53 xres = vinfo.xres ; 53 xres = vinfo.xres ;
55 vbpp = vinfo.bits_per_pixel ; 55 vbpp = vinfo.bits_per_pixel ;
56 line_len = finfo.line_length ; 56 line_len = finfo.line_length ;
57 sprintf( tmp , "%d(pixel)x%d(line), %dbpp(bits per pixel)",xres,yres,vbpp); 57 sprintf( tmp , "%d(pixel)x%d(line), %dbpp(bits per pixel)",xres,yres,vbpp);
58 send_current_information( tmp ); 58 send_current_information( tmp );
59 59
60 /* バイト単位でのスクリーンのサイズを計算 */ 60 /* ゃ篏с鴻若潟泣ゃ冴荐膊 */
61 screensize = xres * yres * vbpp / DIV_BYTE ; 61 screensize = xres * yres * vbpp / DIV_BYTE ;
62 62
63 /* デバイスをメモリにマップする */ 63 /* ゃ鴻<≪ */
64 fbptr = (char *)mmap(0,screensize,PROT_READ | PROT_WRITE,MAP_SHARED,fd_framebuffer,0); 64 fbptr = (char *)mmap(0,screensize,PROT_READ | PROT_WRITE,MAP_SHARED,fd_framebuffer,0);
65 if ( (int)fbptr == -1 ) { 65 if ( (int)fbptr == -1 ) {
66 send_current_error_msg("Don't get framebuffer device to memory !"); 66 send_current_error_msg("Don't get framebuffer device to memory !");
67 exit(4); 67 exit(4);
68 } 68 }