backported patch to optimize insertionPointsForLine
This commit is contained in:
parent
4a376dc703
commit
e56d897d9c
@ -120,6 +120,7 @@ Patch69: qt5-qtbase-glibc.patch
|
||||
|
||||
## upstream patches
|
||||
Patch500: qtbase-everywhere-src-5.11.2-rendering-issue.patch
|
||||
Patch501: qtbase-everywhere-src-5.11.2-optimize-insertionPointsForLine.patch
|
||||
|
||||
# Do not check any files in %%{_qt5_plugindir}/platformthemes/ for requires.
|
||||
# Those themes are there for platform integration. If the required libraries are
|
||||
@ -378,6 +379,7 @@ Qt5 libraries used for drawing widgets and OpenGL items.
|
||||
|
||||
## upstream patches
|
||||
%patch500 -p1 -b .rendering-issue
|
||||
%patch501 -p1 -b .optimize-insertionPointsForLine
|
||||
|
||||
# move some bundled libs to ensure they're not accidentally used
|
||||
pushd src/3rdparty
|
||||
@ -988,6 +990,7 @@ fi
|
||||
%changelog
|
||||
* Thu Oct 25 2018 Than Ngo <than@redhat.com> - 5.11.2-3
|
||||
- backported patch to fix selection rendering issues if rounding leads to left-out pixels
|
||||
- backported patch to optimize insertionPointsForLine
|
||||
|
||||
* Thu Oct 11 2018 Rex Dieter <rdieter@fedoraproject.org> - 5.11.2-2
|
||||
- -no-use-gold-linker (#1635973)
|
||||
|
@ -0,0 +1,105 @@
|
||||
diff -up qtbase-everywhere-src-5.11.2/src/gui/text/qtextengine.cpp.me qtbase-everywhere-src-5.11.2/src/gui/text/qtextengine.cpp
|
||||
--- qtbase-everywhere-src-5.11.2/src/gui/text/qtextengine.cpp.me 2018-10-25 11:30:37.371800942 +0200
|
||||
+++ qtbase-everywhere-src-5.11.2/src/gui/text/qtextengine.cpp 2018-10-25 11:36:24.496953609 +0200
|
||||
@@ -3663,11 +3663,12 @@ int QTextEngine::lineNumberForTextPositi
|
||||
return -1;
|
||||
}
|
||||
|
||||
-void QTextEngine::insertionPointsForLine(int lineNum, QVector<int> &insertionPoints)
|
||||
+std::vector<int> QTextEngine::insertionPointsForLine(int lineNum)
|
||||
{
|
||||
QTextLineItemIterator iterator(this, lineNum);
|
||||
|
||||
- insertionPoints.reserve(iterator.line.length);
|
||||
+ std::vector<int> insertionPoints;
|
||||
+ insertionPoints.reserve(size_t(iterator.line.length));
|
||||
|
||||
bool lastLine = lineNum >= lines.size() - 1;
|
||||
|
||||
@@ -3685,25 +3686,22 @@ void QTextEngine::insertionPointsForLine
|
||||
insertionPoints.push_back(i);
|
||||
}
|
||||
}
|
||||
+ return insertionPoints;
|
||||
}
|
||||
|
||||
int QTextEngine::endOfLine(int lineNum)
|
||||
{
|
||||
- QVector<int> insertionPoints;
|
||||
- insertionPointsForLine(lineNum, insertionPoints);
|
||||
-
|
||||
+ const auto insertionPoints = insertionPointsForLine(lineNum);
|
||||
if (insertionPoints.size() > 0)
|
||||
- return insertionPoints.constLast();
|
||||
+ return insertionPoints.back();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QTextEngine::beginningOfLine(int lineNum)
|
||||
{
|
||||
- QVector<int> insertionPoints;
|
||||
- insertionPointsForLine(lineNum, insertionPoints);
|
||||
-
|
||||
+ const auto insertionPoints = insertionPointsForLine(lineNum);
|
||||
if (insertionPoints.size() > 0)
|
||||
- return insertionPoints.constFirst();
|
||||
+ return insertionPoints.front();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3720,10 +3718,8 @@ int QTextEngine::positionAfterVisualMove
|
||||
if (lineNum < 0)
|
||||
return pos;
|
||||
|
||||
- QVector<int> insertionPoints;
|
||||
- insertionPointsForLine(lineNum, insertionPoints);
|
||||
- int i, max = insertionPoints.size();
|
||||
- for (i = 0; i < max; i++)
|
||||
+ const auto insertionPoints = insertionPointsForLine(lineNum);
|
||||
+ for (size_t i = 0, max = insertionPoints.size(); i < max; ++i)
|
||||
if (pos == insertionPoints[i]) {
|
||||
if (moveRight) {
|
||||
if (i + 1 < max)
|
||||
diff -up qtbase-everywhere-src-5.11.2/src/gui/text/qtextengine_p.h.me qtbase-everywhere-src-5.11.2/src/gui/text/qtextengine_p.h
|
||||
--- qtbase-everywhere-src-5.11.2/src/gui/text/qtextengine_p.h.me 2018-10-25 11:36:39.243002574 +0200
|
||||
+++ qtbase-everywhere-src-5.11.2/src/gui/text/qtextengine_p.h 2018-10-25 11:37:45.966224143 +0200
|
||||
@@ -74,6 +74,7 @@
|
||||
#include <private/qunicodetools_p.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
+#include <vector>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -632,7 +633,7 @@ public:
|
||||
int nextLogicalPosition(int oldPos) const;
|
||||
int lineNumberForTextPosition(int pos);
|
||||
int positionAfterVisualMovement(int oldPos, QTextCursor::MoveOperation op);
|
||||
- void insertionPointsForLine(int lineNum, QVector<int> &insertionPoints);
|
||||
+ std::vector<int> insertionPointsForLine(int lineNum);
|
||||
void resetFontEngineCache();
|
||||
|
||||
void enableDelayDecorations(bool enable = true) { delayDecorations = enable; }
|
||||
diff -up qtbase-everywhere-src-5.11.2/src/gui/text/qtextlayout.cpp.me qtbase-everywhere-src-5.11.2/src/gui/text/qtextlayout.cpp
|
||||
--- qtbase-everywhere-src-5.11.2/src/gui/text/qtextlayout.cpp.me 2018-10-25 11:38:04.426285436 +0200
|
||||
+++ qtbase-everywhere-src-5.11.2/src/gui/text/qtextlayout.cpp 2018-10-25 11:40:23.919748643 +0200
|
||||
@@ -2841,9 +2841,7 @@ int QTextLine::xToCursor(qreal _x, Curso
|
||||
bool rtl = eng->isRightToLeft();
|
||||
|
||||
eng->shapeLine(line);
|
||||
- QVector<int> insertionPoints;
|
||||
- if (visual && rtl)
|
||||
- eng->insertionPointsForLine(lineNum, insertionPoints);
|
||||
+ const auto insertionPoints = (visual && rtl) ? eng->insertionPointsForLine(lineNum) : std::vector<int>();
|
||||
int nchars = 0;
|
||||
for (int i = 0; i < nItems; ++i) {
|
||||
int item = visualOrder[i]+firstItem;
|
||||
@@ -2975,7 +2973,7 @@ int QTextLine::xToCursor(qreal _x, Curso
|
||||
continue;
|
||||
}
|
||||
if (rtl && nchars > 0)
|
||||
- return insertionPoints[lastLine ? nchars : nchars - 1];
|
||||
+ return insertionPoints[size_t(lastLine ? nchars : nchars - 1)];
|
||||
}
|
||||
return eng->positionInLigature(&si, end, x, pos, -1,
|
||||
cpos == QTextLine::CursorOnCharacter);
|
Loading…
Reference in New Issue
Block a user