Commit fac05b71 authored by Matan Ziv-Av's avatar Matan Ziv-Av Committed by Tomaz Canabrava
Browse files

Correctly fill the cell with background color for text drawn above images with negative z-index

Still needs some work.
parent c87b8033
Pipeline #179883 passed with stage
in 2 minutes and 34 seconds
......@@ -243,9 +243,20 @@ void Screen::eraseChars(int n)
void Screen::eraseBlock(int y, int x, int height, int width)
{
width = qBound(0, width, _columns - x - 1);
int endCol = x + width;
height = qBound(0, height, _lines - y - 1);
Character chr(' ', CharacterColor(COLOR_SPACE_DEFAULT, DEFAULT_FORE_COLOR), CharacterColor(COLOR_SPACE_DEFAULT, DEFAULT_BACK_COLOR), RE_CONCEAL, false);
for (int row = y; row < y + height; row++) {
clearImage(loc(x, row), loc(x + width - 1, row), ' ', false);
QVector<Character> &line = _screenLines[row];
if (line.size() < endCol + 1) {
line.resize(endCol + 1);
}
if (endCol == _columns - 1) {
line.resize(endCol + 1);
}
if (x <= endCol) {
std::fill(line.begin() + x, line.begin() + (endCol + 1), chr);
}
}
}
......
......@@ -426,10 +426,6 @@ void TerminalPainter::drawTextFragment(QPainter &painter,
}
}
if (backgroundColor != colorTable[DEFAULT_BACK_COLOR]) {
drawBackground(painter, rect, backgroundColor, false);
}
const auto display = qobject_cast<TerminalDisplay *>(sender());
Screen *screen = display->screenWindow()->screen();
int placementIdx = 0;
......@@ -455,6 +451,15 @@ void TerminalPainter::drawTextFragment(QPainter &painter,
painter.setOpacity(opacity);
}
bool drawBG = backgroundColor != colorTable[DEFAULT_BACK_COLOR];
if (screen->hasGraphics() && style.rendition == RE_CONCEAL) {
drawBG = false;
}
if (drawBG) {
drawBackground(painter, rect, backgroundColor, false);
}
QColor characterColor = foregroundColor;
if ((style.rendition & RE_CURSOR) != 0) {
drawCursor(painter, rect, foregroundColor, backgroundColor, characterColor);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment