Struct webrender::render_api::RenderApi
source · pub struct RenderApi {
api_sender: Sender<ApiMsg>,
scene_sender: Sender<SceneBuilderRequest>,
low_priority_scene_sender: Sender<SceneBuilderRequest>,
namespace_id: IdNamespace,
next_id: Cell<ResourceId>,
resources: ApiResources,
}
Expand description
The main entry point to interact with WebRender.
Fields§
§api_sender: Sender<ApiMsg>
§scene_sender: Sender<SceneBuilderRequest>
§low_priority_scene_sender: Sender<SceneBuilderRequest>
§namespace_id: IdNamespace
§next_id: Cell<ResourceId>
§resources: ApiResources
Implementations§
source§impl RenderApi
impl RenderApi
sourcepub fn get_namespace_id(&self) -> IdNamespace
pub fn get_namespace_id(&self) -> IdNamespace
Returns the namespace ID used by this API object.
sourcepub fn create_sender(&self) -> RenderApiSender
pub fn create_sender(&self) -> RenderApiSender
sourcepub fn add_document(&self, initial_size: DeviceIntSize) -> DocumentId
pub fn add_document(&self, initial_size: DeviceIntSize) -> DocumentId
Add a document to the WebRender instance.
Instances can manage one or several documents (using the same render backend thread). Each document will internally correspond to a single scene, and scenes are made of one or several pipelines.
sourcepub fn add_document_with_id(
&self,
initial_size: DeviceIntSize,
id: u32,
) -> DocumentId
pub fn add_document_with_id( &self, initial_size: DeviceIntSize, id: u32, ) -> DocumentId
See add_document
sourcepub fn delete_document(&self, document_id: DocumentId)
pub fn delete_document(&self, document_id: DocumentId)
Delete a document.
sourcepub fn generate_font_key(&self) -> FontKey
pub fn generate_font_key(&self) -> FontKey
Generate a new font key
sourcepub fn generate_font_instance_key(&self) -> FontInstanceKey
pub fn generate_font_instance_key(&self) -> FontInstanceKey
Generate a new font instance key
sourcepub fn get_glyph_dimensions(
&self,
key: FontInstanceKey,
glyph_indices: Vec<GlyphIndex>,
) -> Vec<Option<GlyphDimensions>>
pub fn get_glyph_dimensions( &self, key: FontInstanceKey, glyph_indices: Vec<GlyphIndex>, ) -> Vec<Option<GlyphDimensions>>
Gets the dimensions for the supplied glyph keys
Note: Internally, the internal texture cache doesn’t store ‘empty’ textures (height or width = 0) This means that glyph dimensions e.g. for spaces (’ ’) will mostly be None.
sourcepub fn get_glyph_indices(&self, key: FontKey, text: &str) -> Vec<Option<u32>>
pub fn get_glyph_indices(&self, key: FontKey, text: &str) -> Vec<Option<u32>>
Gets the glyph indices for the supplied string. These can be used to construct GlyphKeys.
sourcepub fn generate_image_key(&self) -> ImageKey
pub fn generate_image_key(&self) -> ImageKey
Creates an ImageKey
.
sourcepub fn generate_blob_image_key(&self) -> BlobImageKey
pub fn generate_blob_image_key(&self) -> BlobImageKey
Creates a BlobImageKey
.
sourcepub fn send_external_event(&self, evt: ExternalEvent)
pub fn send_external_event(&self, evt: ExternalEvent)
A Gecko-specific notification mechanism to get some code executed on the
Renderer
’s thread, mostly replaced by NotificationHandler
. You should
probably use the latter instead.
sourcepub fn notify_memory_pressure(&self)
pub fn notify_memory_pressure(&self)
Notify WebRender that now is a good time to flush caches and release as much memory as possible.
sourcepub fn report_memory(&self, _ops: MallocSizeOfOps) -> MemoryReport
pub fn report_memory(&self, _ops: MallocSizeOfOps) -> MemoryReport
Synchronously requests memory report.
sourcepub fn set_debug_flags(&mut self, flags: DebugFlags)
pub fn set_debug_flags(&mut self, flags: DebugFlags)
Update debugging flags.
sourcepub fn stop_render_backend(&self)
pub fn stop_render_backend(&self)
Stop RenderBackend’s task until shut down
sourcepub fn generate_property_binding_key<T: Copy>(&self) -> PropertyBindingKey<T>
pub fn generate_property_binding_key<T: Copy>(&self) -> PropertyBindingKey<T>
Create a new unique key that can be used for animated property bindings.
fn next_unique_id(&self) -> u32
sourcefn frame_message(
&self,
msg: FrameMsg,
document_id: DocumentId,
) -> Box<TransactionMsg>
fn frame_message( &self, msg: FrameMsg, document_id: DocumentId, ) -> Box<TransactionMsg>
Creates a transaction message from a single frame message.
sourcefn send_frame_msg(&self, document_id: DocumentId, msg: FrameMsg)
fn send_frame_msg(&self, document_id: DocumentId, msg: FrameMsg)
A helper method to send document messages.
sourcepub fn send_transaction(
&mut self,
document_id: DocumentId,
transaction: Transaction,
)
pub fn send_transaction( &mut self, document_id: DocumentId, transaction: Transaction, )
Send a transaction to WebRender.
sourcepub fn hit_test(
&self,
document_id: DocumentId,
pipeline_id: Option<PipelineId>,
point: WorldPoint,
flags: HitTestFlags,
) -> HitTestResult
pub fn hit_test( &self, document_id: DocumentId, pipeline_id: Option<PipelineId>, point: WorldPoint, flags: HitTestFlags, ) -> HitTestResult
Does a hit test on display items in the specified document, at the given point. If a pipeline_id is specified, it is used to further restrict the hit results so that only items inside that pipeline are matched. The vector of hit results will contain all display items that match, ordered from front to back.
sourcepub fn request_hit_tester(&self, document_id: DocumentId) -> HitTesterRequest
pub fn request_hit_tester(&self, document_id: DocumentId) -> HitTesterRequest
Synchronously request an object that can perform fast hit testing queries.
sourcepub fn flush_scene_builder(&self)
pub fn flush_scene_builder(&self)
Block until a round-trip to the scene builder thread has completed. This ensures that any transactions (including ones deferred to the scene builder thread) have been processed.
sourcepub fn save_capture(&self, path: PathBuf, bits: CaptureBits)
pub fn save_capture(&self, path: PathBuf, bits: CaptureBits)
Save a capture of the current frame state for debugging.
sourcepub fn load_capture(
&self,
path: PathBuf,
ids: Option<(u32, u32)>,
) -> Vec<CapturedDocument>
pub fn load_capture( &self, path: PathBuf, ids: Option<(u32, u32)>, ) -> Vec<CapturedDocument>
Load a capture of the current frame state for debugging.
sourcepub fn start_capture_sequence(&self, path: PathBuf, bits: CaptureBits)
pub fn start_capture_sequence(&self, path: PathBuf, bits: CaptureBits)
Start capturing a sequence of frames.
sourcepub fn stop_capture_sequence(&self)
pub fn stop_capture_sequence(&self)
Stop capturing sequences of frames.
sourcepub fn send_debug_cmd(&self, cmd: DebugCommand)
pub fn send_debug_cmd(&self, cmd: DebugCommand)
Update the state of builtin debugging facilities.
sourcepub fn set_parameter(&mut self, parameter: Parameter)
pub fn set_parameter(&mut self, parameter: Parameter)
Update a instance-global parameter.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RenderApi
impl !RefUnwindSafe for RenderApi
impl Send for RenderApi
impl !Sync for RenderApi
impl Unpin for RenderApi
impl !UnwindSafe for RenderApi
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> 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