From 1b3b6b985094e6f12751177490add3ad11dd91a9 Mon Sep 17 00:00:00 2001 From: Chlumsky Date: Fri, 9 Jul 2021 15:35:25 +0200 Subject: [PATCH] Very minor refactor --- core/shape-description.cpp | 61 ++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/core/shape-description.cpp b/core/shape-description.cpp index 9dd30a83..a096fa25 100644 --- a/core/shape-description.cpp +++ b/core/shape-description.cpp @@ -244,43 +244,34 @@ bool writeShapeDescription(FILE *output, const Shape &shape) { default:; } } - { - const LinearSegment *e = dynamic_cast(&**edge); - if (e) { - fprintf(output, "\t"); - writeCoord(output, e->p[0]); - fprintf(output, ";\n"); - if (colorCode) - fprintf(output, "\t\t%c;\n", colorCode); - } + if (const LinearSegment *e = dynamic_cast(&**edge)) { + fprintf(output, "\t"); + writeCoord(output, e->p[0]); + fprintf(output, ";\n"); + if (colorCode) + fprintf(output, "\t\t%c;\n", colorCode); } - { - const QuadraticSegment *e = dynamic_cast(&**edge); - if (e) { - fprintf(output, "\t"); - writeCoord(output, e->p[0]); - fprintf(output, ";\n\t\t"); - if (colorCode) - fprintf(output, "%c", colorCode); - fprintf(output, "("); - writeCoord(output, e->p[1]); - fprintf(output, ");\n"); - } + if (const QuadraticSegment *e = dynamic_cast(&**edge)) { + fprintf(output, "\t"); + writeCoord(output, e->p[0]); + fprintf(output, ";\n\t\t"); + if (colorCode) + fprintf(output, "%c", colorCode); + fprintf(output, "("); + writeCoord(output, e->p[1]); + fprintf(output, ");\n"); } - { - const CubicSegment *e = dynamic_cast(&**edge); - if (e) { - fprintf(output, "\t"); - writeCoord(output, e->p[0]); - fprintf(output, ";\n\t\t"); - if (colorCode) - fprintf(output, "%c", colorCode); - fprintf(output, "("); - writeCoord(output, e->p[1]); - fprintf(output, "; "); - writeCoord(output, e->p[2]); - fprintf(output, ");\n"); - } + if (const CubicSegment *e = dynamic_cast(&**edge)) { + fprintf(output, "\t"); + writeCoord(output, e->p[0]); + fprintf(output, ";\n\t\t"); + if (colorCode) + fprintf(output, "%c", colorCode); + fprintf(output, "("); + writeCoord(output, e->p[1]); + fprintf(output, "; "); + writeCoord(output, e->p[2]); + fprintf(output, ");\n"); } } fprintf(output, "\t#\n");