Fix crash when rotating a tiny brush (bug from original version, was harmless in DOS due to lack of memory protection)

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@726 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-04-06 18:06:06 +00:00
parent 61e2487ec6
commit 15e11b7144

14
brush.c
View File

@ -1549,8 +1549,8 @@ void Compute_quad_texture(int x1,int y1,int xt1,int yt1,
temp=(float)(0.5+(float)x-ScanY_X[0][y])/(float)line_width; temp=(float)(0.5+(float)x-ScanY_X[0][y])/(float)line_width;
xt=Round((float)(ScanY_Xt[0][y])+(temp*(ScanY_Xt[1][y]-ScanY_Xt[0][y]))); xt=Round((float)(ScanY_Xt[0][y])+(temp*(ScanY_Xt[1][y]-ScanY_Xt[0][y])));
yt=Round((float)(ScanY_Yt[0][y])+(temp*(ScanY_Yt[1][y]-ScanY_Yt[0][y]))); yt=Round((float)(ScanY_Yt[0][y])+(temp*(ScanY_Yt[1][y]-ScanY_Yt[0][y])));
if (xt>=0 && yt>=0)
buffer[x+(y*width)]=Read_pixel_from_brush(xt,yt); buffer[x+(y*width)]=Read_pixel_from_brush(xt,yt);
} }
for (; x<width; x++) for (; x<width; x++)
buffer[x+(y*width)]=Back_color; buffer[x+(y*width)]=Back_color;
@ -1709,10 +1709,12 @@ void Draw_quad_texture_preview(int x1,int y1,int xt1,int yt1,
temp=(float)(0.5+(float)x-ScanY_X[0][y])/(float)width; temp=(float)(0.5+(float)x-ScanY_X[0][y])/(float)width;
xt=Round((float)(ScanY_Xt[0][y])+(temp*(ScanY_Xt[1][y]-ScanY_Xt[0][y]))); xt=Round((float)(ScanY_Xt[0][y])+(temp*(ScanY_Xt[1][y]-ScanY_Xt[0][y])));
yt=Round((float)(ScanY_Yt[0][y])+(temp*(ScanY_Yt[1][y]-ScanY_Yt[0][y]))); yt=Round((float)(ScanY_Yt[0][y])+(temp*(ScanY_Yt[1][y]-ScanY_Yt[0][y])));
if (xt>=0 && yt>=0)
color=Read_pixel_from_brush(xt,yt); {
if (color!=Back_color) color=Read_pixel_from_brush(xt,yt);
Pixel_preview(x,y_,color); if (color!=Back_color)
Pixel_preview(x,y_,color);
}
} }
} }