diff options
| author | Jonathan Liu <net147@gmail.com> | 2013-10-24 10:56:37 +0000 |
|---|---|---|
| committer | Martin Jansa <Martin.Jansa@gmail.com> | 2013-10-29 11:48:47 +0100 |
| commit | c36be1724a71f2f62cc09c28e34547165a80cce7 (patch) | |
| tree | 517f1aa2ef79fa7dbe0bceb981c41b61b44410ac | |
| parent | 84cd4be2491895b0c3a0af64e4c83d58910d1f6c (diff) | |
| download | meta-qt5-c36be1724a71f2f62cc09c28e34547165a80cce7.tar.gz | |
qtbase: add upstream QTBUG-34218/QTBUG-34234 misaligned selection patch
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
3 files changed, 149 insertions, 0 deletions
diff --git a/recipes-qt/qt5/qtbase-5.1.1/0027-Fix-misaligned-selection-region-with-text-when-cente.patch b/recipes-qt/qt5/qtbase-5.1.1/0027-Fix-misaligned-selection-region-with-text-when-cente.patch new file mode 100644 index 00000000..d5e082ea --- /dev/null +++ b/recipes-qt/qt5/qtbase-5.1.1/0027-Fix-misaligned-selection-region-with-text-when-cente.patch | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | From 5d8a882c11201a29475c5ea71cfb76c9de6573f5 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jonathan Liu <net147@gmail.com> | ||
| 3 | Date: Wed, 23 Oct 2013 00:28:17 +1100 | ||
| 4 | Subject: [PATCH] Fix misaligned selection region with text when centered | ||
| 5 | |||
| 6 | If the text is centered, the x/y position in the selection QRectF may | ||
| 7 | be a multiple of 0.5 which is rounded up. This rounding causes | ||
| 8 | misalignment of the selection region with the text. | ||
| 9 | |||
| 10 | The alignment is fixed by using qFloor on the x and y components. | ||
| 11 | |||
| 12 | Upstream-Status: Accepted [https://codereview.qt-project.org/#change,68842] | ||
| 13 | Signed-off-by: Jonathan Liu <net147@gmail.com> | ||
| 14 | |||
| 15 | Task-number: QTBUG-34218 | ||
| 16 | Task-number: QTBUG-34234 | ||
| 17 | Change-Id: I4f2fadeb38602f62a93773c6e5faecf03b28069f | ||
| 18 | Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> | ||
| 19 | --- | ||
| 20 | src/gui/text/qtextlayout.cpp | 19 ++++++++++++++----- | ||
| 21 | 1 file changed, 14 insertions(+), 5 deletions(-) | ||
| 22 | |||
| 23 | diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp | ||
| 24 | index 54d337e..66341e1 100644 | ||
| 25 | --- a/src/gui/text/qtextlayout.cpp | ||
| 26 | +++ b/src/gui/text/qtextlayout.cpp | ||
| 27 | @@ -44,6 +44,7 @@ | ||
| 28 | |||
| 29 | #include <qthread.h> | ||
| 30 | #include <qfont.h> | ||
| 31 | +#include <qmath.h> | ||
| 32 | #include <qpainter.h> | ||
| 33 | #include <qvarlengtharray.h> | ||
| 34 | #include <qtextformat.h> | ||
| 35 | @@ -946,15 +947,23 @@ static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPo | ||
| 36 | continue; | ||
| 37 | } | ||
| 38 | |||
| 39 | - if (lastSelectionWidth > 0) | ||
| 40 | - region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight)); | ||
| 41 | + if (lastSelectionWidth > 0) { | ||
| 42 | + QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight); | ||
| 43 | + rect.moveLeft(qFloor(rect.left())); | ||
| 44 | + rect.moveTop(qFloor(rect.top())); | ||
| 45 | + region->addRect(rect); | ||
| 46 | + } | ||
| 47 | |||
| 48 | lastSelectionX = selectionX; | ||
| 49 | lastSelectionWidth = selectionWidth; | ||
| 50 | } | ||
| 51 | } | ||
| 52 | - if (lastSelectionWidth > 0) | ||
| 53 | - region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight)); | ||
| 54 | + if (lastSelectionWidth > 0) { | ||
| 55 | + QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight); | ||
| 56 | + rect.moveLeft(qFloor(rect.left())); | ||
| 57 | + rect.moveTop(qFloor(rect.top())); | ||
| 58 | + region->addRect(rect); | ||
| 59 | + } | ||
| 60 | } | ||
| 61 | |||
| 62 | static inline QRectF clipIfValid(const QRectF &rect, const QRectF &clip) | ||
| 63 | @@ -2077,7 +2086,7 @@ static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const Q | ||
| 64 | |||
| 65 | QBrush bg = chf.background(); | ||
| 66 | if (bg.style() != Qt::NoBrush && !chf.property(SuppressBackground).toBool()) | ||
| 67 | - p->fillRect(r, bg); | ||
| 68 | + p->fillRect(QRectF(qFloor(r.x()), qFloor(r.y()), r.width(), r.height()), bg); | ||
| 69 | if (c.style() != Qt::NoBrush) { | ||
| 70 | p->setPen(QPen(c, 0)); | ||
| 71 | } | ||
| 72 | -- | ||
| 73 | 1.8.4 | ||
| 74 | |||
diff --git a/recipes-qt/qt5/qtbase-git/0027-Fix-misaligned-selection-region-with-text-when-cente.patch b/recipes-qt/qt5/qtbase-git/0027-Fix-misaligned-selection-region-with-text-when-cente.patch new file mode 100644 index 00000000..d5e082ea --- /dev/null +++ b/recipes-qt/qt5/qtbase-git/0027-Fix-misaligned-selection-region-with-text-when-cente.patch | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | From 5d8a882c11201a29475c5ea71cfb76c9de6573f5 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jonathan Liu <net147@gmail.com> | ||
| 3 | Date: Wed, 23 Oct 2013 00:28:17 +1100 | ||
| 4 | Subject: [PATCH] Fix misaligned selection region with text when centered | ||
| 5 | |||
| 6 | If the text is centered, the x/y position in the selection QRectF may | ||
| 7 | be a multiple of 0.5 which is rounded up. This rounding causes | ||
| 8 | misalignment of the selection region with the text. | ||
| 9 | |||
| 10 | The alignment is fixed by using qFloor on the x and y components. | ||
| 11 | |||
| 12 | Upstream-Status: Accepted [https://codereview.qt-project.org/#change,68842] | ||
| 13 | Signed-off-by: Jonathan Liu <net147@gmail.com> | ||
| 14 | |||
| 15 | Task-number: QTBUG-34218 | ||
| 16 | Task-number: QTBUG-34234 | ||
| 17 | Change-Id: I4f2fadeb38602f62a93773c6e5faecf03b28069f | ||
| 18 | Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> | ||
| 19 | --- | ||
| 20 | src/gui/text/qtextlayout.cpp | 19 ++++++++++++++----- | ||
| 21 | 1 file changed, 14 insertions(+), 5 deletions(-) | ||
| 22 | |||
| 23 | diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp | ||
| 24 | index 54d337e..66341e1 100644 | ||
| 25 | --- a/src/gui/text/qtextlayout.cpp | ||
| 26 | +++ b/src/gui/text/qtextlayout.cpp | ||
| 27 | @@ -44,6 +44,7 @@ | ||
| 28 | |||
| 29 | #include <qthread.h> | ||
| 30 | #include <qfont.h> | ||
| 31 | +#include <qmath.h> | ||
| 32 | #include <qpainter.h> | ||
| 33 | #include <qvarlengtharray.h> | ||
| 34 | #include <qtextformat.h> | ||
| 35 | @@ -946,15 +947,23 @@ static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPo | ||
| 36 | continue; | ||
| 37 | } | ||
| 38 | |||
| 39 | - if (lastSelectionWidth > 0) | ||
| 40 | - region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight)); | ||
| 41 | + if (lastSelectionWidth > 0) { | ||
| 42 | + QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight); | ||
| 43 | + rect.moveLeft(qFloor(rect.left())); | ||
| 44 | + rect.moveTop(qFloor(rect.top())); | ||
| 45 | + region->addRect(rect); | ||
| 46 | + } | ||
| 47 | |||
| 48 | lastSelectionX = selectionX; | ||
| 49 | lastSelectionWidth = selectionWidth; | ||
| 50 | } | ||
| 51 | } | ||
| 52 | - if (lastSelectionWidth > 0) | ||
| 53 | - region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight)); | ||
| 54 | + if (lastSelectionWidth > 0) { | ||
| 55 | + QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight); | ||
| 56 | + rect.moveLeft(qFloor(rect.left())); | ||
| 57 | + rect.moveTop(qFloor(rect.top())); | ||
| 58 | + region->addRect(rect); | ||
| 59 | + } | ||
| 60 | } | ||
| 61 | |||
| 62 | static inline QRectF clipIfValid(const QRectF &rect, const QRectF &clip) | ||
| 63 | @@ -2077,7 +2086,7 @@ static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const Q | ||
| 64 | |||
| 65 | QBrush bg = chf.background(); | ||
| 66 | if (bg.style() != Qt::NoBrush && !chf.property(SuppressBackground).toBool()) | ||
| 67 | - p->fillRect(r, bg); | ||
| 68 | + p->fillRect(QRectF(qFloor(r.x()), qFloor(r.y()), r.width(), r.height()), bg); | ||
| 69 | if (c.style() != Qt::NoBrush) { | ||
| 70 | p->setPen(QPen(c, 0)); | ||
| 71 | } | ||
| 72 | -- | ||
| 73 | 1.8.4 | ||
| 74 | |||
diff --git a/recipes-qt/qt5/qtbase.inc b/recipes-qt/qt5/qtbase.inc index 889ab998..ffb37ce4 100644 --- a/recipes-qt/qt5/qtbase.inc +++ b/recipes-qt/qt5/qtbase.inc | |||
| @@ -23,6 +23,7 @@ SRC_URI += " \ | |||
| 23 | file://0023-configure-make-freetype-a-configurable-option.patch \ | 23 | file://0023-configure-make-freetype-a-configurable-option.patch \ |
| 24 | file://0024-Use-OE_QMAKE_PATH_EXTERNAL_HOST_BINS-to-determine-pa.patch \ | 24 | file://0024-Use-OE_QMAKE_PATH_EXTERNAL_HOST_BINS-to-determine-pa.patch \ |
| 25 | file://0026-Ensure-lastPixel.y-is-also-initalized-to-1-when-nece.patch \ | 25 | file://0026-Ensure-lastPixel.y-is-also-initalized-to-1-when-nece.patch \ |
| 26 | file://0027-Fix-misaligned-selection-region-with-text-when-cente.patch \ | ||
| 26 | " | 27 | " |
| 27 | 28 | ||
| 28 | DEPENDS += "qtbase-native" | 29 | DEPENDS += "qtbase-native" |
