From c147617c3f33872a412318d9cd660e5391229619 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 30 Mar 2010 16:17:10 +0200 Subject: Change the ifdef for resolving function ptrs to match declaration Reviewed-By: TrustMe --- src/gui/egl/qegl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 498245c..6f215cc 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -556,7 +556,7 @@ EGLDisplay QEgl::display() } // Resolve the egl extension function pointers: -#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_base) +#if (defined(EGL_KHR_image) || defined(EGL_KHR_image_base)) && !defined(EGL_EGLEXT_PROTOTYPES) if (QEgl::hasExtension("EGL_KHR_image") || QEgl::hasExtension("EGL_KHR_image_base")) { eglCreateImageKHR = (_eglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR"); eglDestroyImageKHR = (_eglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR"); -- cgit v0.12 From ce0af99f47c1728a6d8145ea89f41b1c9207104a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 6 Apr 2010 16:08:20 +0200 Subject: Prevented unnecessary copy in QImage::setAlphaChannel(). If the formats don't match the detch is unnecessary as operator= will anyways destroy the detached QImageData and substitute it with the newly created QImageData from convertToFormat. Task-number: QTBUG-9640 Reviewed-by: Trond --- src/gui/image/qimage.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 233c58d..ce1d6d3 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -5704,9 +5704,10 @@ void QImage::setAlphaChannel(const QImage &alphaChannel) return; } - detach(); - - *this = convertToFormat(QImage::Format_ARGB32_Premultiplied); + if (d->format == QImage::Format_ARGB32_Premultiplied) + detach(); + else + *this = convertToFormat(QImage::Format_ARGB32_Premultiplied); // Slight optimization since alphachannels are returned as 8-bit grays. if (alphaChannel.d->depth == 8 && alphaChannel.isGrayscale()) { -- cgit v0.12 From 06e8d0cae3651beaf95de05e89696cbab4978740 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 6 Apr 2010 16:23:34 +0200 Subject: Fix painting artifacts on text The height of the row is not only decided by the maximum height of the set of glyphs currently being added to the glyph cache, but also the height of the glyphs previously added to the current line in the glyph cache. To minimize the space used, we now calculate the maximum height for glyphs per line, and use this as the vertical advancement when positioning the next line in the cache. The change also removes a redundant test ((c_x + c.w > c.h) is caught earlier on and will always be false at this point.) Task-number: QTBUG-9176 Reviewed-by: Trond --- src/gui/painting/qtextureglyphcache.cpp | 14 +++++--------- src/gui/painting/qtextureglyphcache_p.h | 3 ++- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index cf545be..9eda0ef 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -133,10 +133,13 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const while (iter != listItemCoordinates.end()) { Coord c = iter.value(); + 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 += rowHeight; + m_cy += m_currentRowHeight; + m_currentRowHeight = 0; // New row } if (m_cy + c.h > m_h) { int new_height = m_h*2; @@ -153,14 +156,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const fillTexture(c, iter.key()); coords.insert(iter.key(), c); - if (m_cx + c.w > m_w) { - m_cx = 0; - m_cy += rowHeight; - } else { - // for the Mono case, glyph_width is 8-bit aligned, - // and therefore so will m_cx - m_cx += c.w; - } + m_cx += c.w; ++iter; } diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h index 803e71b..8c2f5b4 100644 --- a/src/gui/painting/qtextureglyphcache_p.h +++ b/src/gui/painting/qtextureglyphcache_p.h @@ -77,7 +77,7 @@ class Q_GUI_EXPORT QTextureGlyphCache : public QFontEngineGlyphCache public: QTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix) : QFontEngineGlyphCache(matrix, type), m_current_fontengine(0), - m_w(0), m_h(0), m_cx(0), m_cy(0) + m_w(0), m_h(0), m_cx(0), m_cy(0), m_currentRowHeight(0) { } virtual ~QTextureGlyphCache() { } @@ -120,6 +120,7 @@ protected: int m_h; // image height int m_cx; // current x int m_cy; // current y + int m_currentRowHeight; // Height of last row }; -- cgit v0.12 From 253b87180e0a6c5db0feaaed7e321139c4ff1643 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 6 Apr 2010 17:04:20 +0200 Subject: Moved item wouldn't follow mouse cursor when ItemIgnoresTransformations is set Since the introduction of transform properties in QGraphicsItem, QGraphicsItem::transform() is no longer enough to get the correct transform of an item. No auto-test as it involves mouse dragging. Reviewed-by: Yoann Task-number: QTBUG-9295 --- src/gui/graphicsview/qgraphicsitem.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index f106b3d..d6daf4d 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7112,7 +7112,8 @@ void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) // Root items that ignore transformations need to // calculate their diff by mapping viewport coordinates // directly to parent coordinates. - QTransform viewToParentTransform = (item->transform().translate(item->d_ptr->pos.x(), item->d_ptr->pos.y())) + // COMBINE + QTransform viewToParentTransform = (item->d_func()->transformData->computedFullTransform().translate(item->d_ptr->pos.x(), item->d_ptr->pos.y())) * (item->sceneTransform() * view->viewportTransform()).inverted(); currentParentPos = viewToParentTransform.map(QPointF(view->mapFromGlobal(event->screenPos()))); buttonDownParentPos = viewToParentTransform.map(QPointF(view->mapFromGlobal(event->buttonDownScreenPos(Qt::LeftButton)))); -- cgit v0.12