Rename snapshot_element -> render_layer

Some bug reports already use the term "layer" for the effect of
calling render_cairo_sub() - that is, rendering an element subtree
with its transformation within the SVG document.  So, use that
terminology instead of "snapshot".
parent 12194fa4
......@@ -427,10 +427,10 @@ impl<'a> CairoRenderer<'a> {
/// Renders a single SVG element in the same place as for a whole SVG document
///
/// This is equivalent to `render_document`, but renders only a single
/// element and its children. The element is rendered with the same
/// transformation matrix as it has within the whole SVG document.
/// Applications can use this to re-render a single element and repaint it
/// This is equivalent to `render_document`, but renders only a single element and its
/// children, as if they composed an individual layer in the SVG. The element is
/// rendered with the same transformation matrix as it has within the whole SVG
/// document. Applications can use this to re-render a single element and repaint it
/// on top of a previously-rendered document, for example.
///
/// Note that the `id` must be a plain fragment identifier like `#foo`, with
......@@ -444,7 +444,7 @@ impl<'a> CairoRenderer<'a> {
/// The `cr` must be in a `cairo::Status::Success` state, or this function
/// will not render anything, and instead will return
/// `RenderingError::Cairo` with the `cr`'s current error state.
pub fn snapshot_element(
pub fn render_layer(
&self,
cr: &cairo::Context,
id: Option<&str>,
......@@ -452,7 +452,7 @@ impl<'a> CairoRenderer<'a> {
) -> Result<(), RenderingError> {
self.handle
.0
.snapshot_element(cr, id, viewport, self.dpi, false)
.render_layer(cr, id, viewport, self.dpi, false)
}
/// Renders a single SVG element to a given viewport
......
......@@ -42,7 +42,7 @@ fn has_element_with_id_works() {
}
#[test]
fn snapshot_element() {
fn render_layer() {
let svg = load_svg(
br##"<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
......@@ -65,7 +65,7 @@ fn snapshot_element() {
height: 100.0,
};
renderer.snapshot_element(&cr, Some("#bar"), &viewport)
renderer.render_layer(&cr, Some("#bar"), &viewport)
};
let output_surf = res
......@@ -86,7 +86,7 @@ fn snapshot_element() {
let reference_surf = SharedImageSurface::new(reference_surf, SurfaceType::SRgb).unwrap();
compare_to_surface(&output_surf, &reference_surf, "snapshot_element");
compare_to_surface(&output_surf, &reference_surf, "render_layer");
}
#[test]
......
......@@ -320,7 +320,7 @@ impl Handle {
height: f64::from(dimensions.height),
};
self.snapshot_element(cr, id, &viewport, dpi, is_testing)
self.render_layer(cr, id, &viewport, dpi, is_testing)
}
pub fn render_document(
......@@ -330,10 +330,10 @@ impl Handle {
dpi: Dpi,
is_testing: bool,
) -> Result<(), RenderingError> {
self.snapshot_element(cr, None, viewport, dpi, is_testing)
self.render_layer(cr, None, viewport, dpi, is_testing)
}
pub fn snapshot_element(
pub fn render_layer(
&self,
cr: &cairo::Context,
id: Option<&str>,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment