diff options
author | Liang Qi <liang.qi@qt.io> | 2019-08-13 09:46:17 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-08-13 09:46:17 +0200 |
commit | 1dade1bd8ad13a16152aff36351ac570b5b9fdf6 (patch) | |
tree | eafed5710b34c327a98381ca15fe1985a6487b10 /src/gui/painting/qpaintengine_raster.cpp | |
parent | d45908e24292a41ff7838366b34be7340bf9fda5 (diff) | |
parent | fb703aea697b12de4810deec9f8605fd062208bd (diff) |
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
mkspecs/win32-clang-msvc/qmake.conf
src/corelib/tools/qlist.h
src/gui/painting/qcompositionfunctions.cpp
src/gui/painting/qtriangulator_p.h
src/gui/text/qfontengine_p.h
src/network/kernel/qhostinfo_p.h
src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
Done-With: Allan Sandfeld Jensen <allan.jensen@qt.io>
Change-Id: Ib8a0308cf77224c4fbdcf56778fdac4a43e37798
Diffstat (limited to 'src/gui/painting/qpaintengine_raster.cpp')
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 0a440e5b75..5ab5514dd4 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2883,19 +2883,34 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, for (int i = 0; i < numGlyphs; i++) { QFixed spp = fontEngine->subPixelPositionForX(positions[i].x); - QPoint offset; - const QImage *alphaMap = fontEngine->lockedAlphaMapForGlyph(glyphs[i], spp, neededFormat, s->matrix, - &offset); - if (alphaMap == 0 || alphaMap->isNull()) + const QFontEngine::Glyph *alphaMap = fontEngine->glyphData(glyphs[i], spp, neededFormat, s->matrix); + if (!alphaMap) continue; - alphaPenBlt(alphaMap->constBits(), alphaMap->bytesPerLine(), alphaMap->depth(), - qFloor(positions[i].x) + offset.x(), - qRound(positions[i].y) + offset.y(), - alphaMap->width(), alphaMap->height(), + int depth; + int bytesPerLine; + switch (alphaMap->format) { + case QFontEngine::Format_Mono: + depth = 1; + bytesPerLine = ((alphaMap->width + 31) & ~31) >> 3; + break; + case QFontEngine::Format_A8: + depth = 8; + bytesPerLine = (alphaMap->width + 3) & ~3; + break; + case QFontEngine::Format_A32: + depth = 32; + bytesPerLine = alphaMap->width * 4; + break; + default: + Q_UNREACHABLE(); + }; + + alphaPenBlt(alphaMap->data, bytesPerLine, depth, + qFloor(positions[i].x) + alphaMap->x, + qRound(positions[i].y) - alphaMap->y, + alphaMap->width, alphaMap->height, fontEngine->expectsGammaCorrectedBlending()); - - fontEngine->unlockAlphaMapForGlyph(); } } else { |