pub enum CustomRenderPrimitive {
Texture {
order: u32,
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.
Trait Implementations§
Source§impl Clone for CustomRenderPrimitive
impl Clone for CustomRenderPrimitive
Source§fn clone(&self) -> CustomRenderPrimitive
fn clone(&self) -> CustomRenderPrimitive
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CustomRenderPrimitive
impl Debug for CustomRenderPrimitive
Source§impl From<CustomRenderPrimitive> for Primitive
impl From<CustomRenderPrimitive> for Primitive
Source§fn from(custom: CustomRenderPrimitive) -> Primitive
fn from(custom: CustomRenderPrimitive) -> Primitive
Auto Trait Implementations§
impl !RefUnwindSafe for CustomRenderPrimitive
impl !UnwindSafe for CustomRenderPrimitive
impl Freeze for CustomRenderPrimitive
impl Send for CustomRenderPrimitive
impl Sync for CustomRenderPrimitive
impl Unpin for CustomRenderPrimitive
impl UnsafeUnpin for CustomRenderPrimitive
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more