diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-22 02:31:46 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-22 02:31:46 (GMT) |
commit | 80c2e1211065f606c6f39e708a74afad1c624663 (patch) | |
tree | 48f9a9ae5e308c9c4c0d43a39d78ace5f9317499 /src/gui | |
parent | ee9e29a9d203ed1404810aa4097bb8e0db483dda (diff) | |
parent | eb2926a2f9607e985b8bca54346e6fdf91343247 (diff) | |
download | Qt-80c2e1211065f606c6f39e708a74afad1c624663.zip Qt-80c2e1211065f606c6f39e708a74afad1c624663.tar.gz Qt-80c2e1211065f606c6f39e708a74afad1c624663.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: (105 commits)
Fixed drawing a large number of glyphs with the same font under GL.
Bump version to 4.7.1.
Qt headers must be included before X11 headers
Fixes bezier curves not being drawn when it is a line.
Avoid creating copy of an image in memory when storing as jpeg
QSslSocketPrivate::systemCaCertificates() hangs sometimes on Symbian
Add exception barrier to QCertificateRetriever::RunL()
Reference correct declarative elements page.
QtWebKit: Update tag files to match the same content on qtwebkit.git
QtWebKit: Downstream patch 2 fixing a crash on MSVC 64bit.
QtWebKit: Downstream patch 1 fixing a crash on MSVC 64bit.
Doc: updating the qdocconf files and the stylesheet
Doc: updating details on Tier 2 platforms
Doc: adding remark on release of qt quick element support in creator
Update configure.exe
Revert "let WebKit inject itself into the qt configuration"
Revert "fix qt_webkit_version.pri install for in-Qt builds"
Revert "Fixed incorrect Symbian scoping."
QS60Style: Itemviews are drawn incorrectly
Change to commercial license headers in preparation for release.
...
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qjpeghandler.cpp | 41 | ||||
-rw-r--r-- | src/gui/painting/qbezier.cpp | 41 | ||||
-rw-r--r-- | src/gui/painting/qtextureglyphcache.cpp | 20 | ||||
-rw-r--r-- | src/gui/painting/qtextureglyphcache_p.h | 6 |
4 files changed, 31 insertions, 77 deletions
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp index e685694..b9eda05 100644 --- a/src/gui/image/qjpeghandler.cpp +++ b/src/gui/image/qjpeghandler.cpp @@ -515,29 +515,10 @@ inline my_jpeg_destination_mgr::my_jpeg_destination_mgr(QIODevice *device) free_in_buffer = max_buf; } -static bool can_write_format(QImage::Format fmt) -{ - switch (fmt) { - case QImage::Format_Mono: - case QImage::Format_MonoLSB: - case QImage::Format_Indexed8: - case QImage::Format_RGB888: - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - return true; - break; - default: - break; - } - return false; -} -static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int sourceQuality) +static bool write_jpeg_image(const QImage &image, QIODevice *device, int sourceQuality) { bool success = false; - const QImage image = can_write_format(sourceImage.format()) ? - sourceImage : sourceImage.convertToFormat(QImage::Format_RGB888); const QVector<QRgb> cmap = image.colorTable(); struct jpeg_compress_struct cinfo; @@ -614,7 +595,7 @@ static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int s case QImage::Format_Mono: case QImage::Format_MonoLSB: if (gray) { - const uchar* data = image.scanLine(cinfo.next_scanline); + const uchar* data = image.constScanLine(cinfo.next_scanline); if (image.format() == QImage::Format_MonoLSB) { for (int i=0; i<w; i++) { bool bit = !!(*(data + (i >> 3)) & (1 << (i & 7))); @@ -627,7 +608,7 @@ static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int s } } } else { - const uchar* data = image.scanLine(cinfo.next_scanline); + const uchar* data = image.constScanLine(cinfo.next_scanline); if (image.format() == QImage::Format_MonoLSB) { for (int i=0; i<w; i++) { bool bit = !!(*(data + (i >> 3)) & (1 << (i & 7))); @@ -647,13 +628,13 @@ static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int s break; case QImage::Format_Indexed8: if (gray) { - const uchar* pix = image.scanLine(cinfo.next_scanline); + const uchar* pix = image.constScanLine(cinfo.next_scanline); for (int i=0; i<w; i++) { *row = qRed(cmap[*pix]); ++row; ++pix; } } else { - const uchar* pix = image.scanLine(cinfo.next_scanline); + const uchar* pix = image.constScanLine(cinfo.next_scanline); for (int i=0; i<w; i++) { *row++ = qRed(cmap[*pix]); *row++ = qGreen(cmap[*pix]); @@ -663,12 +644,12 @@ static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int s } break; case QImage::Format_RGB888: - memcpy(row, image.scanLine(cinfo.next_scanline), w * 3); + memcpy(row, image.constScanLine(cinfo.next_scanline), w * 3); break; case QImage::Format_RGB32: case QImage::Format_ARGB32: case QImage::Format_ARGB32_Premultiplied: { - QRgb* rgb = (QRgb*)image.scanLine(cinfo.next_scanline); + const QRgb* rgb = (const QRgb*)image.constScanLine(cinfo.next_scanline); for (int i=0; i<w; i++) { *row++ = qRed(*rgb); *row++ = qGreen(*rgb); @@ -678,8 +659,12 @@ static bool write_jpeg_image(const QImage &sourceImage, QIODevice *device, int s break; } default: - qWarning("QJpegHandler: unable to write image of format %i", - image.format()); + for (int i=0; i<w; i++) { + QRgb pix = image.pixel(i, cinfo.next_scanline); + *row++ = qRed(pix); + *row++ = qGreen(pix); + *row++ = qBlue(pix); + } break; } jpeg_write_scanlines(&cinfo, row_pointer, 1); diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index 2a9b31a..54c81ba 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -293,36 +293,6 @@ static ShiftResult good_offset(const QBezier *b1, const QBezier *b2, qreal offse return Ok; } -static inline QLineF qline_shifted(const QPointF &p1, const QPointF &p2, qreal offset) -{ - QLineF l(p1, p2); - QLineF ln = l.normalVector().unitVector(); - l.translate(ln.dx() * offset, ln.dy() * offset); - return l; -} - -static bool qbezier_is_line(QPointF *points, int pointCount) -{ - Q_ASSERT(pointCount > 2); - - qreal dx13 = points[2].x() - points[0].x(); - qreal dy13 = points[2].y() - points[0].y(); - - qreal dx12 = points[1].x() - points[0].x(); - qreal dy12 = points[1].y() - points[0].y(); - - if (pointCount == 3) { - return qFuzzyCompare(dx12 * dy13, dx13 * dy12); - } else if (pointCount == 4) { - qreal dx14 = points[3].x() - points[0].x(); - qreal dy14 = points[3].y() - points[0].y(); - - return (qFuzzyCompare(dx12 * dy13, dx13 * dy12) && qFuzzyCompare(dx12 * dy14, dx14 * dy12)); - } - - return false; -} - static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qreal threshold) { int map[4]; @@ -353,17 +323,6 @@ static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qr if (np == 1) return Discard; - // We need to specialcase lines of 3 or 4 points due to numerical - // instability in intersections below - if (np > 2 && qbezier_is_line(points, np)) { - if (points[0] == points[np-1]) - return Discard; - - QLineF l = qline_shifted(points[0], points[np-1], offset); - *shifted = QBezier::fromPoints(l.p1(), l.pointAt(qreal(0.33)), l.pointAt(qreal(0.66)), l.p2()); - return Ok; - } - QRectF b = orig->bounds(); if (np == 4 && b.width() < .1*offset && b.height() < .1*offset) { qreal l = (orig->x1 - orig->x2)*(orig->x1 - orig->x2) + diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 631a9cf..b609f7b 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -47,10 +47,6 @@ #include "private/qnativeimage_p.h" #include "private/qfontengine_ft_p.h" -#ifndef QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH -#define QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH 256 -#endif - QT_BEGIN_NAMESPACE // #define CACHE_DEBUG @@ -137,10 +133,18 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const m_currentRowHeight = qMax(m_currentRowHeight, c.h + margin * 2); if (m_cx + c.w > m_w) { - // no room on the current line, start new glyph strip - m_cx = 0; - m_cy += m_currentRowHeight + paddingDoubled; - m_currentRowHeight = 0; // New row + int new_width = m_w*2; + while (new_width < m_cx + c.w) + new_width *= 2; + if (new_width <= maxTextureWidth()) { + resizeTextureData(new_width, m_h); + m_w = new_width; + } else { + // no room on the current line, start new glyph strip + m_cx = 0; + m_cy += m_currentRowHeight + paddingDoubled; + m_currentRowHeight = 0; // New row + } } if (m_cy + c.h > m_h) { int new_height = m_h*2; diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h index a818978..e6d2b22 100644 --- a/src/gui/painting/qtextureglyphcache_p.h +++ b/src/gui/painting/qtextureglyphcache_p.h @@ -64,6 +64,10 @@ # undef m_type #endif +#ifndef QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH +#define QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH 256 +#endif + struct glyph_metrics_t; typedef unsigned int glyph_t; @@ -113,6 +117,8 @@ public: QHash<glyph_t, Coord> coords; QImage textureMapForGlyph(glyph_t g) const; + virtual int maxTextureWidth() const { return QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH; } + virtual int maxTextureHeight() const { return 32768; } protected: QFontEngine *m_current_fontengine; |