Don't clear the dirty flag on rasters updated mid-scan (eliminate random stray pixels)

This commit is contained in:
Brendan Robert 2024-03-13 00:04:15 -05:00
parent 2ed008c9c3
commit ec4244c2e3
2 changed files with 14 additions and 1 deletions

View File

@ -183,6 +183,7 @@ public abstract class Video extends TimedDevice {
}
hPeriod = HBLANK;
y++;
getCurrentWriter().setCurrentRow(y);
if (y >= APPLE_SCREEN_LINES) {
if (!isVblank) {
y = APPLE_SCREEN_LINES - (TOTAL_LINES - APPLE_SCREEN_LINES);

View File

@ -30,6 +30,11 @@ import javafx.scene.image.WritableImage;
*/
public abstract class VideoWriter {
int currentRow = -1;
public void setCurrentRow(int y) {
currentRow = y;
}
public abstract void displayByte(WritableImage screen, int xOffset, int y, int yTextOffset, int yGraphicsOffset);
// This is used to support composite mixed-mode writers so that we can talk to the writer being used for a scanline
@ -42,12 +47,19 @@ public abstract class VideoWriter {
// Very useful for knowing if we should bother drawing changes
private final boolean[] dirtyFlags = new boolean[192];
boolean updatedDuringRaster = false;
public void markDirty(int y) {
actualWriter().dirtyFlags[y] = true;
if (y == currentRow) {
updatedDuringRaster = true;
}
}
public void clearDirty(int y) {
actualWriter().dirtyFlags[y] = false;
if (!updatedDuringRaster) {
actualWriter().dirtyFlags[y] = false;
}
updatedDuringRaster = false;
}
public boolean isRowDirty(int y) {