From 48979bf251d55675a719e363aa4aede0d1688e5b Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 15 Nov 2008 18:33:27 +0000 Subject: [PATCH] Fixed the last bug remaining in the gradiation rectangle. Again caused by loss of precision by not using floats :) git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@346 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- gfx2.cfg | Bin 10062 -> 10062 bytes graph.c | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gfx2.cfg b/gfx2.cfg index 5b2e6af494ed670070a58986ffa25d104df2bd8a..11a609472f23e343d362a103acaa1ef00520242b 100644 GIT binary patch delta 19 acmX@-cg}A^wknf?{^UUAL!0&0o5f1OSbX2tWV; diff --git a/graph.c b/graph.c index 8ca9b036..227293e8 100644 --- a/graph.c +++ b/graph.c @@ -5262,7 +5262,7 @@ void Tracer_rectangle_degrade(short RAX,short RAY,short RBX,short RBY,short VAX, { float a; float b; - int Distance_X, Distance_Y; + float Distance_X, Distance_Y; Degrade_Intervalle_total = sqrt(pow(VBY - VAY,2)+pow(VBX - VAX,2)); a = (float)(VBY - VAY)/(float)(VBX - VAX); @@ -5272,10 +5272,10 @@ void Tracer_rectangle_degrade(short RAX,short RAY,short RBX,short RBY,short VAX, for (Pos_X = RAX;Pos_X<=RBX;Pos_X++) { // On calcule ou on en est dans le dégradé - Distance_X = pow((int)(Pos_Y - VAY),2)+pow((int)(Pos_X - VAX),2); - Distance_Y = pow((int)(-a * Pos_X + Pos_Y - b),2)/(a*a+1); + Distance_X = pow((Pos_Y - VAY),2)+pow((Pos_X - VAX),2); + Distance_Y = pow((-a * Pos_X + Pos_Y - b),2)/(a*a+1); - Traiter_degrade(sqrt(Distance_X - Distance_Y),Pos_X,Pos_Y); + Traiter_degrade((int)sqrt(Distance_X - Distance_Y),Pos_X,Pos_Y); } } Mettre_Ecran_A_Jour(RAX,RAY,RBX,RBY);