All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-qt5][PATCH] qtbase: add upstream QTBUG-34218/QTBUG-34234 misaligned selection patch
@ 2013-10-24 10:56 Jonathan Liu
  2013-10-29 10:48 ` Martin Jansa
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Liu @ 2013-10-24 10:56 UTC (permalink / raw)
  To: openembedded-devel

Signed-off-by: Jonathan Liu <net147@gmail.com>
---
 ...ned-selection-region-with-text-when-cente.patch | 74 ++++++++++++++++++++++
 ...ned-selection-region-with-text-when-cente.patch | 74 ++++++++++++++++++++++
 recipes-qt/qt5/qtbase.inc                          |  1 +
 3 files changed, 149 insertions(+)
 create mode 100644 recipes-qt/qt5/qtbase-5.1.1/0027-Fix-misaligned-selection-region-with-text-when-cente.patch
 create mode 100644 recipes-qt/qt5/qtbase-git/0027-Fix-misaligned-selection-region-with-text-when-cente.patch

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 0000000..d5e082e
--- /dev/null
+++ b/recipes-qt/qt5/qtbase-5.1.1/0027-Fix-misaligned-selection-region-with-text-when-cente.patch
@@ -0,0 +1,74 @@
+From 5d8a882c11201a29475c5ea71cfb76c9de6573f5 Mon Sep 17 00:00:00 2001
+From: Jonathan Liu <net147@gmail.com>
+Date: Wed, 23 Oct 2013 00:28:17 +1100
+Subject: [PATCH] Fix misaligned selection region with text when centered
+
+If the text is centered, the x/y position in the selection QRectF may
+be a multiple of 0.5 which is rounded up. This rounding causes
+misalignment of the selection region with the text.
+
+The alignment is fixed by using qFloor on the x and y components.
+
+Upstream-Status: Accepted [https://codereview.qt-project.org/#change,68842]
+Signed-off-by: Jonathan Liu <net147@gmail.com>
+
+Task-number: QTBUG-34218
+Task-number: QTBUG-34234
+Change-Id: I4f2fadeb38602f62a93773c6e5faecf03b28069f
+Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
+---
+ src/gui/text/qtextlayout.cpp | 19 ++++++++++++++-----
+ 1 file changed, 14 insertions(+), 5 deletions(-)
+
+diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
+index 54d337e..66341e1 100644
+--- a/src/gui/text/qtextlayout.cpp
++++ b/src/gui/text/qtextlayout.cpp
+@@ -44,6 +44,7 @@
+ 
+ #include <qthread.h>
+ #include <qfont.h>
++#include <qmath.h>
+ #include <qpainter.h>
+ #include <qvarlengtharray.h>
+ #include <qtextformat.h>
+@@ -946,15 +947,23 @@ static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPo
+                 continue;
+             }
+ 
+-            if (lastSelectionWidth > 0)
+-                region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight));
++            if (lastSelectionWidth > 0) {
++                QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight);
++                rect.moveLeft(qFloor(rect.left()));
++                rect.moveTop(qFloor(rect.top()));
++                region->addRect(rect);
++            }
+ 
+             lastSelectionX = selectionX;
+             lastSelectionWidth = selectionWidth;
+         }
+     }
+-    if (lastSelectionWidth > 0)
+-        region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight));
++    if (lastSelectionWidth > 0) {
++        QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight);
++        rect.moveLeft(qFloor(rect.left()));
++        rect.moveTop(qFloor(rect.top()));
++        region->addRect(rect);
++    }
+ }
+ 
+ static inline QRectF clipIfValid(const QRectF &rect, const QRectF &clip)
+@@ -2077,7 +2086,7 @@ static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const Q
+ 
+     QBrush bg = chf.background();
+     if (bg.style() != Qt::NoBrush && !chf.property(SuppressBackground).toBool())
+-        p->fillRect(r, bg);
++        p->fillRect(QRectF(qFloor(r.x()), qFloor(r.y()), r.width(), r.height()), bg);
+     if (c.style() != Qt::NoBrush) {
+         p->setPen(QPen(c, 0));
+     }
+-- 
+1.8.4
+
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 0000000..d5e082e
--- /dev/null
+++ b/recipes-qt/qt5/qtbase-git/0027-Fix-misaligned-selection-region-with-text-when-cente.patch
@@ -0,0 +1,74 @@
+From 5d8a882c11201a29475c5ea71cfb76c9de6573f5 Mon Sep 17 00:00:00 2001
+From: Jonathan Liu <net147@gmail.com>
+Date: Wed, 23 Oct 2013 00:28:17 +1100
+Subject: [PATCH] Fix misaligned selection region with text when centered
+
+If the text is centered, the x/y position in the selection QRectF may
+be a multiple of 0.5 which is rounded up. This rounding causes
+misalignment of the selection region with the text.
+
+The alignment is fixed by using qFloor on the x and y components.
+
+Upstream-Status: Accepted [https://codereview.qt-project.org/#change,68842]
+Signed-off-by: Jonathan Liu <net147@gmail.com>
+
+Task-number: QTBUG-34218
+Task-number: QTBUG-34234
+Change-Id: I4f2fadeb38602f62a93773c6e5faecf03b28069f
+Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
+---
+ src/gui/text/qtextlayout.cpp | 19 ++++++++++++++-----
+ 1 file changed, 14 insertions(+), 5 deletions(-)
+
+diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
+index 54d337e..66341e1 100644
+--- a/src/gui/text/qtextlayout.cpp
++++ b/src/gui/text/qtextlayout.cpp
+@@ -44,6 +44,7 @@
+ 
+ #include <qthread.h>
+ #include <qfont.h>
++#include <qmath.h>
+ #include <qpainter.h>
+ #include <qvarlengtharray.h>
+ #include <qtextformat.h>
+@@ -946,15 +947,23 @@ static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPo
+                 continue;
+             }
+ 
+-            if (lastSelectionWidth > 0)
+-                region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight));
++            if (lastSelectionWidth > 0) {
++                QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight);
++                rect.moveLeft(qFloor(rect.left()));
++                rect.moveTop(qFloor(rect.top()));
++                region->addRect(rect);
++            }
+ 
+             lastSelectionX = selectionX;
+             lastSelectionWidth = selectionWidth;
+         }
+     }
+-    if (lastSelectionWidth > 0)
+-        region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight));
++    if (lastSelectionWidth > 0) {
++        QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight);
++        rect.moveLeft(qFloor(rect.left()));
++        rect.moveTop(qFloor(rect.top()));
++        region->addRect(rect);
++    }
+ }
+ 
+ static inline QRectF clipIfValid(const QRectF &rect, const QRectF &clip)
+@@ -2077,7 +2086,7 @@ static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const Q
+ 
+     QBrush bg = chf.background();
+     if (bg.style() != Qt::NoBrush && !chf.property(SuppressBackground).toBool())
+-        p->fillRect(r, bg);
++        p->fillRect(QRectF(qFloor(r.x()), qFloor(r.y()), r.width(), r.height()), bg);
+     if (c.style() != Qt::NoBrush) {
+         p->setPen(QPen(c, 0));
+     }
+-- 
+1.8.4
+
diff --git a/recipes-qt/qt5/qtbase.inc b/recipes-qt/qt5/qtbase.inc
index 889ab99..575621f 100644
--- a/recipes-qt/qt5/qtbase.inc
+++ b/recipes-qt/qt5/qtbase.inc
@@ -23,6 +23,7 @@ SRC_URI += " \
     file://0023-configure-make-freetype-a-configurable-option.patch \
     file://0024-Use-OE_QMAKE_PATH_EXTERNAL_HOST_BINS-to-determine-pa.patch \
     file://0026-Ensure-lastPixel.y-is-also-initalized-to-1-when-nece.patch \
+    file://0027-Fix-misaligned-selection-region-with-text-when-cente.patch
 "
 
 DEPENDS += "qtbase-native"
-- 
1.8.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [meta-qt5][PATCH] qtbase: add upstream QTBUG-34218/QTBUG-34234 misaligned selection patch
  2013-10-24 10:56 [meta-qt5][PATCH] qtbase: add upstream QTBUG-34218/QTBUG-34234 misaligned selection patch Jonathan Liu
@ 2013-10-29 10:48 ` Martin Jansa
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Jansa @ 2013-10-29 10:48 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 8749 bytes --]

On Thu, Oct 24, 2013 at 09:56:37PM +1100, Jonathan Liu wrote:
> Signed-off-by: Jonathan Liu <net147@gmail.com>
> ---
>  ...ned-selection-region-with-text-when-cente.patch | 74 ++++++++++++++++++++++
>  ...ned-selection-region-with-text-when-cente.patch | 74 ++++++++++++++++++++++
>  recipes-qt/qt5/qtbase.inc                          |  1 +
>  3 files changed, 149 insertions(+)
>  create mode 100644 recipes-qt/qt5/qtbase-5.1.1/0027-Fix-misaligned-selection-region-with-text-when-cente.patch
>  create mode 100644 recipes-qt/qt5/qtbase-git/0027-Fix-misaligned-selection-region-with-text-when-cente.patch
> 
> 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 0000000..d5e082e
> --- /dev/null
> +++ b/recipes-qt/qt5/qtbase-5.1.1/0027-Fix-misaligned-selection-region-with-text-when-cente.patch
> @@ -0,0 +1,74 @@
> +From 5d8a882c11201a29475c5ea71cfb76c9de6573f5 Mon Sep 17 00:00:00 2001
> +From: Jonathan Liu <net147@gmail.com>
> +Date: Wed, 23 Oct 2013 00:28:17 +1100
> +Subject: [PATCH] Fix misaligned selection region with text when centered
> +
> +If the text is centered, the x/y position in the selection QRectF may
> +be a multiple of 0.5 which is rounded up. This rounding causes
> +misalignment of the selection region with the text.
> +
> +The alignment is fixed by using qFloor on the x and y components.
> +
> +Upstream-Status: Accepted [https://codereview.qt-project.org/#change,68842]
> +Signed-off-by: Jonathan Liu <net147@gmail.com>
> +
> +Task-number: QTBUG-34218
> +Task-number: QTBUG-34234
> +Change-Id: I4f2fadeb38602f62a93773c6e5faecf03b28069f
> +Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
> +---
> + src/gui/text/qtextlayout.cpp | 19 ++++++++++++++-----
> + 1 file changed, 14 insertions(+), 5 deletions(-)
> +
> +diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
> +index 54d337e..66341e1 100644
> +--- a/src/gui/text/qtextlayout.cpp
> ++++ b/src/gui/text/qtextlayout.cpp
> +@@ -44,6 +44,7 @@
> + 
> + #include <qthread.h>
> + #include <qfont.h>
> ++#include <qmath.h>
> + #include <qpainter.h>
> + #include <qvarlengtharray.h>
> + #include <qtextformat.h>
> +@@ -946,15 +947,23 @@ static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPo
> +                 continue;
> +             }
> + 
> +-            if (lastSelectionWidth > 0)
> +-                region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight));
> ++            if (lastSelectionWidth > 0) {
> ++                QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight);
> ++                rect.moveLeft(qFloor(rect.left()));
> ++                rect.moveTop(qFloor(rect.top()));
> ++                region->addRect(rect);
> ++            }
> + 
> +             lastSelectionX = selectionX;
> +             lastSelectionWidth = selectionWidth;
> +         }
> +     }
> +-    if (lastSelectionWidth > 0)
> +-        region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight));
> ++    if (lastSelectionWidth > 0) {
> ++        QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight);
> ++        rect.moveLeft(qFloor(rect.left()));
> ++        rect.moveTop(qFloor(rect.top()));
> ++        region->addRect(rect);
> ++    }
> + }
> + 
> + static inline QRectF clipIfValid(const QRectF &rect, const QRectF &clip)
> +@@ -2077,7 +2086,7 @@ static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const Q
> + 
> +     QBrush bg = chf.background();
> +     if (bg.style() != Qt::NoBrush && !chf.property(SuppressBackground).toBool())
> +-        p->fillRect(r, bg);
> ++        p->fillRect(QRectF(qFloor(r.x()), qFloor(r.y()), r.width(), r.height()), bg);
> +     if (c.style() != Qt::NoBrush) {
> +         p->setPen(QPen(c, 0));
> +     }
> +-- 
> +1.8.4
> +
> 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 0000000..d5e082e
> --- /dev/null
> +++ b/recipes-qt/qt5/qtbase-git/0027-Fix-misaligned-selection-region-with-text-when-cente.patch
> @@ -0,0 +1,74 @@
> +From 5d8a882c11201a29475c5ea71cfb76c9de6573f5 Mon Sep 17 00:00:00 2001
> +From: Jonathan Liu <net147@gmail.com>
> +Date: Wed, 23 Oct 2013 00:28:17 +1100
> +Subject: [PATCH] Fix misaligned selection region with text when centered
> +
> +If the text is centered, the x/y position in the selection QRectF may
> +be a multiple of 0.5 which is rounded up. This rounding causes
> +misalignment of the selection region with the text.
> +
> +The alignment is fixed by using qFloor on the x and y components.
> +
> +Upstream-Status: Accepted [https://codereview.qt-project.org/#change,68842]
> +Signed-off-by: Jonathan Liu <net147@gmail.com>
> +
> +Task-number: QTBUG-34218
> +Task-number: QTBUG-34234
> +Change-Id: I4f2fadeb38602f62a93773c6e5faecf03b28069f
> +Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
> +---
> + src/gui/text/qtextlayout.cpp | 19 ++++++++++++++-----
> + 1 file changed, 14 insertions(+), 5 deletions(-)
> +
> +diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
> +index 54d337e..66341e1 100644
> +--- a/src/gui/text/qtextlayout.cpp
> ++++ b/src/gui/text/qtextlayout.cpp
> +@@ -44,6 +44,7 @@
> + 
> + #include <qthread.h>
> + #include <qfont.h>
> ++#include <qmath.h>
> + #include <qpainter.h>
> + #include <qvarlengtharray.h>
> + #include <qtextformat.h>
> +@@ -946,15 +947,23 @@ static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPo
> +                 continue;
> +             }
> + 
> +-            if (lastSelectionWidth > 0)
> +-                region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight));
> ++            if (lastSelectionWidth > 0) {
> ++                QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight);
> ++                rect.moveLeft(qFloor(rect.left()));
> ++                rect.moveTop(qFloor(rect.top()));
> ++                region->addRect(rect);
> ++            }
> + 
> +             lastSelectionX = selectionX;
> +             lastSelectionWidth = selectionWidth;
> +         }
> +     }
> +-    if (lastSelectionWidth > 0)
> +-        region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight));
> ++    if (lastSelectionWidth > 0) {
> ++        QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight);
> ++        rect.moveLeft(qFloor(rect.left()));
> ++        rect.moveTop(qFloor(rect.top()));
> ++        region->addRect(rect);
> ++    }
> + }
> + 
> + static inline QRectF clipIfValid(const QRectF &rect, const QRectF &clip)
> +@@ -2077,7 +2086,7 @@ static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const Q
> + 
> +     QBrush bg = chf.background();
> +     if (bg.style() != Qt::NoBrush && !chf.property(SuppressBackground).toBool())
> +-        p->fillRect(r, bg);
> ++        p->fillRect(QRectF(qFloor(r.x()), qFloor(r.y()), r.width(), r.height()), bg);
> +     if (c.style() != Qt::NoBrush) {
> +         p->setPen(QPen(c, 0));
> +     }
> +-- 
> +1.8.4
> +
> diff --git a/recipes-qt/qt5/qtbase.inc b/recipes-qt/qt5/qtbase.inc
> index 889ab99..575621f 100644
> --- a/recipes-qt/qt5/qtbase.inc
> +++ b/recipes-qt/qt5/qtbase.inc
> @@ -23,6 +23,7 @@ SRC_URI += " \
>      file://0023-configure-make-freetype-a-configurable-option.patch \
>      file://0024-Use-OE_QMAKE_PATH_EXTERNAL_HOST_BINS-to-determine-pa.patch \
>      file://0026-Ensure-lastPixel.y-is-also-initalized-to-1-when-nece.patch \
> +    file://0027-Fix-misaligned-selection-region-with-text-when-cente.patch

Missing \, but I've already fixed it locally, so you don't need to
resend.

>  "
>  
>  DEPENDS += "qtbase-native"
> -- 
> 1.8.4
> 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-29 11:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-24 10:56 [meta-qt5][PATCH] qtbase: add upstream QTBUG-34218/QTBUG-34234 misaligned selection patch Jonathan Liu
2013-10-29 10:48 ` Martin Jansa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.