pub struct Strip {
pub x: u16,
pub y: u16,
packed_alpha_idx_fill_gap: u32,
}Expand description
A strip.
Fields§
§x: u16The x coordinate of the strip, in user coordinates.
y: u16The y coordinate of the strip, in user coordinates.
packed_alpha_idx_fill_gap: u32Packed alpha index and fill gap flag.
Bit layout (u32):
- bit 31:
fill_gap(SeeStrip::fill_gap()). - bits 0..=30:
alpha_idx(SeeStrip::alpha_idx()).
Implementations§
Source§impl Strip
impl Strip
Sourceconst FILL_GAP_MASK: u32
const FILL_GAP_MASK: u32
The bit mask for fill_gap packed into packed_alpha_idx_fill_gap.
Sourcepub fn is_sentinel(&self) -> bool
pub fn is_sentinel(&self) -> bool
Return whether the strip is a sentinel strip.
Sourcepub fn width_to(&self, next: &Self) -> u16
pub fn width_to(&self, next: &Self) -> u16
Returns the horizontal pixel width of this strip.
IMPORTANT: This assumes that the next is actually the next adjacent strip
to self, otherwise this method will return a garbage value!
Sourcepub fn set_alpha_idx(&mut self, alpha_idx: u32)
pub fn set_alpha_idx(&mut self, alpha_idx: u32)
Sets the alpha index.
Note that the largest value that can be stored in the alpha index is u32::MAX << 1, as the
highest bit is reserved for fill_gap.
Sourcepub fn fill_gap(&self) -> bool
pub fn fill_gap(&self) -> bool
Returns whether the gap that lies between this strip and the previous in the same row should be filled.
Sourcepub fn set_fill_gap(&mut self, fill: bool)
pub fn set_fill_gap(&mut self, fill: bool)
Sets whether the gap that lies between this strip and the previous in the same row should be filled.
Sourcefn emit_culled_background<F>(
start: u16,
end: u16,
viewport_width: u16,
strips: &mut Vec<Self>,
alphas: &mut Vec<u8>,
windings: &CulledWindings,
should_fill: F,
)
fn emit_culled_background<F>( start: u16, end: u16, viewport_width: u16, strips: &mut Vec<Self>, alphas: &mut Vec<u8>, windings: &CulledWindings, should_fill: F, )
When early culling is active, geometry fully to the left of the viewport creates no tiles. However, if that geometry has a non-zero winding (e.g. a large shape surrounding the viewport), then we must output strips for those fills.
We reconstruct this “background” fill using row_windings (the winding at x=0) to emit solid
strips for:
1. All rows vertically above the first visible tile.
2. ‘Captive’ rows between two tile-containing rows.
3. All rows vertically below the last visible tile.