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>bb10
parent
ed43f89f8d
commit
dc6c263667
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue