From e19a2f4f3570dc3c2c9b5395ccbb7f335a270f83 Mon Sep 17 00:00:00 2001 From: EvilSpirit Date: Fri, 25 Mar 2016 14:05:50 +0600 Subject: [PATCH] Accept maybeFat in ssglStippledLine. --- src/drawentity.cpp | 2 +- src/glhelper.cpp | 20 ++++++++++---------- src/solvespace.h | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/drawentity.cpp b/src/drawentity.cpp index ef2f72c..45834a0 100644 --- a/src/drawentity.cpp +++ b/src/drawentity.cpp @@ -23,7 +23,7 @@ void Entity::LineDrawOrGetDistance(Vector a, Vector b, bool maybeFat) { ssglDepthRangeOffset((group.v == SS.GW.activeGroup.v) ? 4 : 3); // Narrow lines are drawn as lines, but fat lines must be drawn as // filled polygons, to get the line join style right. - ssglStippledLine(a, b, dogd.lineWidth, dogd.stippleType, dogd.stippleScale); + ssglStippledLine(a, b, dogd.lineWidth, dogd.stippleType, dogd.stippleScale, maybeFat); ssglDepthRangeOffset(0); } else { Point2d ap = SS.GW.ProjectPoint(a); diff --git a/src/glhelper.cpp b/src/glhelper.cpp index 29f6b89..8e68772 100644 --- a/src/glhelper.cpp +++ b/src/glhelper.cpp @@ -200,7 +200,7 @@ static void FatLineEndcap(Vector p, Vector u, Vector v) glEnd(); } -void ssglLine(const Vector &a, const Vector &b, double pixelWidth, bool maybeFat = true) { +void ssglLine(const Vector &a, const Vector &b, double pixelWidth, bool maybeFat) { if(!maybeFat || pixelWidth < 3.0) { glBegin(GL_LINES); ssglVertex3v(a); @@ -229,11 +229,11 @@ void ssglPoint(Vector p, double pixelSize) } void ssglStippledLine(Vector a, Vector b, double width, - int stippleType, double stippleScale) + int stippleType, double stippleScale, bool maybeFat) { const char *stipplePattern; switch(stippleType) { - case Style::STIPPLE_CONTINUOUS: ssglLine(a, b, width); return; + case Style::STIPPLE_CONTINUOUS: ssglLine(a, b, width, maybeFat); return; case Style::STIPPLE_DASH: stipplePattern = "- "; break; case Style::STIPPLE_LONG_DASH: stipplePattern = "_ "; break; case Style::STIPPLE_DASH_DOT: stipplePattern = "-."; break; @@ -243,11 +243,11 @@ void ssglStippledLine(Vector a, Vector b, double width, case Style::STIPPLE_ZIGZAG: stipplePattern = "~__"; break; default: oops(); } - ssglStippledLine(a, b, width, stipplePattern, stippleScale); + ssglStippledLine(a, b, width, stipplePattern, stippleScale, maybeFat); } void ssglStippledLine(Vector a, Vector b, double width, - const char *stipplePattern, double stippleScale) + const char *stipplePattern, double stippleScale, bool maybeFat) { if(stipplePattern == NULL || *stipplePattern == 0) oops(); @@ -269,13 +269,13 @@ void ssglStippledLine(Vector a, Vector b, double width, start = max(start - 0.5 * ss, 0.0); end = max(start - 2.0 * ss, 0.0); if(start == end) break; - ssglLine(a.Plus(dir.ScaledBy(start)), a.Plus(dir.ScaledBy(end)), width); + ssglLine(a.Plus(dir.ScaledBy(start)), a.Plus(dir.ScaledBy(end)), width, maybeFat); end = max(end - 0.5 * ss, 0.0); break; case '_': end = max(end - 4.0 * ss, 0.0); - ssglLine(a.Plus(dir.ScaledBy(start)), a.Plus(dir.ScaledBy(end)), width); + ssglLine(a.Plus(dir.ScaledBy(start)), a.Plus(dir.ScaledBy(end)), width, maybeFat); break; case '.': @@ -296,7 +296,7 @@ void ssglStippledLine(Vector a, Vector b, double width, Vector aa = a.Plus(dir.ScaledBy(start)); Vector bb = a.Plus(dir.ScaledBy(end)) .Plus(abn.ScaledBy(pws * (start - end) / (0.5 * ss))); - ssglLine(aa, bb, width); + ssglLine(aa, bb, width, maybeFat); if(end == 0.0) break; start = end; @@ -304,7 +304,7 @@ void ssglStippledLine(Vector a, Vector b, double width, aa = a.Plus(dir.ScaledBy(end)) .Plus(abn.ScaledBy(pws)) .Minus(abn.ScaledBy(2.0 * pws * (start - end) / ss)); - ssglLine(bb, aa, width); + ssglLine(bb, aa, width, maybeFat); if(end == 0.0) break; start = end; @@ -312,7 +312,7 @@ void ssglStippledLine(Vector a, Vector b, double width, bb = a.Plus(dir.ScaledBy(end)) .Minus(abn.ScaledBy(pws)) .Plus(abn.ScaledBy(pws * (start - end) / (0.5 * ss))); - ssglLine(aa, bb, width); + ssglLine(aa, bb, width, maybeFat); break; } diff --git a/src/solvespace.h b/src/solvespace.h index fbcc9b8..a6d4523 100644 --- a/src/solvespace.h +++ b/src/solvespace.h @@ -357,9 +357,9 @@ double ssglStrWidth(const std::string &str, double h); double ssglStrHeight(double h); void ssglLockColorTo(RgbaColor rgb); void ssglStippledLine(Vector a, Vector b, double width, - int stippleType, double stippleScale); + int stippleType, double stippleScale, bool maybeFat); void ssglStippledLine(Vector a, Vector b, double width, - const char *stipplePattern, double stippleScale); + const char *stipplePattern, double stippleScale, bool maybeFat); void ssglFatLine(Vector a, Vector b, double width); void ssglUnlockColor(void); void ssglColorRGB(RgbaColor rgb);