Expand description
GPU-accelerated rendering backend using EGL + GLES2 / GLES3.
Mirrors the public surface of the software backend so that
crate::core::Canvas can route widget draw calls to either backend
by match self. The EGL context bootstrap lives in
crate::egl_context — this module is just the renderer that runs
once a context is current.
Clipping is implemented with glScissor. When
GlesCanvas::set_clip_rects receives multiple rects the
bounding-box union is used as the scissor — coarse, but the
partial-redraw path normally clusters the dirty rects of 1–3
widgets so the union is barely larger than the sum. Disjoint
regions would want a stencil-buffer path; not implemented today.
§Submodule layout
setup—GlesCanvas::{new, sub_canvas, resize, set_font_registry, font_for, dpi/alpha accessors}.framebuffer—GlesCanvas::{blit, present, activate_target, borrowed_texture, read_rgba_pixels, ensure_aux_*, snapshot_fbo_region, fill_backdrop, invalidate_aux}— everything that manipulates the FBO or auxiliary snapshot textures.clip—GlesCanvas::{set_clip_rects, clear_clip, set_scissor, scissor_pixels, fill, clear, clear_rects_transparent}.primitives—GlesCanvas::{fill_rect, fill_linear_gradient_rect, fill_radial_gradient_rect, fill_shadow_outer, fill_shadow_inset, stroke_rect, draw_line}.text—GlesCanvas::{draw_text, measure_text}.image—GlesCanvas::draw_image_data.shaders— GLSL ES 1.00 shader sources (const strings).helpers— free functions:ortho_rect,compile_program,alloc_fbo_tex,upload_*_texture, handle extractors,find_font+SYSTEM_FONT_CANDIDATES.raii—FboBinding/ProgramBindingscoped guards for the handful of operations that change global GL state for a scope and must guarantee restoration even on early return / panic (presently onlypresent). The renderer otherwise relies onactivate_target’s lazy re-bind at the entry of each draw method — see the module’s own doc for when to use the guards and when not to.
Structs§
- Borrowed view of the texture backing a
GlesCanvas. - GPU-accelerated canvas using EGL + GLES2/3.
Enums§
- Which GLES profile the active context is. Stored so per-frame fast-paths can be selected without re-querying GL.