summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpaintengine_raster.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-08-12 13:23:11 +0200
committerLiang Qi <liang.qi@qt.io>2019-08-12 13:23:11 +0200
commit44c393f9b61797a240bfcbff1364ecdf7af41787 (patch)
tree94cca729399f5df23cf904f7bd866397d84aac7c /src/gui/painting/qpaintengine_raster.cpp
parentffc2d5722317fcab86865b11491d7bf7fef3e16d (diff)
parente66f247ccf345f1d303a92e53c21bb53d96c5af2 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts: config.tests/arch/write_info.pri Repair architecture config test for the WASM_OBJECT_FILES=1 build mode configure.pri tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp Done-With: Jörg Bornemann <joerg.bornemann@qt.io> Change-Id: I9e12088356eb5bc65b53211cd7a8e330cccd1bb4
Diffstat (limited to 'src/gui/painting/qpaintengine_raster.cpp')
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 4b06afd4eb..5bdf3299c9 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -2908,19 +2908,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 {