mirror of
https://github.com/KDE/konsole.git
synced 2025-12-23 23:38:08 -05:00
Fix ibeam and underline cursor rendering
Summary: Since anti-aliasing was enabled in the painter, coordinates need to be shifted half a pixel so that they align with the pixel grid, otherwise the result gets "blurred" due to the anti-aliasing. And as parts of the blurred shape leak outside the cursor rectangle, this also leaves artifacts when the cursor moves or blinks as these parts are not cleared. This is basically the same as commite7085310d6for the standard block cursor. BUG: 402589 Test Plan: - Switch cursor shape to "I-Beam" or "Underline" in the "Advanced" profile settings The cursors are a single line again now, before they were blurred by anti-aliasing. Screenshots: Before: {F6656366} {F6656370} After: {F6656371} {F6656373} Also, there are no more artifacts when the cursor is moved or cursor blinking is enabled. Reviewers: #konsole, hindenburg Reviewed By: #konsole, hindenburg Subscribers: hindenburg, konsole-devel Tags: #konsole Differential Revision: https://phabricator.kde.org/D19513 (cherry picked from commiteccfb1f62b)
This commit is contained in:
committed by
Kurt Hindenburg
parent
88e6dd5fec
commit
9af659c73e
@@ -958,16 +958,18 @@ void TerminalDisplay::drawCursor(QPainter& painter,
|
||||
}
|
||||
}
|
||||
} else if (_cursorShape == Enum::UnderlineCursor) {
|
||||
painter.drawLine(cursorRect.left(),
|
||||
cursorRect.bottom(),
|
||||
cursorRect.right(),
|
||||
cursorRect.bottom());
|
||||
QLineF line(cursorRect.left() + 0.5,
|
||||
cursorRect.bottom() - 0.5,
|
||||
cursorRect.right() - 0.5,
|
||||
cursorRect.bottom() - 0.5);
|
||||
painter.drawLine(line);
|
||||
|
||||
} else if (_cursorShape == Enum::IBeamCursor) {
|
||||
painter.drawLine(cursorRect.left(),
|
||||
cursorRect.top(),
|
||||
cursorRect.left(),
|
||||
cursorRect.bottom());
|
||||
QLineF line(cursorRect.left() + 0.5,
|
||||
cursorRect.top() + 0.5,
|
||||
cursorRect.left() + 0.5,
|
||||
cursorRect.bottom() - 0.5);
|
||||
painter.drawLine(line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user