revert failed fix
This commit is contained in:
@@ -101,10 +101,8 @@ 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 && software.isComplete(snapshot)) {
|
if (snapshot != null && snapshot.renderRows().size() == snapshot.rows()) {
|
||||||
software.paintFullOrShifted(gc, snapshot, px, py, width, height, active);
|
software.paintFullOrShifted(gc, snapshot, px, py, width, height, active);
|
||||||
} else if (!software.canPaintPartial(snapshot)) {
|
|
||||||
software.paintFullOrShifted(gc, target.snapshotFull(), px, py, width, height, active);
|
|
||||||
} else {
|
} else {
|
||||||
software.paintDirty(gc, snapshot, px, py, width, height, active);
|
software.paintDirty(gc, snapshot, px, py, width, height, active);
|
||||||
}
|
}
|
||||||
@@ -681,16 +679,10 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
|||||||
private long[] rowHashes = new long[0];
|
private long[] rowHashes = new long[0];
|
||||||
private CursorState lastCursor = CursorState.none();
|
private CursorState lastCursor = CursorState.none();
|
||||||
private GlyphCache glyphs;
|
private GlyphCache glyphs;
|
||||||
private boolean fullFrameReady;
|
|
||||||
|
|
||||||
private void invalidate() {
|
private void invalidate() {
|
||||||
rowHashes = new long[0];
|
rowHashes = new long[0];
|
||||||
lastCursor = CursorState.none();
|
lastCursor = CursorState.none();
|
||||||
fullFrameReady = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean canPaintPartial(RenderStateSnapshot snapshot) {
|
|
||||||
return fullFrameReady && snapshot != null && rowHashes.length == snapshot.rows();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void paintFull(GraphicsContext gc, RenderStateSnapshot snapshot,
|
private void paintFull(GraphicsContext gc, RenderStateSnapshot snapshot,
|
||||||
@@ -701,7 +693,6 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
|||||||
paintSnapshot(snapshot);
|
paintSnapshot(snapshot);
|
||||||
drawCursor(snapshot);
|
drawCursor(snapshot);
|
||||||
rememberSnapshot(snapshot);
|
rememberSnapshot(snapshot);
|
||||||
fullFrameReady = isComplete(snapshot);
|
|
||||||
} else {
|
} else {
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
@@ -739,7 +730,6 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastCursor = cursor;
|
lastCursor = cursor;
|
||||||
fullFrameReady = true;
|
|
||||||
drawCursor(snapshot);
|
drawCursor(snapshot);
|
||||||
drawBorder(active);
|
drawBorder(active);
|
||||||
present(gc, px, py);
|
present(gc, px, py);
|
||||||
@@ -751,7 +741,8 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
|||||||
if (snapshot == null) {
|
if (snapshot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!canPaintPartial(snapshot)) {
|
if (rowHashes.length != snapshot.rows()) {
|
||||||
|
paintFull(gc, snapshot, px, py, paneWidth, paneHeight, active);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -775,7 +766,6 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
|||||||
}
|
}
|
||||||
repaintCursorRow(snapshot, newCursorRow, repainted);
|
repaintCursorRow(snapshot, newCursorRow, repainted);
|
||||||
lastCursor = cursor;
|
lastCursor = cursor;
|
||||||
fullFrameReady = true;
|
|
||||||
drawCursor(snapshot);
|
drawCursor(snapshot);
|
||||||
drawBorder(active);
|
drawBorder(active);
|
||||||
present(gc, px, py);
|
present(gc, px, py);
|
||||||
@@ -835,19 +825,7 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean canDiff(RenderStateSnapshot snapshot) {
|
private boolean canDiff(RenderStateSnapshot snapshot) {
|
||||||
return fullFrameReady && rowHashes.length == snapshot.rows() && isComplete(snapshot);
|
return rowHashes.length == snapshot.rows() && snapshot.renderRows().size() == snapshot.rows();
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isComplete(RenderStateSnapshot snapshot) {
|
|
||||||
if (snapshot.renderRows().size() != snapshot.rows()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < snapshot.renderRows().size(); i++) {
|
|
||||||
if (snapshot.renderRows().get(i).row() != i) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rememberSnapshot(RenderStateSnapshot snapshot) {
|
private void rememberSnapshot(RenderStateSnapshot snapshot) {
|
||||||
@@ -878,11 +856,13 @@ final class GhosttyTerminalRenderer extends TerminalRenderer {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int score = 0;
|
int score = 0;
|
||||||
|
int overlap = 0;
|
||||||
for (int row = 0; row < rows; row++) {
|
for (int row = 0; row < rows; row++) {
|
||||||
int previous = row - delta;
|
int previous = row - delta;
|
||||||
if (previous < 0 || previous >= rows) {
|
if (previous < 0 || previous >= rows) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
overlap++;
|
||||||
if (currentHashes[row] == rowHashes[previous]) {
|
if (currentHashes[row] == rowHashes[previous]) {
|
||||||
score++;
|
score++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user