From 170b1ddc7931781a70758dc2d206bfdbad6fb3f5 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 15 Jun 2011 15:46:22 +0200 Subject: [PATCH] Speed up distance field generation by another 20% or so. --- src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp b/src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp index c1a46cb..31e654b 100644 --- a/src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp +++ b/src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp @@ -344,10 +344,8 @@ static QImage makeDistanceField(int imgSize, const QPainterPath &path, int dfSca bool isShortData = polys.indices.type() == QVertexIndexVector::UnsignedShort; const void *indices = polys.indices.data(); int index = 0; - QVector normals; - QVector vertices; - normals.reserve(polys.vertices.count()); - vertices.reserve(polys.vertices.count()); + QVarLengthArray normals(polys.vertices.count()); + QVarLengthArray vertices(polys.vertices.count()); while (index < polys.indices.size()) { normals.clear(); @@ -386,7 +384,7 @@ static QImage makeDistanceField(int imgSize, const QPainterPath &path, int dfSca vertices.append(v); } - QVector isConvex(normals.count()); + QVarLengthArray isConvex(normals.count()); for (int next = 0, prev = normals.count() - 1; next < normals.count(); prev = next++) isConvex[prev] = (normals.at(prev).x * normals.at(next).y - normals.at(prev).y * normals.at(next).x > 0); -- 2.7.4