@@ -270,38 +270,33 @@ void GlyphToType3::PSConvert(TTStreamWriter& stream)
270
270
points.push_back (points.front ());
271
271
}
272
272
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
-
283
273
// The first point
284
274
stack (stream, 3 );
285
- PSMoveto (stream, points_v .front ().x , points_v .front ().y );
275
+ PSMoveto (stream, points .front ().x , points .front ().y );
286
276
287
277
// 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 */ )
289
280
{
290
- const FlaggedPoint& point = points_v. at (p) ;
281
+ const FlaggedPoint& point = *it ;
291
282
if (point.flag == ON_PATH)
292
283
{
293
284
stack (stream, 3 );
294
285
PSLineto (stream, point.x , point.y );
295
- p ++;
286
+ it ++;
296
287
} 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);
299
293
stack (stream, 7 );
300
294
PSCurveto (stream,
301
- points_v. at (p- 1 ). x , points_v. at (p- 1 ). y ,
295
+ prev-> x , prev-> y ,
302
296
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++;
305
300
}
306
301
}
307
302
0 commit comments