Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dfbf1e3

Browse files
committed
Remove need for m_done flag in simlifier -- we can just put a path_stop onto the queue instead. Saves one boolean test on every iteration.
svn path=/trunk/matplotlib/; revision=6795
1 parent 7507477 commit dfbf1e3

1 file changed

Lines changed: 3 additions & 16 deletions

File tree

src/agg_py_path_iterator.h

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ class SimplifyPath
143143
m_origdx(0.0), m_origdy(0.0),
144144
m_origdNorm2(0.0), m_dnorm2Max(0.0), m_dnorm2Min(0.0),
145145
m_haveMin(false), m_lastMax(false), m_maxX(0.0), m_maxY(0.0),
146-
m_minX(0.0), m_minY(0.0), m_lastWrittenX(0.0), m_lastWrittenY(0.0),
147-
m_done(false)
146+
m_minX(0.0), m_minY(0.0), m_lastWrittenX(0.0), m_lastWrittenY(0.0)
148147
#if DEBUG_SIMPLIFY
149148
, m_pushed(0), m_skipped(0)
150149
#endif
@@ -202,17 +201,6 @@ class SimplifyPath
202201
return cmd;
203202
}
204203

205-
// If the queue is now empty, and the path was fully consumed
206-
// in the last call to the main loop, return agg::path_cmd_stop to
207-
// signal that there are no more points to emit.
208-
if (m_done)
209-
{
210-
#if DEBUG_SIMPLIFY
211-
printf(".\n");
212-
#endif
213-
return agg::path_cmd_stop;
214-
}
215-
216204
// The main simplification loop. The point is to consume only as many
217205
// points as necessary until something has been added to the outbound
218206
// queue, not to run through the entire path in one go. This
@@ -418,7 +406,7 @@ class SimplifyPath
418406
}
419407
queue_push(agg::path_cmd_line_to, m_maxX, m_maxY);
420408
}
421-
m_done = true;
409+
queue_push(agg::path_cmd_stop, 0.0, 0.0);
422410
}
423411

424412
// Return the first item in the queue, if any, otherwise
@@ -455,7 +443,7 @@ class SimplifyPath
455443
bool m_simplify;
456444
double m_width, m_height;
457445

458-
static const int m_queue_size = 7;
446+
static const int m_queue_size = 8;
459447
int m_queue_read;
460448
int m_queue_write;
461449
item m_queue[m_queue_size];
@@ -479,7 +467,6 @@ class SimplifyPath
479467
double m_minY;
480468
double m_lastWrittenX;
481469
double m_lastWrittenY;
482-
bool m_done;
483470

484471
#if DEBUG_SIMPLIFY
485472
unsigned m_pushed;

0 commit comments

Comments
 (0)