kopia lustrzana https://github.com/maccasoft/z80-tools
Better screen updates optimization
rodzic
e2e08d9592
commit
1ec3a1151e
|
@ -10,6 +10,8 @@
|
|||
|
||||
package com.maccasoft.tools;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.dnd.Clipboard;
|
||||
import org.eclipse.swt.dnd.TextTransfer;
|
||||
|
@ -92,6 +94,7 @@ public class Terminal {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
pendingRunnable.set(null);
|
||||
if (canvas.isDisposed() || bounds == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -99,6 +102,8 @@ public class Terminal {
|
|||
}
|
||||
};
|
||||
|
||||
final AtomicReference<Runnable> pendingRunnable = new AtomicReference<Runnable>();
|
||||
|
||||
Terminal() {
|
||||
// For JUnit tests
|
||||
}
|
||||
|
@ -422,8 +427,10 @@ public class Terminal {
|
|||
} finally {
|
||||
gc.dispose();
|
||||
}
|
||||
if (pendingRunnable.compareAndSet(null, redrawRunnable)) {
|
||||
display.timerExec(REDRAW_MS, redrawRunnable);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -705,8 +712,10 @@ public class Terminal {
|
|||
} finally {
|
||||
gc.dispose();
|
||||
}
|
||||
if (pendingRunnable.compareAndSet(null, redrawRunnable)) {
|
||||
display.timerExec(REDRAW_MS, redrawRunnable);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -723,8 +732,10 @@ public class Terminal {
|
|||
} finally {
|
||||
gc.dispose();
|
||||
}
|
||||
if (pendingRunnable.compareAndSet(null, redrawRunnable)) {
|
||||
display.timerExec(REDRAW_MS, redrawRunnable);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue