Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Konsole
Commits
b6a945e4
Commit
b6a945e4
authored
Aug 06, 2020
by
Martin Tobias Holmedahl Sandsmark
Committed by
Kurt Hindenburg
Sep 18, 2020
Browse files
improve performance of Konsole::Screen::moveImage with more than 2x.
parent
2ec02d1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Screen.cpp
View file @
b6a945e4
...
...
@@ -790,6 +790,7 @@ void Screen::displayCharacter(uint c)
// ensure current line vector has enough elements
if
(
_screenLines
[
_cuY
].
size
()
<
_cuX
+
w
)
{
_screenLines
[
_cuY
].
reserve
(
_columns
);
_screenLines
[
_cuY
].
resize
(
_cuX
+
w
);
}
...
...
@@ -1005,15 +1006,17 @@ void Screen::moveImage(int dest, int sourceBegin, int sourceEnd)
//so it matters that we do the copy in the right order -
//forwards if dest < sourceBegin or backwards otherwise.
//(search the web for 'memmove implementation' for details)
const
int
destY
=
dest
/
_columns
;
const
int
srcY
=
sourceBegin
/
_columns
;
if
(
dest
<
sourceBegin
)
{
for
(
int
i
=
0
;
i
<=
lines
;
i
++
)
{
_screenLines
[
(
dest
/
_columns
)
+
i
]
=
_screenLines
[
(
sourceBegin
/
_columns
)
+
i
];
_lineProperties
[
(
dest
/
_columns
)
+
i
]
=
_lineProperties
[
(
sourceBegin
/
_columns
)
+
i
];
_screenLines
[
dest
Y
+
i
]
=
std
::
move
(
_screenLines
[
srcY
+
i
]
)
;
_lineProperties
[
dest
Y
+
i
]
=
_lineProperties
[
srcY
+
i
];
}
}
else
{
for
(
int
i
=
lines
;
i
>=
0
;
i
--
)
{
_screenLines
[
(
dest
/
_columns
)
+
i
]
=
_screenLines
[(
sourceBegin
/
_columns
)
+
i
];
_lineProperties
[
(
dest
/
_columns
)
+
i
]
=
_lineProperties
[
(
sourceBegin
/
_columns
)
+
i
];
_screenLines
[
dest
Y
+
i
]
=
std
::
move
(
_screenLines
[
srcY
+
i
]
)
;
_lineProperties
[
dest
Y
+
i
]
=
_lineProperties
[
srcY
+
i
];
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment