@@ -270,38 +270,33 @@ void GlyphToType3::PSConvert(TTStreamWriter& stream)
270270 points.push_back (points.front ());
271271 }
272272
273- // For output, a vector is more convenient than a list.
274- std::vector<FlaggedPoint> points_v;
275- points_v.reserve (points.size ());
276- for (std::list<FlaggedPoint>::iterator it = points.begin ();
277- it != points.end ();
278- it++)
279- {
280- points_v.push_back (*it);
281- }
282-
283273 // The first point
284274 stack (stream, 3 );
285- PSMoveto (stream, points_v .front ().x , points_v .front ().y );
275+ PSMoveto (stream, points .front ().x , points .front ().y );
286276
287277 // Step through the remaining points
288- for (size_t p = 1 ; p < points_v.size (); )
278+ std::list<FlaggedPoint>::const_iterator it = points.begin ();
279+ for (it++; it != points.end (); /* incremented inside */ )
289280 {
290- const FlaggedPoint& point = points_v. at (p) ;
281+ const FlaggedPoint& point = *it ;
291282 if (point.flag == ON_PATH)
292283 {
293284 stack (stream, 3 );
294285 PSLineto (stream, point.x , point.y );
295- p ++;
286+ it ++;
296287 } else {
297- assert (points_v.at (p-1 ).flag == ON_PATH);
298- assert (points_v.at (p+1 ).flag == ON_PATH);
288+ std::list<FlaggedPoint>::const_iterator prev = it, next = it;
289+ prev--;
290+ next++;
291+ assert (prev->flag == ON_PATH);
292+ assert (next->flag == ON_PATH);
299293 stack (stream, 7 );
300294 PSCurveto (stream,
301- points_v. at (p- 1 ). x , points_v. at (p- 1 ). y ,
295+ prev-> x , prev-> y ,
302296 point.x , point.y ,
303- points_v.at (p+1 ).x , points_v.at (p+1 ).y );
304- p += 2 ;
297+ next->x , next->y );
298+ it++;
299+ it++;
305300 }
306301 }
307302
0 commit comments