Slightly reduce distance-field texture creation (and resizing) time.
authorYoann Lopes <yoann.lopes@nokia.com>
Wed, 24 Aug 2011 09:48:57 +0000 (11:48 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 24 Aug 2011 13:15:46 +0000 (15:15 +0200)
Pass a null pointer to glTexImage2D instead of a zero-filled array.

Change-Id: I8428b26a83a3f88ad2ee07e56e5cdb09ee5de68a
Reviewed-on: http://codereview.qt.nokia.com/3492
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp

index 73a2d2a..ff4913a 100644 (file)
@@ -1053,10 +1053,7 @@ void QSGDistanceFieldGlyphCache::createTexture(int width, int height)
     glGenTextures(1, &m_textureData->texture);
     glBindTexture(GL_TEXTURE_2D, m_textureData->texture);
 
-    QVarLengthArray<uchar> data(width * height);
-    for (int i = 0; i < data.size(); ++i)
-        data[i] = 0;
-    glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]);
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0);
     glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
     glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
     glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);