- 注册时间
- 2005-2-11
- 最后登录
- 1970-1-1
|
本人的汇编太差,写不出来。
哪位高手能将以下的代码用汇编写出来,谢谢了。
void cpoint(int xCenter,int yCenter,int x,int y,int type)
{Point(xCenter+x,yCenter+y,type);
Point(xCenter-x,yCenter+y,type);
Point(xCenter+x,yCenter-y,type);
Point(xCenter-x,yCenter-y,type);
Point(xCenter+y,yCenter+x,type);
Point(xCenter-y,yCenter+x,type);
Point(xCenter+y,yCenter-x,type);
Point(xCenter-y,yCenter-x,type);
}
void circle(int xCenter,int yCenter,int radius,int type)
{int x;
int p;
cpoint(xCenter,yCenter,0,radius,type);
x=0;p=1-radius;
while(x++<radius)
{if(p<0)p=p+(x<<1)+1;
else
{radius--;
p=p+((x-radius)<<1)+1;
}
cpoint(xCenter,yCenter,x,radius,type);
}
}
void epoint(int xCenter,int yCenter,int x,int y,int type)
{Point(xCenter+x,yCenter+y,type);
Point(xCenter-x,yCenter+y,type);
Point(xCenter+x,yCenter-y,type);
Point(xCenter-x,yCenter-y,type);
}
void ellispe(int xCenter,int yCenter,int Rx,int Ry,int type)
{int Rx2,Ry2;
int twoRx2,twoRy2;
long p;
int x,y;
long px,py;
x=0;px=0;
Rx2=Rx*Rx;Ry2=Ry*Ry;
twoRx2=Rx2<<1;twoRy2=Ry2<<1;
y=Ry;py=twoRx2*y;
epoint(xCenter,yCenter,x,y,type);
p=Ry2-Rx2*Ry+((Rx2+2)>>2);
while(px<py)
{x++;px=px+twoRy2;
if(p<0)p=p+Ry2+px;
else
{y--;
py=py-twoRx2;
p=p+Ry2+px-py;
}
epoint(xCenter,yCenter,x,y,type);
}
p=Ry2*x*x+Ry2*x+Rx2*(y-1)*(y-1)-Rx2*Ry2+((Ry2+2)>>2);
while(y-->0)
{py=py-twoRx2;
if(p>0)p=p+Rx2-py;
else{x++;px=px+twoRy2;p=p+Rx2-py+px;}
epoint(xCenter,yCenter,x,y,type);
}
} |
|