[FFmpeg-cvslog] librsvgdec: Fix frame clearing code
Calvin Walton
git at videolan.org
Fri Feb 2 17:37:10 EET 2018
ffmpeg | branch: master | Calvin Walton <calvin.walton at kepstin.ca> | Thu Feb 1 13:28:25 2018 -0500| [108958e43df075967217d4c81cb4cea5164b2b5f] | committer: Rostislav Pehlivanov
librsvgdec: Fix frame clearing code
The existing code attempts to clear the frame by painting in OVER
mode with transparent black - which is a no-op. As a result if you
have many input frames (e.g. you're using a sequence of svg files),
you'll start to see new frames drawn over old frames as memory gets
re-used.
Switch the code to paint using the CLEAR compositing operator,
which fills every channel with 0 values (setting a source colour
is not required).
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=108958e43df075967217d4c81cb4cea5164b2b5f
---
libavcodec/librsvgdec.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/librsvgdec.c b/libavcodec/librsvgdec.c
index e57070f8e4..6697785026 100644
--- a/libavcodec/librsvgdec.c
+++ b/libavcodec/librsvgdec.c
@@ -82,8 +82,10 @@ static int librsvg_decode_frame(AVCodecContext *avctx, void *data, int *got_fram
crender = cairo_create(image);
- cairo_set_source_rgba(crender, 0.0, 0.0, 0.0, 1.0f);
- cairo_paint_with_alpha(crender, 0.0f);
+ cairo_save(crender);
+ cairo_set_operator(crender, CAIRO_OPERATOR_CLEAR);
+ cairo_paint(crender);
+ cairo_restore(crender);
cairo_scale(crender, dimensions.width / (double)unscaled_dimensions.width,
dimensions.height / (double)unscaled_dimensions.height);
More information about the ffmpeg-cvslog
mailing list