diff options
| author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2014-02-19 10:06:25 +0100 |
|---|---|---|
| committer | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2014-02-19 10:06:25 +0100 |
| commit | 30fd22b9574def54726e7b193127cc0c901c1b4c (patch) | |
| tree | 96dfc923044db0515064ba39d052d9ed577e3e40 /src/gui/opengl/qopengltextureglyphcache.cpp | |
| parent | d7b0581c1c2ef60c08d238dae39298af6904918f (diff) | |
| parent | 6aa09bbce59828d028f6d1e81d2bfc6ba537aae1 (diff) | |
Merge remote-tracking branch 'origin/dev' into stable
Change-Id: Ice524edcc51373509f0023ae7f7c2963f4602f88
Diffstat (limited to 'src/gui/opengl/qopengltextureglyphcache.cpp')
| -rw-r--r-- | src/gui/opengl/qopengltextureglyphcache.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index 3b62d1d63a6..0d9a2359bdb 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -328,8 +328,11 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed if (mask.format() == QImage::Format_RGB32 // We need to make the alpha component equal to the average of the RGB values. // This is needed when drawing sub-pixel antialiased text on translucent targets. -#if defined(QT_OPENGL_ES_2) || Q_BYTE_ORDER == Q_BIG_ENDIAN +#if Q_BYTE_ORDER == Q_BIG_ENDIAN || mask.format() == QImage::Format_ARGB32_Premultiplied +#else + || (mask.format() == QImage::Format_ARGB32_Premultiplied + && QOpenGLFunctions::isES()) #endif ) { for (int y = 0; y < maskHeight; ++y) { @@ -345,10 +348,11 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed avg = qAlpha(src[x]); src[x] = qRgba(r, g, b, avg); -#if defined(QT_OPENGL_ES_2) || Q_BYTE_ORDER == Q_BIG_ENDIAN // swizzle the bits to accommodate for the GL_RGBA upload. - src[x] = ARGB2RGBA(src[x]); +#if Q_BYTE_ORDER != Q_BIG_ENDIAN + if (QOpenGLFunctions::isES()) #endif + src[x] = ARGB2RGBA(src[x]); } } } @@ -356,11 +360,16 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); if (mask.depth() == 32) { -#if defined(QT_OPENGL_ES_2) || Q_BYTE_ORDER == Q_BIG_ENDIAN - glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_RGBA, GL_UNSIGNED_BYTE, mask.bits()); +#ifdef QT_OPENGL_ES_2 + GLenum fmt = GL_RGBA; #else - glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits()); + GLenum fmt = QOpenGLFunctions::isES() ? GL_RGBA : GL_BGRA; +#endif // QT_OPENGL_ES_2 + +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + fmt = GL_RGBA; #endif + glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, fmt, GL_UNSIGNED_BYTE, mask.bits()); } else { // glTexSubImage2D() might cause some garbage to appear in the texture if the mask width is // not a multiple of four bytes. The bug appeared on a computer with 32-bit Windows Vista |
