新手入门 
 
	- 积分
 - 17
 
        - 金钱
 - 17 
 
       - 注册时间
 - 2015-9-22
 
      - 在线时间
 - 105 小时
 
 
 
 | 
 
1金钱 
[mw_shl_code=c,true]//初始化智能画点 
//内部调用 
void ai_draw_init(void) 
{ 
float temp,temp1;         
temp=(float)picinfo.S_Width/picinfo.ImgWidth; 
temp1=(float)picinfo.S_Height/picinfo.ImgHeight;         
if(temp<temp1)temp1=temp;//取较小的那个         
if(temp1>1)temp1=1;         
//使图片处于所给区域的中间 
picinfo.S_XOFF+=(picinfo.S_Width-temp1*picinfo.ImgWidth)/2; 
picinfo.S_YOFF+=(picinfo.S_Height-temp1*picinfo.ImgHeight)/2; 
temp1*=8192;//扩大8192倍         
picinfo.Div_Fac=temp1; 
picinfo.staticx=0xffff; 
picinfo.staticy=0xffff;//放到一个不可能的值上面        [/mw_shl_code] 
STM32F407探索者开发板图片显示DEMO这段代码中,temp1*=8192;//扩大8192倍   为什么这里要扩大8192倍,是什么意思? 
 
而代码后面又接着除8192: 
[mw_shl_code=c,true]        //对于尺寸小于等于设定尺寸的图片,进行快速解码 
realy=(y*picinfo.Div_Fac)>>13;[/mw_shl_code] 
 
 |   
 
 
最佳答案
查看完整内容[请看2#楼] 
防止浮点运算,提高速度.8192是2的指数次幂,可以通过以为计算,进一步提高速度.说白了,就是为了提高速度. 
 
 
 
 
 
 
 |