mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 19:11:06 +00:00
examples: Check for cairo::Context::{save,restore}() failing
This commit is contained in:
parent
fb55cdfeff
commit
86cc982982
2 changed files with 6 additions and 6 deletions
|
@ -183,10 +183,10 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
||||||
|
|
||||||
let cr = cairo::Context::new(&surface);
|
let cr = cairo::Context::new(&surface);
|
||||||
|
|
||||||
cr.save();
|
cr.save().expect("Failed to save state");
|
||||||
cr.set_operator(cairo::Operator::Clear);
|
cr.set_operator(cairo::Operator::Clear);
|
||||||
cr.paint();
|
cr.paint();
|
||||||
cr.restore();
|
cr.restore().expect("Failed to restore state");
|
||||||
|
|
||||||
// The image we draw (the text) will be static, but we will change the
|
// The image we draw (the text) will be static, but we will change the
|
||||||
// transformation on the drawing context, which rotates and shifts everything
|
// transformation on the drawing context, which rotates and shifts everything
|
||||||
|
@ -207,7 +207,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
||||||
// with this, we push our current transformation onto this stack - allowing us
|
// with this, we push our current transformation onto this stack - allowing us
|
||||||
// to make temporary changes / render something / and then returning to the
|
// to make temporary changes / render something / and then returning to the
|
||||||
// previous transformations.
|
// previous transformations.
|
||||||
cr.save();
|
cr.save().expect("Failed to save state");
|
||||||
|
|
||||||
let angle = (360. * f64::from(i)) / 10.0;
|
let angle = (360. * f64::from(i)) / 10.0;
|
||||||
let red = (1.0 + f64::cos((angle - 60.0) * PI / 180.0)) / 2.0;
|
let red = (1.0 + f64::cos((angle - 60.0) * PI / 180.0)) / 2.0;
|
||||||
|
@ -231,7 +231,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
||||||
|
|
||||||
// Here we go one step up in our stack of transformations, removing any
|
// Here we go one step up in our stack of transformations, removing any
|
||||||
// changes we did to them since the last call to cr.save();
|
// changes we did to them since the last call to cr.save();
|
||||||
cr.restore();
|
cr.restore().expect("Failed to restore state");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Safety: The surface still owns a mutable reference to the buffer but our reference
|
// Safety: The surface still owns a mutable reference to the buffer but our reference
|
||||||
|
|
|
@ -167,7 +167,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
||||||
// with this, we push our current transformation onto this stack - allowing us
|
// with this, we push our current transformation onto this stack - allowing us
|
||||||
// to make temporary changes / render something / and then returning to the
|
// to make temporary changes / render something / and then returning to the
|
||||||
// previous transformations.
|
// previous transformations.
|
||||||
cr.save();
|
cr.save().expect("Failed to save state");
|
||||||
|
|
||||||
let angle = (360. * f64::from(i)) / 10.0;
|
let angle = (360. * f64::from(i)) / 10.0;
|
||||||
let red = (1.0 + f64::cos((angle - 60.0) * PI / 180.0)) / 2.0;
|
let red = (1.0 + f64::cos((angle - 60.0) * PI / 180.0)) / 2.0;
|
||||||
|
@ -191,7 +191,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
||||||
|
|
||||||
// Here we go one step up in our stack of transformations, removing any
|
// Here we go one step up in our stack of transformations, removing any
|
||||||
// changes we did to them since the last call to cr.save();
|
// changes we did to them since the last call to cr.save();
|
||||||
cr.restore();
|
cr.restore().expect("Failed to restore state");
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
|
|
Loading…
Reference in a new issue