diff options
author | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-06-15 15:46:22 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-06-15 15:46:22 +0200 |
commit | 170b1ddc7931781a70758dc2d206bfdbad6fb3f5 (patch) | |
tree | f850f2193e4760dc70ecd48c1ae7c4b998c31989 | |
parent | 1eefe7d4a2108fe6ecce3714cedb809fc6101e97 (diff) |
Speed up distance field generation by another 20% or so.
-rw-r--r-- | src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp b/src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp index c1a46cb8f9..31e654b0b9 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<DFPoint> normals; - QVector<DFVertex> vertices; - normals.reserve(polys.vertices.count()); - vertices.reserve(polys.vertices.count()); + QVarLengthArray<DFPoint> normals(polys.vertices.count()); + QVarLengthArray<DFVertex> 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<bool> isConvex(normals.count()); + QVarLengthArray<bool> 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); |