public class DefaultRenderPolicy extends RenderPolicy
When a widget is asked to be rendered:
When one widget is asked to be rendered, a flush is requested to the display. When several widgets are asked to be rendered in a row, only one flush is done at the end.
Widget.isTransparent()
,
Display.requestFlush()
RenderPolicy.RenderListener
DEBUG_RENDER_ENABLED_CONSTANT, DEBUG_RENDER_MONITOR_CONSTANT, MONITOR
Constructor and Description |
---|
DefaultRenderPolicy(Desktop desktop)
Creates a default render policy.
|
Modifier and Type | Method and Description |
---|---|
void |
renderDesktop()
Renders the desktop on the display.
|
protected void |
renderWidget(Widget widget,
int x,
int y,
int width,
int height)
This method performs the increment render of the widget.
|
void |
requestRender(Widget widget,
int x,
int y,
int width,
int height)
Requests a rendering of the given widget on the display.
|
protected void |
setParentClip(Widget widget,
GraphicsContext g)
Clips and translates a graphics context to the absolute bounds of the parent of a widget.
|
getDesktop, renderWidget
public DefaultRenderPolicy(Desktop desktop)
desktop
- the desktop.public void renderDesktop()
This method should be called in the MicroUI thread as the rendering of the widget is performed synchronously.
The graphics context is translated to the position of the parent of the widget. The clipping area is set to the intersection of the parent's bounds and the given bounds.
renderDesktop
in class RenderPolicy
protected void renderWidget(Widget widget, int x, int y, int width, int height)
The given bounds are relative to the widget.
widget
- the widget to render.x
- the x coordinate of the area to render.y
- the y coordinate of the area to render.width
- the width of the area to render.height
- the height of the area to render.public void requestRender(Widget widget, int x, int y, int width, int height)
RenderPolicy
This method returns immediately and the rendering of the widget is performed asynchronously in the MicroUI thread.
The given bounds are relative to the widget.
requestRender
in class RenderPolicy
widget
- the widget to render.x
- the x coordinate of the area to render.y
- the y coordinate of the area to render.width
- the width of the area to render.height
- the height of the area to render.protected void setParentClip(Widget widget, GraphicsContext g)
It applies recursively a translation to each parent's coordinates, and a clip to its content size.
widget
- the widget to clip from.g
- the graphics context to clip on.