OpenToonz - An open-source full-featured 2D animation creation software
C
#assistants: fix line width for mac
Ivan Mahonine48ceda784e3
diff --git a/toonz/sources/common/tgl/tgl.cpp b/toonz/sources/common/tgl/tgl.cppindex c63fca7d2..bbe68cb61 100644--- a/toonz/sources/common/tgl/tgl.cpp+++ b/toonz/sources/common/tgl/tgl.cpp@@ -136,56 +136,25 @@ void tglDrawSegment(const TPointD &p1, const TPointD &p2) {void tglDrawCircle(const TPointD ¢er, double radius) {if (radius <= 0) return;- double pixelSize = 1;- int slices = 60;-- if (slices <= 0) slices = computeSlices(radius, pixelSize) >> 1;-- double step = M_PI / slices;- double step2 = 2.0 * step;+ double pixelSize = sqrt( tglGetPixelSize2() );+ int slices = std::max(3, computeSlices(radius, pixelSize));- double cos_t, sin_t, cos_ts, sin_ts, t;+ double step = M_2PI / (double)slices;+ double c = cos(step), s = sin(step);glPushMatrix();glTranslated(center.x, center.y, 0.0);- glBegin(GL_LINES);-- cos_t = radius /* *1.0*/;- sin_t = 0.0;- for (t = 0; t + step < M_PI_2; t += step2) {- cos_ts = radius * cos(t + step);- sin_ts = radius * sin(t + step);-- glVertex2f(cos_t, sin_t);- glVertex2f(cos_ts, sin_ts);-- glVertex2f(-cos_t, sin_t);- glVertex2f(-cos_ts, sin_ts);-- glVertex2f(-cos_t, -sin_t);- glVertex2f(-cos_ts, -sin_ts);-- glVertex2f(cos_t, -sin_t);- glVertex2f(cos_ts, -sin_ts);-- cos_t = cos_ts;- sin_t = sin_ts;+ glBegin(GL_LINE_STRIP);++ double x = radius, y = 0.0;+ glVertex2d(x, y);+ for(int i = slices - 1; i; --i) {+ double xx = x;+ x = c*xx - s*y;+ y = s*xx + c*y;+ glVertex2d(x, y);}-- cos_ts = 0.0;- sin_ts = radius /* *1.0*/;-- glVertex2f(cos_t, sin_t);- glVertex2f(cos_ts, sin_ts);-- glVertex2f(-cos_t, sin_t);- glVertex2f(-cos_ts, sin_ts);-- glVertex2f(-cos_t, -sin_t);- glVertex2f(-cos_ts, -sin_ts);-- glVertex2f(cos_t, -sin_t);- glVertex2f(cos_ts, -sin_ts);+ glVertex2d(radius, 0.0);glEnd();glPopMatrix();diff --git a/toonz/sources/tnztools/assistant.cpp b/toonz/sources/tnztools/assistant.cppindex ab3fdff22..68aa2b0c0 100644--- a/toonz/sources/tnztools/assistant.cpp+++ b/toonz/sources/tnztools/assistant.cpp@@ -7,6 +7,11 @@#include <limits>#include <cassert>+#ifdef MACOSX+const double line_width_scale = 1.5;+#else+const double line_width_scale = 1.0;+#endif//************************************************************************// TGuideline implementation@@ -30,11 +35,11 @@ TGuideline::drawSegment(glPushAttrib(GL_ALL_ATTRIB_BITS);tglEnableBlending();- tglEnableLineSmooth(true, 1.0);+ tglEnableLineSmooth(true, 1.0 * line_width_scale);TPointD d = p1 - p0;double k = norm2(d);if (k > TConsts::epsilon*TConsts::epsilon) {- k = 0.5*pixelSize/sqrt(k);+ k = 0.5*pixelSize*line_width_scale/sqrt(k);d = TPointD(-k*d.y, k*d.x);glColor4dv(colorWhite);tglDrawSegment(p0 - d, p1 - d);@@ -110,7 +115,7 @@ TAssistantPoint::TAssistantPoint(const TStringId &name, const TPointD &defPositiname(name),defPosition(defPosition),type(Circle),- position(position),+ position(defPosition),radius(10.0),visible(true),selected() { }@@ -406,11 +411,11 @@ TAssistant::drawSegment(const TPointD &p0, const TPointD &p1, double pixelSize,glPushAttrib(GL_ALL_ATTRIB_BITS);tglEnableBlending();- tglEnableLineSmooth(true, 0.5);+ tglEnableLineSmooth(true, 1.0 * line_width_scale);TPointD d = p1 - p0;double k = norm2(d);if (k > TConsts::epsilon*TConsts::epsilon) {- k = 0.5*pixelSize/sqrt(k);+ k = 0.5*pixelSize*line_width_scale/sqrt(k);d = TPointD(-k*d.y, k*d.x);glColor4dv(colorWhite);tglDrawSegment(p0 - d, p1 - d);@@ -458,7 +463,7 @@ TAssistant::drawPoint(const TAssistantPoint &point, double pixelSize) const {double colorBlack[4] = { 0.0, 0.0, 0.0, alpha };double colorGray[4] = { 0.5, 0.5, 0.5, alpha };double colorWhite[4] = { 1.0, 1.0, 1.0, alpha };- double width = 0.5;+ double width = 1.5;if (point.selected) {colorBlack[2] = 1.0;@@ -481,16 +486,16 @@ TAssistant::drawPoint(const TAssistantPoint &point, double pixelSize) const {TPointD gridDy(0.0, pixelSize*radius);// back line- tglEnableLineSmooth(true, 2.0*std::max(1.0, width));+ tglEnableLineSmooth(true, 2.0*width*line_width_scale);glColor4dv(colorWhite);if (point.type == TAssistantPoint::CircleCross) {tglDrawSegment(point.position - crossDx, point.position + crossDx);tglDrawSegment(point.position - crossDy, point.position + crossDy);- } else+ }tglDrawCircle(point.position, radius*pixelSize);// front line- glLineWidth(width);+ glLineWidth(width * line_width_scale);glColor4dv(colorBlack);if (point.type == TAssistantPoint::CircleCross) {tglDrawSegment(point.position - crossDx, point.position + crossDx);