Fix access of non-existing color table

Since alphaMapForGlyph now returns images in alpha8 format, they no
longer have a colortable, so we need to fix the fallback implementation
of alphaRGBMapForGlyph from trying to access it.

Task-number: QTBUG-41855
Change-Id: I232089163cfc817d7cf16df566f05629a968bf12
Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
Allan Sandfeld Jensen 2014-10-09 15:17:58 +02:00
parent 6c35eb5f0f
commit 29e679bed9

View File

@ -787,12 +787,11 @@ QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed /*subPixelPosition
QImage alphaMask = alphaMapForGlyph(glyph, t);
QImage rgbMask(alphaMask.width(), alphaMask.height(), QImage::Format_RGB32);
QVector<QRgb> colorTable = alphaMask.colorTable();
for (int y=0; y<alphaMask.height(); ++y) {
uint *dst = (uint *) rgbMask.scanLine(y);
uchar *src = (uchar *) alphaMask.scanLine(y);
for (int x=0; x<alphaMask.width(); ++x) {
int val = qAlpha(colorTable.at(src[x]));
int val = src[x];
dst[x] = qRgb(val, val, val);
}
}