summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-10-19 12:14:42 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-10-20 07:40:12 +0200
commitdc6c26366727b85f9b28c50da3a75a653e37c5d8 (patch)
tree3df0a2f5116a8ca3ef15e26ca366a70316f0f6eb /src/gui/text/qfontengine.cpp
parented43f89f8d1d3099ba0b94acf7775639e0ff9b28 (diff)
Fix output with box font engine
The box font engine was passing in alpha values in the blue channel instead of alpha channel to QImage::setPixel(), probably assuming that setPixel() accepts the input in the format of the QImage. But the whole point of setPixel() is that it converts the input. If we just want to set the alpha value, we can do it directly on the QImage::bits(). [ChangeLog][Text] Fixed showing boxes for glyphs when there are no fonts available in the font database. Pick-to: 5.15 Change-Id: I7ae067c26b9ecba6aaa046e7e4b9ae520c4b3d23 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/gui/text/qfontengine.cpp')
-rw-r--r--src/gui/text/qfontengine.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 15036718c3..9dd59e58f9 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1670,12 +1670,12 @@ QImage QFontEngineBox::alphaMapForGlyph(glyph_t)
QImage image(_size, _size, QImage::Format_Alpha8);
image.fill(0);
- // FIXME: use qpainter
+ uchar *bits = image.bits();
for (int i=2; i <= _size-3; ++i) {
- image.setPixel(i, 2, 255);
- image.setPixel(i, _size-3, 255);
- image.setPixel(2, i, 255);
- image.setPixel(_size-3, i, 255);
+ bits[i + 2 * image.bytesPerLine()] = 255;
+ bits[i + (_size - 3) * image.bytesPerLine()] = 255;
+ bits[2 + i * image.bytesPerLine()] = 255;
+ bits[_size - 3 + i * image.bytesPerLine()] = 255;
}
return image;
}