diff options
author | Trond Kjernaasen <trond@trolltech.com> | 2009-05-26 12:20:34 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-05-27 02:57:03 (GMT) |
commit | de4f98ce12440e00542a1c98785fe9fc84d90869 (patch) | |
tree | f95495b628d3614068cc2c6ef3dfca5653a96e45 | |
parent | 378d5ac5f5baea4a2e8220c769b80e6116d0a2ad (diff) | |
download | Qt-de4f98ce12440e00542a1c98785fe9fc84d90869.zip Qt-de4f98ce12440e00542a1c98785fe9fc84d90869.tar.gz Qt-de4f98ce12440e00542a1c98785fe9fc84d90869.tar.bz2 |
BT: Fixed GL textdrawing in the Boxes demo.
Reworked the 85f98acaa3a38079071bea711e43c9a86edec1f6 fix, since
it broke glyph positioning in the GL engine under Windows.
Instead of changing the glyph cache margin, which impacts where
the glyph is positioned, we just make the image the glyph is drawn
into 4 pixels bigger in width/heigth.
The margin in QImageTextureGlyphCache needs to be reworked..
Task-number: 254450
Reviewed-by: Eskil
(cherry picked from commit 871b730da203cef773e159960532888522f16a0b)
-rw-r--r-- | src/gui/painting/qtextureglyphcache.cpp | 8 | ||||
-rw-r--r-- | src/gui/text/qfontengine_win.cpp | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 66770e4..f907a40 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -92,8 +92,8 @@ void QTextureGlyphCache::populate(const QTextItemInt &ti, int glyph_height = metrics.height.ceil().toInt(); if (glyph_height == 0 || glyph_width == 0) continue; - glyph_width += margin * 2 + 2; - glyph_height += margin * 2 + 2; + glyph_width += margin * 2 + 4; + glyph_height += margin * 2 + 4; // align to 8-bit boundary if (m_type == QFontEngineGlyphCache::Raster_Mono) glyph_width = (glyph_width+7)&~7; @@ -189,7 +189,11 @@ void QImageTextureGlyphCache::createTextureData(int width, int height) int QImageTextureGlyphCache::glyphMargin() const { +#ifdef Q_WS_MAC return 2; +#else + return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0; +#endif } void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g) diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 2ca3406..c1ef822 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -1406,8 +1406,8 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin #endif #endif - QNativeImage *ni = new QNativeImage(iw + 2 * margin + 2, - ih + 2 * margin + 2, + QNativeImage *ni = new QNativeImage(iw + 2 * margin + 4, + ih + 2 * margin + 4, QNativeImage::systemFormat(), true); ni->image.fill(0xffffffff); @@ -1449,7 +1449,7 @@ QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform) font = CreateFontIndirectW(&lf); } - QNativeImage *mask = drawGDIGlyph(font, glyph, 2, xform); + QNativeImage *mask = drawGDIGlyph(font, glyph, 0, xform); if (mask == 0) return QImage(); |