AUI Framework  master
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
ARenderContext Struct Reference

Render context passed to AView::render. More...

#include <AUI/Render/ARenderContext.h>

Public Types#

using Rectangles = AStaticVector<ARect<int>, 8>
 

Public Member Functions#

void clip (ARect< int > clipping)
 
ARenderContext withShiftedPosition (glm::ivec2 by) const noexcept
 

Signals and public fields#

Rectangles clippingRects
 Axis aligned bounding boxes where the rendering is performed in, used for optimization.
 
IRendererrender
 

Detailed Description#

View containers are responsible to modify (by withShiftedPosition) and passthrough clip optimization context in order to determine which views do not affect actual renderbuffer image and thus should not be rendered either. It's applicable for AScrollArea in the first place, or any other container with AOverflow::HIDDEN and a possibility to either direct or indirect children to run out (render outside) of that container.

View containers are also responsible to skip rendering of views that are outside of the clipping.

ARenderContext is useful only for container views.

ARenderContext passed to the view (possibly AViewContainer) describes an axis aligned bounding box relative to it's coordinate space (position).

Root (window) and AOverflow::HIDDEN containers should create ARenderContext with position = {0, 0} and size = it's size. Other containers should not affect ARenderContext and pass it to it's children as is, in exception to position, which should be subtracted by view's position.

See UIRenderOptimizationTest for tests.

Examples
examples/app/fractal/src/FractalView.cpp, examples/app/fractal/src/FractalView.h, examples/app/minesweeper/src/CellView.cpp, examples/app/minesweeper/src/CellView.h, examples/ui/views/src/DemoGraphView.cpp, and examples/ui/views/src/DemoGraphView.h.