diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-01 23:48:33 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-06-01 23:48:33 (GMT) |
commit | d031b1aba3110776de4b70f8ffcb828f60b8b654 (patch) | |
tree | 581da27112d97033b037b1af1e2395345ec84f41 | |
parent | 16fdbcd175d29373a662dc9fb3606b26fc81c9c1 (diff) | |
parent | 348894a550510e54e7709d18676b4b10c9e5e9e3 (diff) | |
download | Qt-d031b1aba3110776de4b70f8ffcb828f60b8b654.zip Qt-d031b1aba3110776de4b70f8ffcb828f60b8b654.tar.gz Qt-d031b1aba3110776de4b70f8ffcb828f60b8b654.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Avoid buffer overrun in QMacPixmapData resizing
Fix glyph metrics with QStaticText/Freetype/raster and light/no hinting
Missing glyphs transforming QStaticText on X11/raster with subpixel AA
Fixed clipping errors for non-extended paint engines.
-rw-r--r-- | src/gui/image/qpixmap_mac.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 10 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 9 | ||||
-rw-r--r-- | src/gui/painting/qtextureglyphcache.cpp | 8 | ||||
-rw-r--r-- | src/gui/text/qfontengine_ft.cpp | 9 |
5 files changed, 30 insertions, 8 deletions
diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index aac159e..6872cfa 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -637,7 +637,7 @@ void QMacPixmapData::macCreatePixels() } if (pixels) - memcpy(base_pixels, pixels, pixelsSize); + memcpy(base_pixels, pixels, qMin(pixelsSize, (uint) numBytes)); pixels = base_pixels; pixelsSize = numBytes; } diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 01b22da..cd9206c 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3105,7 +3105,15 @@ void QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); - QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0 ? QFontEngineGlyphCache::Type(fontEngine->glyphFormat) : d->glyphCacheType; + QFontEngineGlyphCache::Type glyphType; + if (fontEngine->glyphFormat >= 0) { + glyphType = QFontEngineGlyphCache::Type(fontEngine->glyphFormat); + } else if (s->matrix.type() > QTransform::TxTranslate + && d->glyphCacheType == QFontEngineGlyphCache::Raster_RGBMask) { + glyphType = QFontEngineGlyphCache::Raster_A8; + } else { + glyphType = d->glyphCacheType; + } QImageTextureGlyphCache *cache = static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(0, glyphType, s->matrix)); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index dfb9a04..a4ab00a 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2788,6 +2788,9 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op) return; } + if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) + op = Qt::ReplaceClip; + d->state->clipRegion = rect; d->state->clipOperation = op; if (op == Qt::NoClip || op == Qt::ReplaceClip) @@ -2843,6 +2846,9 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op) return; } + if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) + op = Qt::ReplaceClip; + d->state->clipRegion = r; d->state->clipOperation = op; if (op == Qt::NoClip || op == Qt::ReplaceClip) @@ -3248,6 +3254,9 @@ void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op) return; } + if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) + op = Qt::ReplaceClip; + d->state->clipPath = path; d->state->clipOperation = op; if (op == Qt::NoClip || op == Qt::ReplaceClip) diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 16df6c1..2c1da24 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -178,14 +178,10 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g) const { #if defined(Q_WS_X11) - if (m_transform.type() > QTransform::TxTranslate && m_current_fontengine->type() == QFontEngine::Freetype) { + if (m_type != Raster_RGBMask && m_transform.type() > QTransform::TxTranslate && m_current_fontengine->type() == QFontEngine::Freetype) { QFontEngineFT::GlyphFormat format = QFontEngineFT::Format_None; QImage::Format imageFormat = QImage::Format_Invalid; switch (m_type) { - case Raster_RGBMask: - format = QFontEngineFT::Format_A32; - imageFormat = QImage::Format_RGB32; - break; case Raster_A8: format = QFontEngineFT::Format_A8; imageFormat = QImage::Format_Indexed8; @@ -266,7 +262,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g) } #endif - if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { + if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { QImage ref(m_image.bits() + (c.x * 4 + c.y * m_image.bytesPerLine()), qMax(mask.width(), c.w), qMax(mask.height(), c.h), m_image.bytesPerLine(), m_image.format()); diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index c4e89d5..1056aed 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -762,9 +762,18 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph return g; int load_flags = FT_LOAD_DEFAULT | default_load_flags; + int load_target = default_hint_style == HintLight + ? FT_LOAD_TARGET_LIGHT + : FT_LOAD_TARGET_NORMAL; + if (set->outline_drawing) load_flags = FT_LOAD_NO_BITMAP; + if (default_hint_style == HintNone) + load_flags |= FT_LOAD_NO_HINTING; + else + load_flags |= load_target; + // apply our matrix to this, but note that the metrics will not be affected by this. FT_Face face = lockFace(); FT_Matrix matrix = this->matrix; |