From 1eefe7d4a2108fe6ecce3714cedb809fc6101e97 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 15 Jun 2011 15:02:58 +0200 Subject: Speed up distance field generation by 5-20% --- src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/declarative/scenegraph') diff --git a/src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp b/src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp index 50c946a849..c1a46cb8f9 100644 --- a/src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp +++ b/src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp @@ -473,11 +473,14 @@ static void convert_to_Format_Alpha(QImage *image) const int width = image->width(); const int height = image->height(); uchar *data = image->bits(); + const uint *src = (const uint *) data; + int stride = image->bytesPerLine() / sizeof(uint); for (int i = 0; i < height; ++i) { uchar *o = data + i * width; for (int x = 0; x < width; ++x) - o[x] = (uchar)qAlpha(image->pixel(x, i)); + o[x] = (uchar)qAlpha(src[x]); + src += stride; } } -- cgit v1.2.3