pub struct SoftwareRenderingContext {
size: Cell<PhysicalSize<u32>>,
surfman_rendering_info: SurfmanRenderingContext,
swap_chain: SwapChain<Device<Device<Device, Device>, Device>>,
}
Expand description
A software rendering context that uses a software OpenGL implementation to render Servo. This will generally have bad performance, but can be used in situations where it is more convenient to have consistent, but slower display output.
The results of the render can be accessed via RenderingContext::read_to_image
.
Fields§
§size: Cell<PhysicalSize<u32>>
§surfman_rendering_info: SurfmanRenderingContext
§swap_chain: SwapChain<Device<Device<Device, Device>, Device>>
Implementations§
Source§impl SoftwareRenderingContext
impl SoftwareRenderingContext
pub fn new(size: PhysicalSize<u32>) -> Result<SoftwareRenderingContext, Error>
Trait Implementations§
Source§impl Drop for SoftwareRenderingContext
impl Drop for SoftwareRenderingContext
Source§impl RenderingContext for SoftwareRenderingContext
impl RenderingContext for SoftwareRenderingContext
Source§fn prepare_for_rendering(&self)
fn prepare_for_rendering(&self)
Prepare this
RenderingContext
to be rendered upon by Servo. For instance,
by binding a framebuffer to the current OpenGL context.Source§fn read_to_image(
&self,
source_rectangle: Box2D<i32, DevicePixel>,
) -> Option<ImageBuffer<Rgba<u8>, Vec<u8>>>
fn read_to_image( &self, source_rectangle: Box2D<i32, DevicePixel>, ) -> Option<ImageBuffer<Rgba<u8>, Vec<u8>>>
Read the contents of this [
Renderingcontext
] into an in-memory image. If the
image cannot be read (for instance, if no rendering has taken place yet), then
None
is returned. Read moreSource§fn size(&self) -> PhysicalSize<u32>
fn size(&self) -> PhysicalSize<u32>
Get the current size of this
RenderingContext
.Source§fn resize(&self, size: PhysicalSize<u32>)
fn resize(&self, size: PhysicalSize<u32>)
Resizes the rendering surface to the given size.
Source§fn present(&self)
fn present(&self)
Presents the rendered frame to the screen. In a double-buffered context, this would
swap buffers.
Source§fn make_current(&self) -> Result<(), Error>
fn make_current(&self) -> Result<(), Error>
Makes the context the current OpenGL context for this thread.
After calling this function, it is valid to use OpenGL rendering
commands.
Source§fn gleam_gl_api(&self) -> Rc<dyn Gl>
fn gleam_gl_api(&self) -> Rc<dyn Gl>
Returns the
gleam
version of the OpenGL or GLES API.Source§fn glow_gl_api(&self) -> Arc<Context>
fn glow_gl_api(&self) -> Arc<Context>
Returns the OpenGL or GLES API.
Source§fn create_texture(
&self,
surface: Surface<Device<Device, Device>, Device>,
) -> Option<(SurfaceTexture<Device<Device, Device>, Device>, u32, Size2D<i32, UnknownUnit>)>
fn create_texture( &self, surface: Surface<Device<Device, Device>, Device>, ) -> Option<(SurfaceTexture<Device<Device, Device>, Device>, u32, Size2D<i32, UnknownUnit>)>
Creates a texture from a given surface and returns the surface texture,
the OpenGL texture object, and the size of the surface. Default to
None
.Source§fn destroy_texture(
&self,
surface_texture: SurfaceTexture<Device<Device, Device>, Device>,
) -> Option<Surface<Device<Device, Device>, Device>>
fn destroy_texture( &self, surface_texture: SurfaceTexture<Device<Device, Device>, Device>, ) -> Option<Surface<Device<Device, Device>, Device>>
Destroys the texture and returns the surface. Default to
None
.Source§fn connection(&self) -> Option<Connection<Device<Device, Device>, Device>>
fn connection(&self) -> Option<Connection<Device<Device, Device>, Device>>
The connection to the display server for WebGL. Default to
None
.Source§fn size2d(&self) -> Size2D<u32, DevicePixel>
fn size2d(&self) -> Size2D<u32, DevicePixel>
Get the current size of this
RenderingContext
as Size2D
.Auto Trait Implementations§
impl !Freeze for SoftwareRenderingContext
impl !RefUnwindSafe for SoftwareRenderingContext
impl !Send for SoftwareRenderingContext
impl !Sync for SoftwareRenderingContext
impl Unpin for SoftwareRenderingContext
impl !UnwindSafe for SoftwareRenderingContext
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
Mutably borrows from an owned value. Read more
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more
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>
Converts
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>
Converts
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert