| Modifier and Type | Field and Description |
|---|---|
| private volatile CountDownLatch | allWorkCompletedLatch
Keeps track of the number of scenes which still need to be processed. |
| private static volatile PaintCollector | |
| private static final Comparator | DIRTY_SCENE_SORTER
Sorts the dirty scenes such that asynchronous scenes come first |
| private final List | dirtyScenes
Contains a list of all of the dirty scenes. |
| private volatile boolean | hasDirty
Indicates whether this PaintCollector has any dirty scenes that need to be processed. |
| private volatile boolean | needsHint
Indicates whether we should attempt to wait for vsync at the conclusion of rendering all scenes. |
| private final QuantumToolkit | toolkit
A reference to the toolkit. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv final void | addDirtyScene(GlassScene
The scene which is dirty. This must not be null. scene)Adds a dirty scene to the PaintCollector for subsequent processing. |
| pack-priv static PaintCollector | |
| public void | done(RenderJob job)
Implements com. This object is a CompletionListener is registered with every GlassScene, such that when the repaint has completed, this method is called. |
| pack-priv static PaintCollector | |
| pack-priv final CompletionListener | Returns: The CompletionListener. Will never be null.Gets the CompletionListener which must be notified when a GlassScene has completed rendering. |
| pack-priv final boolean | Returns: Whether there are any dirty scenes that need to be rendered.Gets whether there are any dirty scenes that need to be rendered. |
| pack-priv final void | |
| pack-priv final void | removeDirtyScene(GlassScene
The scene which is no longer dirty. Must not be null. scene)Removes a scene from the dirtyScene list. |
| pack-priv final void | |
| private final void | |
| pack-priv void | waitForRenderingToComplete()
Called by renderAll to wait for rendering to complete before continuing. |
| allWorkCompletedLatch | back to summary |
|---|---|
| private volatile CountDownLatch allWorkCompletedLatch Keeps track of the number of scenes which still need to be processed. In the renderAll method, we will await on this latch until all currently pending scenes are completed. Once they are all completed, we will create a new CountDownLatch initialized to the size of the number of scenes to be processed, and then process each scene in turn (or rather, cause them to render on the render thread). As each scene completes, the CompletionListener will be invoked which will decrement the allWorkCompletedLatch. | |
| collector | back to summary |
|---|---|
| private static volatile PaintCollector collector | |
| DIRTY_SCENE_SORTER | back to summary |
|---|---|
| private static final Comparator<GlassScene> DIRTY_SCENE_SORTER Sorts the dirty scenes such that asynchronous scenes come first | |
| dirtyScenes | back to summary |
|---|---|
| private final List<GlassScene> dirtyScenes Contains a list of all of the dirty scenes. This list is populated only from the FX Thread in consequence of a call to addDirtyScene, or cleared from the FX Thread in consequence of a call to renderAll or removeDirtyScene. It is only ever accessed (both read and write!) from the FX thread. | |
| hasDirty | back to summary |
|---|---|
| private volatile boolean hasDirty Indicates whether this PaintCollector has any dirty scenes that need to be processed. This is used by the QuantumToolkit to detect in the postPulse() method whether there are dirty scenes. If there are, then the postPulse will potentially post a new pulse event. Updated from the FX Thread, but may be read from any thread. | |
| needsHint | back to summary |
|---|---|
| private volatile boolean needsHint Indicates whether we should attempt to wait for vsync at the conclusion of rendering all scenes. This is set in the renderAll method if there are any synchronous scenes. If true, then after the last scene is processed we will indicate to the Toolkit that it should exercise the vsync block, and let it decide whether to actually do so or not (based on flags, or what OS we're on, etc). This field will be set from the FX thread and read from the Render thread, hence it is volatile. | |
| toolkit | back to summary |
|---|---|
| private final QuantumToolkit toolkit A reference to the toolkit. This is supplied in the constructor. Although a Toolkit.getToolkit() call and cast to QuantumToolkit could be used, it is somewhat cleaner to simply supply these parameters in the constructor and not reach out to static state. | |
| PaintCollector | back to summary |
|---|---|
| private PaintCollector(QuantumToolkit qt) Singleton constructor.
| |
| addDirtyScene | back to summary |
|---|---|
| pack-priv final void addDirtyScene(GlassScene scene) Adds a dirty scene to the PaintCollector for subsequent processing. This method simply makes the PaintCollector aware of this new scene and ensure it gets processed on the next call to renderAll. The next QuantumToolkit Glass timer generated pulse or PaintCollector rendering vsync hinted pulse will process these dirty scenes. This method must only be called on the FX Thread
| |
| createInstance | back to summary |
|---|---|
| pack-priv static PaintCollector createInstance(QuantumToolkit toolkit) | |
| done | back to summary |
|---|---|
| public void done(RenderJob job) Implements com. This object is a CompletionListener is registered with every GlassScene, such that when the repaint has completed, this method is called. This method will decrement the count on the allWorkCompletedLatch.
| |
| getInstance | back to summary |
|---|---|
| pack-priv static PaintCollector getInstance() | |
| getRendered | back to summary |
|---|---|
| pack-priv final CompletionListener getRendered() Gets the CompletionListener which must be notified when a GlassScene has completed rendering.
| |
| hasDirty | back to summary |
|---|---|
| pack-priv final boolean hasDirty() Gets whether there are any dirty scenes that need to be rendered. If true, then a subsequent pulse event and renderAll call is required.
| |
| liveRepaintRenderJob | back to summary |
|---|---|
| pack-priv final void liveRepaintRenderJob(final ViewScene scene) Run a full pulse and repaint before returning. | |
| removeDirtyScene | back to summary |
|---|---|
| pack-priv final void removeDirtyScene(GlassScene scene) Removes a scene from the dirtyScene list. If the given scene was previously added with a call to addDirtyScene, it will be removed. Potentially this means that after this call the PaintCollector will no longer have any dirty scenes and will no longer require a repaint. 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
| |
| renderAll | back to summary |
|---|---|
| pack-priv final void renderAll() Called by QuantumToolkit during a pulse to render whatever dirty scenes we have. This method is only called on the FX thread. | |
| setDirty | back to summary |
|---|---|
| private final void setDirty(boolean value) | |
| waitForRenderingToComplete | back to summary |
|---|---|
| pack-priv void waitForRenderingToComplete() Called by renderAll to wait for rendering to complete before continuing. | |