src/gui/text/qfontengine.cpp
changeset 30 5dc02b23752f
parent 19 fcece45ef507
child 37 758a864f9613
--- a/src/gui/text/qfontengine.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/gui/text/qfontengine.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -596,8 +596,9 @@
 {
     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;
 }
 
@@ -606,11 +607,14 @@
     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;