pub struct GlRegion { /* private fields */ }Expand description
A physical-pixel rectangle in GL bottom-left coordinates (origin at the framebuffer’s
bottom-left corner, y increasing upward). The glow backend’s read coordinates, composite
rect_origin, SDF, and backdrop_uv_remap all operate in this one consistent system, so a
copyTexSubImage2D from the bottom-left framebuffer lines up with rect_uv.y increasing
upward and nothing is rendered upside-down (DESIGN §5).
Fields are private: the only way to obtain one is from_bottom_px
from already-bottom-left inputs, so the “never flipped” invariant holds by construction.
Implementations§
Source§impl GlRegion
impl GlRegion
Sourcepub fn from_bottom_px(origin_bl: [u32; 2], size: [u32; 2], scale: Scale) -> Self
pub fn from_bottom_px(origin_bl: [u32; 2], size: [u32; 2], scale: Scale) -> Self
Build from a bottom-left physical-pixel origin and size. Named _bl/from_bottom_px
because the input is required to already be GL-origin (egui’s from_bottom_px field); the
constructor performs no flip, which is the whole point of the type.
Sourcepub fn intersect(&self, other: &GlRegion) -> Option<GlRegion>
pub fn intersect(&self, other: &GlRegion) -> Option<GlRegion>
Intersect with another region in the same bottom-left space — the clip_rect ∩ viewport step the adapter runs before grabbing. Saturating; returns None when the two
are disjoint or touch only at an edge (zero area), the blur no-op. The result keeps
self’s Scale; both inputs are expected to share it (same frame, same DPI).
Sourcepub fn clip_to(&self, extent: [u32; 2]) -> Option<GlRegion>
pub fn clip_to(&self, extent: [u32; 2]) -> Option<GlRegion>
Clip to a framebuffer of size extent (the framebuffer ∩ step). Equivalent to
intersect with the box origin (0, 0), size extent; None when
the region lies fully outside the framebuffer (the no-op).
Sourcepub fn origin_bl(self) -> [u32; 2]
pub fn origin_bl(self) -> [u32; 2]
The bottom-left origin, physical pixels. Used by the grab to set copyTexSubImage2D /
blitFramebuffer read coordinates directly — GL’s read origin is bottom-left, so no flip.
Sourcepub fn size(self) -> [u32; 2]
pub fn size(self) -> [u32; 2]
Width and height, physical pixels. The grab texture is sized to this.
Sourcepub fn into_region(self) -> Region
pub fn into_region(self) -> Region
Reinterpret as the orientation-free Region the seam speaks. Pure reinterpret — no
arithmetic, no flip: the bottom-left numbers pass straight through, and every compute
consumer on the glow path (grab_source, the SDF, backdrop_uv_remap, the composite
uniforms) treats the resulting Region as bottom-left consistently, so no coordinate is
ever double-interpreted. This is the single line a review checks for a hidden height − y.
The one consumer that must not receive an into_region()’d value is a human-facing
error: Region’s Display is documented top-left, so a bottom-left number printed
through it would mislead a debugger. That is why BlurError::GrabFailed carries a
GlRegion directly (which prints with an explicit bottom-left marker), not a reinterpreted
Region.