diff options
Diffstat (limited to 'src/gui/opengl/qopenglpaintengine.cpp')
-rw-r--r-- | src/gui/opengl/qopenglpaintengine.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp index 8eeaa316d0..6ed2fe58b9 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -1496,6 +1496,20 @@ void QOpenGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, c d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::NonPremultipliedImageSrc); bindOption = 0; break; + case QImage::Format_Alpha8: + if (ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::TextureRGFormats)) { + d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::AlphaImageSrc); + bindOption = QOpenGLTextureCache::UseRedFor8BitBindOption; + } else + d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::ImageSrc); + break; + case QImage::Format_Grayscale8: + if (ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::TextureRGFormats)) { + d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::GrayscaleImageSrc); + bindOption = QOpenGLTextureCache::UseRedFor8BitBindOption; + } else + d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::ImageSrc); + break; default: d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::ImageSrc); break; @@ -1586,10 +1600,8 @@ void QOpenGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &text { QStaticTextItem staticTextItem; - staticTextItem.chars = const_cast<QChar *>(ti.chars); staticTextItem.setFontEngine(ti.fontEngine); staticTextItem.glyphs = glyphs.data(); - staticTextItem.numChars = ti.num_chars; staticTextItem.numGlyphs = glyphs.size(); staticTextItem.glyphPositions = positions.data(); |