pub struct RenderApi { /* private fields */ }
Expand description
The main entry point to interact with WebRender.
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 clone_sender(&self) -> RenderApiSender
pub fn clone_sender(&self) -> RenderApiSender
Sourcepub fn add_document(
&self,
initial_size: DeviceIntSize,
layer: DocumentLayer,
) -> DocumentId
pub fn add_document( &self, initial_size: DeviceIntSize, layer: DocumentLayer, ) -> 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,
layer: DocumentLayer,
id: u32,
) -> DocumentId
pub fn add_document_with_id( &self, initial_size: DeviceIntSize, layer: DocumentLayer, 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,
font: FontInstanceKey,
glyph_indices: Vec<GlyphIndex>,
) -> Vec<Option<GlyphDimensions>>
pub fn get_glyph_dimensions( &self, font: 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,
font_key: FontKey,
text: &str,
) -> Vec<Option<u32>>
pub fn get_glyph_indices( &self, font_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 update_resources(&self, resources: Vec<ResourceUpdate>)
pub fn update_resources(&self, resources: Vec<ResourceUpdate>)
Add/remove/update resources such as images and fonts.
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) -> MemoryReport
pub fn report_memory(&self) -> MemoryReport
Synchronously requests memory report.
Sourcepub fn set_debug_flags(&self, flags: DebugFlags)
pub fn set_debug_flags(&self, flags: DebugFlags)
Update debugging flags.
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.
Sourcepub fn send_transaction(
&self,
document_id: DocumentId,
transaction: Transaction,
)
pub fn send_transaction( &self, document_id: DocumentId, transaction: Transaction, )
Send a transaction to WebRender.
Sourcepub fn send_transactions(
&self,
document_ids: Vec<DocumentId>,
transactions: Vec<Transaction>,
)
pub fn send_transactions( &self, document_ids: Vec<DocumentId>, transactions: Vec<Transaction>, )
Send multiple transactions.
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. If the HitTestFlags argument contains the FIND_ALL flag, then the vector of hit results will contain all display items that match, ordered from front to back.
Sourcepub fn set_document_view(
&self,
document_id: DocumentId,
device_rect: DeviceIntRect,
device_pixel_ratio: f32,
)
pub fn set_document_view( &self, document_id: DocumentId, device_rect: DeviceIntRect, device_pixel_ratio: f32, )
Setup the output region in the framebuffer for a given document.
Sourcepub fn enable_frame_output(
&self,
document_id: DocumentId,
pipeline_id: PipelineId,
enable: bool,
)
pub fn enable_frame_output( &self, document_id: DocumentId, pipeline_id: PipelineId, enable: bool, )
Setup the output region in the framebuffer for a given document. Enable copying of the output of this pipeline id to an external texture for callers to consume.
Sourcepub fn get_scroll_node_state(
&self,
document_id: DocumentId,
) -> Vec<ScrollNodeState>
pub fn get_scroll_node_state( &self, document_id: DocumentId, ) -> Vec<ScrollNodeState>
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) -> Vec<CapturedDocument>
pub fn load_capture(&self, path: PathBuf) -> Vec<CapturedDocument>
Load a capture of the current frame state for debugging.
Sourcepub fn send_debug_cmd(&self, cmd: DebugCommand)
pub fn send_debug_cmd(&self, cmd: DebugCommand)
Update the state of builtin debugging facilities.