From 84ccd7f845bc9de2d86be04d3a57c5caab30571a Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Wed, 3 Feb 2010 18:27:04 +0000 Subject: [PATCH] Fixed polygon and polyform overdrawing the first point in an approximate way. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1300 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- main.c | 1 - operatio.c | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 75e0df92..4d99b0dc 100644 --- a/main.c +++ b/main.c @@ -835,7 +835,6 @@ void Program_shutdown(void) // Remove the safety backups, this is normal exit Delete_safety_backups(); - DEBUG("bye",1); // On libère le buffer de gestion de lignes free(Horizontal_line_buffer); diff --git a/operatio.c b/operatio.c index 6d8e1711..8f31f8f2 100644 --- a/operatio.c +++ b/operatio.c @@ -2025,8 +2025,14 @@ void Polygon_12_9(void) Operation_pop(&end_y); Operation_pop(&end_x); Paintbrush_shape=Paintbrush_shape_before_operation; - // Le pied aurait été de ne pas repasser sur le 1er point de la 1ère ligne - // mais c'est pas possible :( + + // Avoid overdrawing the first point + if(start_x < end_x) end_x--; + else if(start_x>end_x) end_x++; + + if(start_y < end_y) end_y--; + else if(start_y>end_y) end_y++; + Draw_line_permanent(start_x,start_y,end_x,end_y,color); Paintbrush_shape=PAINTBRUSH_SHAPE_POINT; @@ -2347,6 +2353,14 @@ void Polyform_12_8(void) // On efface la preview du segment annulé: Hide_line_preview(start_x,start_y,end_x,end_y); + // Avoid overdrawing the first point + if(start_x < initial_x) initial_x--; + else if(start_x>initial_x) initial_x++; + + if(start_y < initial_y) initial_y--; + else if(start_y>initial_y) initial_y++; + + // On affiche de façon définitive le bouclage du polygone: Draw_line_permanent(start_x,start_y,initial_x,initial_y,color);