diff options
Diffstat (limited to 'src/gui/text/qfontengine.cpp')
-rw-r--r-- | src/gui/text/qfontengine.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index b2a7a8e91f..4c6fc7c1a6 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -761,7 +761,7 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &t) { QImage i = alphaMapForGlyph(glyph); if (t.type() > QTransform::TxTranslate) - i = i.transformed(t).convertToFormat(QImage::Format_Indexed8); + i = i.transformed(t).convertToFormat(QImage::Format_Alpha8); Q_ASSERT(i.depth() <= 8); // To verify that transformed didn't change the format... return i; @@ -774,7 +774,7 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, con QImage i = alphaMapForGlyph(glyph, subPixelPosition); if (t.type() > QTransform::TxTranslate) - i = i.transformed(t).convertToFormat(QImage::Format_Indexed8); + i = i.transformed(t).convertToFormat(QImage::Format_Alpha8); Q_ASSERT(i.depth() <= 8); // To verify that transformed didn't change the format... return i; @@ -785,12 +785,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); } } @@ -871,20 +870,16 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph) p.drawPath(path); p.end(); - QImage indexed(im.width(), im.height(), QImage::Format_Indexed8); - QVector<QRgb> colors(256); - for (int i=0; i<256; ++i) - colors[i] = qRgba(0, 0, 0, i); - indexed.setColorTable(colors); + QImage alphaMap(im.width(), im.height(), QImage::Format_Alpha8); for (int y=0; y<im.height(); ++y) { - uchar *dst = (uchar *) indexed.scanLine(y); + uchar *dst = (uchar *) alphaMap.scanLine(y); uint *src = (uint *) im.scanLine(y); for (int x=0; x<im.width(); ++x) dst[x] = qAlpha(src[x]); } - return indexed; + return alphaMap; } void QFontEngine::removeGlyphFromCache(glyph_t) @@ -1535,14 +1530,10 @@ bool QFontEngineBox::canRender(const QChar *, int) const QImage QFontEngineBox::alphaMapForGlyph(glyph_t) { - QImage image(_size, _size, QImage::Format_Indexed8); - QVector<QRgb> colors(256); - for (int i=0; i<256; ++i) - colors[i] = qRgba(0, 0, 0, i); - image.setColorTable(colors); + QImage image(_size, _size, QImage::Format_Alpha8); image.fill(0); - // can't use qpainter for index8; so use setPixel to draw our rectangle. + // FIXME: use qpainter for (int i=2; i <= _size-3; ++i) { image.setPixel(i, 2, 255); image.setPixel(i, _size-3, 255); |