summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/text/qfontengine.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index c000457..e5975d2 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -587,8 +587,9 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &t)
{
QImage i = alphaMapForGlyph(glyph);
if (t.type() > QTransform::TxTranslate)
- i = i.transformed(t);
+ i = i.transformed(t).convertToFormat(QImage::Format_Indexed8);
Q_ASSERT(i.depth() <= 8); // To verify that transformed didn't change the format...
+
return i;
}
@@ -597,11 +598,14 @@ QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, int /* margin */, const Q
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)
- dst[x] = qRgb(src[x], src[x], src[x]);
+ for (int x=0; x<alphaMask.width(); ++x) {
+ int val = qAlpha(colorTable.at(src[x]));
+ dst[x] = qRgb(val, val, val);
+ }
}
return rgbMask;