final class PaintCollector extends java.lang.Object implements CompletionListener
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.CountDownLatch |
allWorkCompletedLatch
Keeps track of the number of scenes which still need to be processed.
|
private static PaintCollector |
collector |
private static java.util.Comparator<GlassScene> |
DIRTY_SCENE_SORTER
Sorts the dirty scenes such that asynchronous scenes come first
|
private java.util.List<GlassScene> |
dirtyScenes
Contains a list of all of the dirty scenes.
|
private boolean |
hasDirty
Indicates whether this PaintCollector has any dirty scenes that
need to be processed.
|
private boolean |
needsHint
Indicates whether we should attempt to wait for vsync at
the conclusion of rendering all scenes.
|
private QuantumToolkit |
toolkit
A reference to the toolkit.
|
Modifier | Constructor and Description |
---|---|
private |
PaintCollector(QuantumToolkit qt)
Singleton constructor.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addDirtyScene(GlassScene scene)
Adds a dirty scene to the PaintCollector for subsequent processing.
|
(package private) static PaintCollector |
createInstance(QuantumToolkit toolkit) |
void |
done(RenderJob job)
This object is a CompletionListener is registered with every GlassScene,
such that when the repaint has completed, this method is called.
|
(package private) static PaintCollector |
getInstance() |
(package private) CompletionListener |
getRendered()
Gets the CompletionListener which must be notified when a
GlassScene has completed rendering.
|
(package private) boolean |
hasDirty()
Gets whether there are any dirty scenes that need to be rendered.
|
(package private) void |
liveRepaintRenderJob(ViewScene scene)
Run a full pulse and repaint before returning.
|
(package private) void |
removeDirtyScene(GlassScene scene)
Removes a scene from the dirtyScene list.
|
(package private) void |
renderAll()
Called by QuantumToolkit during a pulse to render whatever dirty scenes
we have.
|
(package private) void |
waitForRenderingToComplete()
Called by renderAll to wait for rendering to complete before
continuing.
|
private static volatile PaintCollector collector
private static final java.util.Comparator<GlassScene> DIRTY_SCENE_SORTER
private final java.util.List<GlassScene> dirtyScenes
private volatile java.util.concurrent.CountDownLatch allWorkCompletedLatch
private volatile boolean hasDirty
private final QuantumToolkit toolkit
private volatile boolean needsHint
This field will be set from the FX thread and read from the Render thread, hence it is volatile.
private PaintCollector(QuantumToolkit qt)
qt
- The QuantumToolkit instance.static PaintCollector createInstance(QuantumToolkit toolkit)
static PaintCollector getInstance()
void waitForRenderingToComplete()
final boolean hasDirty()
final void addDirtyScene(GlassScene scene)
This method must only be called on the FX Thread
scene
- The scene which is dirty. This must not be null.final void removeDirtyScene(GlassScene scene)
This method is typically called when a scene is removed from a stage, or when visible becomes false.
This method must only be called on the FX Thread
scene
- The scene which is no longer dirty. Must not be null.final CompletionListener getRendered()
public void done(RenderJob job)
done
in interface CompletionListener
final void liveRepaintRenderJob(ViewScene scene)
final void renderAll()