Skip to main content

BrowserRenderSurface

Struct BrowserRenderSurface 

Source
pub struct BrowserRenderSurface { /* private fields */ }
Expand description

The render surface of a canvas, as it is handed to the compositor.

Upstream hands out the render target itself (BrowserWebGlRenderTarget or BrowserSoftwareRenderTarget), an object of the thread that draws. A render surface of this port is shared between the thread of the user interface and the thread that renders, so this object holds only what the two share (BrowserSurfaceShared) and resolves the render target on the thread that asks, in the table of that thread (get_render_target):

  • whether the surface is ready is read from the shared state, by either thread;
  • what kind of surface it is (an OpenGL surface, a framebuffer surface) is the kind of the target of the calling thread. A thread that has no target of the canvas (the thread of the page, when the canvas was transferred to a worker) is told that the surface is of neither kind;
  • the render targets it creates belong to the thread that asks for them.

Without a render thread the one thread of the page has the target, and the surface answers as upstream’s render target does.

Implementations§

Source§

impl BrowserRenderSurface

Source

pub fn new(shared: Arc<BrowserSurfaceShared>) -> Arc<Self> ⓘ

Creates the render surface of the canvas shared describes.

Source

pub fn shared(&self) -> &Arc<BrowserSurfaceShared> ⓘ

What the two threads share about the canvas.

Trait Implementations§

Source§

impl IFramebufferPlatformSurface for BrowserRenderSurface

Source§

fn create_framebuffer_render_target(&self) -> Rc<dyn IFramebufferRenderTarget>

§Panics

Panics on a thread that has no software render target of the canvas.

Source§

impl IGlPlatformSurface for BrowserRenderSurface

Source§

fn create_gl_render_target( &self, _context: &Rc<dyn IGlContext>, ) -> Rc<dyn IGlPlatformSurfaceRenderTarget>

§Panics

Panics on a thread that has no WebGL render target of the canvas.

Source§

impl IPlatformRenderSurface for BrowserRenderSurface

Source§

fn is_ready(&self) -> bool

Whether the surface is ready to be rendered to.
Source§

fn as_framebuffer_surface(&self) -> Option<&dyn IFramebufferPlatformSurface>

The surface as a framebuffer surface, if it is one.
Source§

fn try_get_surface_kind(&self, kind: TypeId) -> Option<Rc<dyn Any>>

The surface viewed as a surface kind defined outside this crate: for TypeId::of::<dyn IFoo>() the result holds an Rc<dyn IFoo>.
Source§

fn as_any(&self) -> &dyn Any

Lets the backend recover the concrete surface type.
Source§

fn text_rendering_parameters(&self) -> Option<PlatformTextRenderingParameters>

The text rendering settings of the platform for this surface, when the platform knows them: the render backend asks for them every frame (they follow the settings of the system and the display the surface is on). A backend asks every surface of a top-level and takes the first answer; None from all of them gives the defaults of the backend (docs/porting/text-rendering.md).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more