clear context new fix
This commit is contained in:
@@ -101,11 +101,7 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
|||||||
if (dirty == DIRTY_FULL) {
|
if (dirty == DIRTY_FULL) {
|
||||||
software.paintFullOrShifted(gc, target.snapshotFull(), px, py, width, height, active);
|
software.paintFullOrShifted(gc, target.snapshotFull(), px, py, width, height, active);
|
||||||
} else if (dirty == DIRTY_PARTIAL) {
|
} else if (dirty == DIRTY_PARTIAL) {
|
||||||
if (snapshot != null && snapshot.renderRows().size() == snapshot.rows()) {
|
software.paintDirty(gc, target, snapshot, px, py, width, height, active);
|
||||||
software.paintFullOrShifted(gc, snapshot, px, py, width, height, active);
|
|
||||||
} else {
|
|
||||||
software.paintDirty(gc, snapshot, px, py, width, height, active);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// dirty == FALSE: nothing visible changed.
|
// dirty == FALSE: nothing visible changed.
|
||||||
}
|
}
|
||||||
@@ -735,14 +731,14 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
|||||||
present(gc, px, py);
|
present(gc, px, py);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void paintDirty(GraphicsContext gc, RenderStateSnapshot snapshot,
|
private void paintDirty(GraphicsContext gc, RenderTarget target, RenderStateSnapshot snapshot,
|
||||||
double px, double py, double paneWidth, double paneHeight, boolean active) {
|
double px, double py, double paneWidth, double paneHeight, boolean active) {
|
||||||
ensure(paneWidth, paneHeight);
|
ensure(paneWidth, paneHeight);
|
||||||
if (snapshot == null) {
|
if (snapshot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (rowHashes.length != snapshot.rows()) {
|
if (rowHashes.length != snapshot.rows()) {
|
||||||
paintFull(gc, snapshot, px, py, paneWidth, paneHeight, active);
|
paintFull(gc, target.snapshotFull(), px, py, paneWidth, paneHeight, active);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -751,6 +747,7 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
|||||||
int newCursorRow = cursor.viewportRow();
|
int newCursorRow = cursor.viewportRow();
|
||||||
boolean cursorChanged = !cursor.equals(lastCursor);
|
boolean cursorChanged = !cursor.equals(lastCursor);
|
||||||
boolean[] repainted = new boolean[snapshot.rows()];
|
boolean[] repainted = new boolean[snapshot.rows()];
|
||||||
|
boolean needsCursorDraw = cursorChanged;
|
||||||
|
|
||||||
for (RenderRow row : snapshot.renderRows()) {
|
for (RenderRow row : snapshot.renderRows()) {
|
||||||
if (!row.dirty()) {
|
if (!row.dirty()) {
|
||||||
@@ -759,28 +756,46 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
|||||||
paintRow(row);
|
paintRow(row);
|
||||||
rowHashes[row.row()] = rowHash(row);
|
rowHashes[row.row()] = rowHash(row);
|
||||||
repainted[row.row()] = true;
|
repainted[row.row()] = true;
|
||||||
|
if (row.row() == newCursorRow) {
|
||||||
|
needsCursorDraw = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursorChanged) {
|
if (cursorChanged) {
|
||||||
repaintCursorRow(snapshot, oldCursorRow, repainted);
|
if (!repaintCursorRow(snapshot, oldCursorRow, repainted)) {
|
||||||
|
paintFullOrShifted(gc, target.snapshotFull(), px, py, paneWidth, paneHeight, active);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (repaintedRowHasCursor(newCursorRow, repainted)
|
||||||
|
&& !repaintCursorRow(snapshot, newCursorRow, repainted)) {
|
||||||
|
paintFullOrShifted(gc, target.snapshotFull(), px, py, paneWidth, paneHeight, active);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
repaintCursorRow(snapshot, newCursorRow, repainted);
|
|
||||||
lastCursor = cursor;
|
lastCursor = cursor;
|
||||||
|
if (needsCursorDraw) {
|
||||||
drawCursor(snapshot);
|
drawCursor(snapshot);
|
||||||
|
}
|
||||||
drawBorder(active);
|
drawBorder(active);
|
||||||
present(gc, px, py);
|
present(gc, px, py);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void repaintCursorRow(RenderStateSnapshot snapshot, int rowIndex, boolean[] repainted) {
|
private boolean repaintCursorRow(RenderStateSnapshot snapshot, int rowIndex, boolean[] repainted) {
|
||||||
if (rowIndex < 0 || rowIndex >= repainted.length || repainted[rowIndex]) {
|
if (rowIndex < 0 || rowIndex >= repainted.length || repainted[rowIndex]) {
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
RenderRow row = rowByIndex(snapshot, rowIndex);
|
RenderRow row = rowByIndex(snapshot, rowIndex);
|
||||||
if (row != null) {
|
if (row == null || !row.dirty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
paintRow(row);
|
paintRow(row);
|
||||||
rowHashes[rowIndex] = rowHash(row);
|
rowHashes[rowIndex] = rowHash(row);
|
||||||
repainted[rowIndex] = true;
|
repainted[rowIndex] = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean repaintedRowHasCursor(int rowIndex, boolean[] repainted) {
|
||||||
|
return rowIndex >= 0 && rowIndex < repainted.length && repainted[rowIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
private RenderRow rowByIndex(RenderStateSnapshot snapshot, int rowIndex) {
|
private RenderRow rowByIndex(RenderStateSnapshot snapshot, int rowIndex) {
|
||||||
|
|||||||
Reference in New Issue
Block a user