summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorTrond Kjernaasen <trond@trolltech.com>2009-05-26 12:20:34 (GMT)
committerTrond Kjernaasen <trond@trolltech.com>2009-05-26 12:25:38 (GMT)
commit871b730da203cef773e159960532888522f16a0b (patch)
treecfedefb69328589aef74dcb9801099b964a7d37e /src/gui
parent8a2ca9b0d8ed23cec44e40f61c0f4983fbc55282 (diff)
downloadQt-871b730da203cef773e159960532888522f16a0b.zip
Qt-871b730da203cef773e159960532888522f16a0b.tar.gz
Qt-871b730da203cef773e159960532888522f16a0b.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
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp8
-rw-r--r--src/gui/text/qfontengine_win.cpp6
2 files changed, 9 insertions, 5 deletions
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 3fd1ffb..89df869 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 bf3a176..7341665 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();