#[repr(C)]pub struct BackdropBlurRect {
pub order: DrawOrder,
pub pad: u32,
pub bounds: Bounds<ScaledPixels>,
pub content_mask: ContentMask<ScaledPixels>,
pub corner_radii: Corners<ScaledPixels>,
pub blur_radius: ScaledPixels,
pub opacity: f32,
pub tint: Hsla,
}Expand description
A rounded rect that replaces the pixels already painted behind it with a
blurred copy of them — the primitive behind CSS backdrop-filter: blur().
Keep the field order in sync with struct BlurRect in
gpui_windows/src/shaders.hlsl (20 words / 80 bytes).
Fields§
§order: DrawOrder§pad: u32§bounds: Bounds<ScaledPixels>§content_mask: ContentMask<ScaledPixels>§corner_radii: Corners<ScaledPixels>§blur_radius: ScaledPixels§opacity: f32§tint: HslaImplementations§
Source§impl BackdropBlurRect
impl BackdropBlurRect
Sourcepub fn effective_kernel_levels(&self) -> u32
pub fn effective_kernel_levels(&self) -> u32
Returns the clamped number of blur kernel levels required by this rect.
§Known divergence from CSS blur()
The radius is quantised to whole Dual-Kawase pyramid levels and then
clamped to MAX_BACKDROP_BLUR_KERNEL_LEVELS, so the mapping from CSS
radius to visual blur saturates. It bites when
radius_css > MAX_BACKDROP_BLUR_KERNEL_LEVELS * BACKDROP_BLUR_RADIUS_PER_KERNEL_LEVEL / scale_factor
= 25px @ 100% DPI, 20px @ 125%, 16.7px @ 150%, 12.5px @ 200%Past that point blur(30px) and blur(100px) render identically, and
below it the radius steps in 5-scaled-pixel increments rather than
continuously. Browsers are continuous and unbounded.
Fixing it properly means scaling the upsample tap offsets by the fractional remainder, which is a per-group uniform (the pyramid is built once per non-overlapping group) rather than a per-rect one — so it needs the group split to also break on fractional radius. Deferred: the UI range that matters (8–20px glass) is inside the linear part.
Trait Implementations§
Source§impl Clone for BackdropBlurRect
impl Clone for BackdropBlurRect
impl Copy for BackdropBlurRect
Source§impl Debug for BackdropBlurRect
impl Debug for BackdropBlurRect
Source§impl Default for BackdropBlurRect
impl Default for BackdropBlurRect
Source§impl From<BackdropBlurRect> for Primitive
impl From<BackdropBlurRect> for Primitive
Source§fn from(backdrop_blur_rect: BackdropBlurRect) -> Self
fn from(backdrop_blur_rect: BackdropBlurRect) -> Self
Auto Trait Implementations§
impl Forget for BackdropBlurRect
impl Freeze for BackdropBlurRect
impl Move for BackdropBlurRect
impl RefUnwindSafe for BackdropBlurRect
impl Send for BackdropBlurRect
impl Sync for BackdropBlurRect
impl Unpin for BackdropBlurRect
impl UnsafeUnpin for BackdropBlurRect
impl UnwindSafe for BackdropBlurRect
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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