From 72c42b92ce2ce3497b5f0fae465ba96b80a6d23e Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 28 Oct 2008 09:59:58 +0000 Subject: [PATCH] fixed crash when drawing a vertical gradiation or a single-point (nonsense) gradiation. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@315 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- graph.c | 53 ++++++++++++++++++++++++++++++----------------------- op_c.c | 19 +++++-------------- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/graph.c b/graph.c index 17275f9d..c67e2e7e 100644 --- a/graph.c +++ b/graph.c @@ -5209,42 +5209,49 @@ void Tracer_rectangle_degrade(short RAX,short RAY,short RBX,short RBY,short VAX, RAY = Pos_Y; } - Degrade_Intervalle_total = sqrt(pow(VBY - VAY,2)+pow(VBX - VAX,2)); - - short a = (VBY - VAY)/(VBX - VAX); - short b = VAY - a*VAX; - int Distance_X, Distance_Y; - - DEBUG("inttotal",Degrade_Intervalle_total); - - for (Pos_Y=RAY;Pos_Ytable[indice]=i; } -#ifdef OPTIMISATIONS_ASSEMBLEUR - -void TO_Compter_occurences(Table_occurence * t,Bitmap24B image,int taille) -{ - OPASM_Compter_occurences(t->table,image,taille, - t->red_r,t->red_v,t->red_b, - t->nbb_v,t->nbb_b); -} - -#else - void TO_Inc(Table_occurence * t,int r,int v,int b) { int indice; @@ -290,8 +279,6 @@ void TO_Compter_occurences(Table_occurence * t,Bitmap24B image,int taille) TO_Inc(t,ptr->R,ptr->V,ptr->B); } -#endif - int TO_Compter_couleurs(Table_occurence * t) { int val; // Valeur de retour @@ -1174,6 +1161,7 @@ void Convert_bitmap_24B_to_256_Floyd_Steinberg(Bitmap256 Dest,Bitmap24B Source,i D++; } } + } #endif @@ -1181,7 +1169,10 @@ void Convert_bitmap_24B_to_256_Floyd_Steinberg(Bitmap256 Dest,Bitmap24B Source,i static const byte precision_24b[]= -{6,6,5, +{ + 8,8,8, + 6,6,6, + 6,6,5, 5,6,5, 5,5,5, 5,5,4,