Minor changes in Intertwines (add "m_" prefix to member variables)

This commit is contained in:
David Capello 2019-04-29 15:22:22 -03:00
parent 8b7b62b2d4
commit e3dcb2b818

View File

@ -66,19 +66,18 @@ class IntertwineAsLines : public Intertwine {
stroke->addPoint(newPoint); stroke->addPoint(newPoint);
} }
} }
Stroke lastPointPrinted; Stroke m_lastPointPrinted;
Stroke m_pts; Stroke m_pts;
void saveLastPointAndDoPointshape(ToolLoop* loop, const Stroke& stroke) { void saveLastPointAndDoPointshape(ToolLoop* loop, const Stroke& stroke) {
lastPointPrinted = stroke; m_lastPointPrinted = stroke;
doPointshapePoint(stroke[0].x, stroke[0].y, loop); doPointshapePoint(stroke[0].x, stroke[0].y, loop);
} }
public: public:
bool snapByAngle() override { return true; } bool snapByAngle() override { return true; }
void joinStroke(ToolLoop* loop, const Stroke& stroke) override void joinStroke(ToolLoop* loop, const Stroke& stroke) override {
{
if (stroke.size() == 0) if (stroke.size() == 0)
return; return;
@ -88,12 +87,12 @@ public:
} }
else if (stroke.size() >= 2) { else if (stroke.size() >= 2) {
if (stroke.size() == 2 && stroke[0] == stroke[1]) { if (stroke.size() == 2 && stroke[0] == stroke[1]) {
if (lastPointPrinted.empty()) { if (m_lastPointPrinted.empty()) {
saveLastPointAndDoPointshape(loop, stroke); saveLastPointAndDoPointshape(loop, stroke);
return; return;
} }
else { else {
if (lastPointPrinted[0] != stroke[0] || if (m_lastPointPrinted[0] != stroke[0] ||
loop->getTracePolicy() == TracePolicy::Last) { loop->getTracePolicy() == TracePolicy::Last) {
saveLastPointAndDoPointshape(loop, stroke); saveLastPointAndDoPointshape(loop, stroke);
return; return;
@ -116,8 +115,8 @@ public:
continue; continue;
doPointshapePoint(m_pts[c].x, m_pts[c].y, loop); doPointshapePoint(m_pts[c].x, m_pts[c].y, loop);
} }
ASSERT(!lastPointPrinted.empty()); ASSERT(!m_lastPointPrinted.empty());
lastPointPrinted[0] = m_pts[m_pts.size()-1]; m_lastPointPrinted[0] = m_pts[m_pts.size()-1];
} }
m_pts.reset(); m_pts.reset();
} }
@ -135,8 +134,7 @@ public:
} }
} }
void fillStroke(ToolLoop* loop, const Stroke& stroke) override void fillStroke(ToolLoop* loop, const Stroke& stroke) override {
{
if (stroke.size() < 3) { if (stroke.size() < 3) {
joinStroke(loop, stroke); joinStroke(loop, stroke);
return; return;
@ -157,8 +155,7 @@ public:
class IntertwineAsRectangles : public Intertwine { class IntertwineAsRectangles : public Intertwine {
public: public:
void joinStroke(ToolLoop* loop, const Stroke& stroke) override void joinStroke(ToolLoop* loop, const Stroke& stroke) override {
{
if (stroke.size() == 0) if (stroke.size() == 0)
return; return;
@ -367,8 +364,7 @@ public:
class IntertwineAsBezier : public Intertwine { class IntertwineAsBezier : public Intertwine {
public: public:
void joinStroke(ToolLoop* loop, const Stroke& stroke) override void joinStroke(ToolLoop* loop, const Stroke& stroke) override {
{
if (stroke.size() == 0) if (stroke.size() == 0)
return; return;
@ -397,8 +393,7 @@ public:
} }
} }
void fillStroke(ToolLoop* loop, const Stroke& stroke) override void fillStroke(ToolLoop* loop, const Stroke& stroke) override {
{
joinStroke(loop, stroke); joinStroke(loop, stroke);
} }
}; };
@ -416,7 +411,7 @@ class IntertwineAsPixelPerfect : public Intertwine {
// was executed inmediatelly after a "Last" trace policy (i.e. after the // was executed inmediatelly after a "Last" trace policy (i.e. after the
// user confirms a line draw while he is holding down the SHIFT key), so // user confirms a line draw while he is holding down the SHIFT key), so
// we have to ignore printing the first pixel of the line. // we have to ignore printing the first pixel of the line.
bool retainedTracePolicyLast = false; bool m_retainedTracePolicyLast = false;
Stroke m_pts; Stroke m_pts;
public: public:
@ -426,7 +421,7 @@ public:
void prepareIntertwine() override { void prepareIntertwine() override {
m_pts.reset(); m_pts.reset();
retainedTracePolicyLast = false; m_retainedTracePolicyLast = false;
} }
void joinStroke(ToolLoop* loop, const Stroke& stroke) override { void joinStroke(ToolLoop* loop, const Stroke& stroke) override {
@ -436,7 +431,7 @@ public:
// first stage on LineFreehand will draw a "star" like pattern // first stage on LineFreehand will draw a "star" like pattern
// with lines from the first point to the last point. // with lines from the first point to the last point.
if (loop->getTracePolicy() == TracePolicy::Last) { if (loop->getTracePolicy() == TracePolicy::Last) {
retainedTracePolicyLast = true; m_retainedTracePolicyLast = true;
m_pts.reset(); m_pts.reset();
} }
@ -475,7 +470,7 @@ public:
// a joinStroke pass with a retained "Last" trace policy // a joinStroke pass with a retained "Last" trace policy
// (i.e. the user confirms draw a line while he is holding // (i.e. the user confirms draw a line while he is holding
// the SHIFT key)) // the SHIFT key))
if (c == 0 && retainedTracePolicyLast) if (c == 0 && m_retainedTracePolicyLast)
continue; continue;
doPointshapePoint(m_pts[c].x, m_pts[c].y, loop); doPointshapePoint(m_pts[c].x, m_pts[c].y, loop);
} }