summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2010-02-22 13:56:46 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2010-02-22 13:56:46 (GMT)
commit28cbbf0ce72b33a259f097a070571589e49f8923 (patch)
tree924318bacc42c5ea4e7b8e9db0ff640f72acc671 /src/gui/text/qfontengine.cpp
parentb9db89f7d299305769e207088a00345dbe82cf1d (diff)
downloadQt-28cbbf0ce72b33a259f097a070571589e49f8923.zip
Qt-28cbbf0ce72b33a259f097a070571589e49f8923.tar.gz
Qt-28cbbf0ce72b33a259f097a070571589e49f8923.tar.bz2
Fix assert in fontengine when using rotated/scaled QStaticText
Reviewed-By: Eskil
Diffstat (limited to 'src/gui/text/qfontengine.cpp')
-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;