pub enum CustomRenderPrimitive {
Texture {
order: DrawOrder,
handle: ImportedTextureHandle,
bounds: Bounds<ScaledPixels>,
content_mask: ContentMask<ScaledPixels>,
radii: Corners<ScaledPixels>,
opacity: f32,
flip_v: bool,
},
}Expand description
A drawable the application produced itself, drawn in the composite pass rather than translated into GPUI’s own primitives.
It rides crate::PaintSurface’s machinery — the ordering, the content mask, one
accumulation list and one batch — but is drawn by a fragment path of its own: what it
samples is RGBA, where that surface is YCbCr video.
Variants§
Texture
A texture produced outside GPUI, sampled in the composite pass.
Fields
handle: ImportedTextureHandleThe token the renderer resolves to the texture it samples.
bounds: Bounds<ScaledPixels>Where the texture lands, in scaled pixels.
content_mask: ContentMask<ScaledPixels>What may clip it.
radii: Corners<ScaledPixels>Corner radii, in scaled pixels: the element converts at paint time, as paint_quad
does, because the renderer has no scale factor of its own.
Implementations§
Source§impl CustomRenderPrimitive
impl CustomRenderPrimitive
Sourcepub fn bounds(&self) -> &Bounds<ScaledPixels>
pub fn bounds(&self) -> &Bounds<ScaledPixels>
Where it lands.
Sourcepub fn content_mask(&self) -> &ContentMask<ScaledPixels>
pub fn content_mask(&self) -> &ContentMask<ScaledPixels>
What may clip it.
Sourcepub fn to_quad_record(&self) -> Quad
pub fn to_quad_record(&self) -> Quad
Encode this primitive into the quad instance record the backends’ shaders read.
Both renderers draw it through their quad pipeline, so its geometry, its
content-mask clip and its corner SDF are the quads’ rather than a second
implementation of them. That leaves two values with no field of their own: the
opacity rides in the solid background’s alpha, which the quad vertex entry point
forwards as a scratch field the texturing path does not read, and flip_v rides in
the border style, which a textured quad has no other use for. Encoding it here
rather than in each renderer is what keeps the two in step with the shaders.