Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1bade3b

Browse filesBrowse files
committed
Do output directly from list
Having the prev and next iterators is not much worse than indexing the vector, and initializing the vector became too verbose.
1 parent ae96cad commit 1bade3b
Copy full SHA for 1bade3b

File tree

Expand file treeCollapse file tree

1 file changed

+14
-19
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-19
lines changed

‎ttconv/pprdrv_tt2.cpp

Copy file name to clipboardExpand all lines: ttconv/pprdrv_tt2.cpp
+14-19Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.