Changeset 1685c92307787c48715d390192596f36ce21d791
- Timestamp:
- 19/07/06 14:54:13
(2 years ago)
- Author:
- Olivier Aubert <olivier.aubert@liris.cnrs.fr>
- git-committer:
- Olivier Aubert <olivier.aubert@liris.cnrs.fr> 1153313653 +0000
- git-parent:
[5ca8805a8f359c45f477e123ea5a97c6a3276373]
- git-author:
- Olivier Aubert <olivier.aubert@liris.cnrs.fr> 1153313653 +0000
- Message:
modules/misc/svg.c: fix SVG rendering
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rf49dc31 |
r1685c92 |
|
| 37 | 37 | # include <sys/types.h> |
|---|
| 38 | 38 | #endif |
|---|
| 39 | | #include <sys/stat.h> |
|---|
| 40 | 39 | |
|---|
| 41 | 40 | #ifdef HAVE_UNISTD_H |
|---|
| … | … | |
| 45 | 44 | #endif |
|---|
| 46 | 45 | |
|---|
| | 46 | #include <glib.h> |
|---|
| | 47 | #include <glib/gstdio.h> |
|---|
| 47 | 48 | #include <glib-object.h> /* g_object_unref( ) */ |
|---|
| 48 | 49 | #include <librsvg-2/librsvg/rsvg.h> |
|---|
| … | … | |
| 147 | 148 | |
|---|
| 148 | 149 | /* MUST call this before any RSVG funcs */ |
|---|
| 149 | | g_type_init (); |
|---|
| | 150 | rsvg_init( ); |
|---|
| 150 | 151 | |
|---|
| 151 | 152 | return VLC_SUCCESS; |
|---|
| … | … | |
| 235 | 236 | free( p_sys->psz_template ); |
|---|
| 236 | 237 | free( p_sys ); |
|---|
| | 238 | rsvg_term( ); |
|---|
| 237 | 239 | } |
|---|
| 238 | 240 | |
|---|
| … | … | |
| 262 | 264 | if( p_svg->p_rendition == NULL ) { |
|---|
| 263 | 265 | svg_RenderPicture( p_filter, p_svg ); |
|---|
| 264 | | if( ! p_svg ) |
|---|
| | 266 | if( ! p_svg->p_rendition ) |
|---|
| 265 | 267 | { |
|---|
| 266 | 268 | msg_Err( p_filter, "Cannot render SVG" ); |
|---|
| … | … | |
| 398 | 400 | GError *error = NULL; |
|---|
| 399 | 401 | |
|---|
| | 402 | p_svg->p_rendition = NULL; |
|---|
| | 403 | |
|---|
| 400 | 404 | p_handle = rsvg_handle_new(); |
|---|
| 401 | 405 | |
|---|
| | 406 | if( !p_handle ) |
|---|
| | 407 | { |
|---|
| | 408 | msg_Err( p_filter, "Error creating SVG reader: %s", error->message ); |
|---|
| | 409 | return; |
|---|
| | 410 | } |
|---|
| | 411 | |
|---|
| 402 | 412 | rsvg_handle_set_size_callback( p_handle, svg_SizeCallback, p_filter, NULL ); |
|---|
| 403 | 413 | |
|---|
| 404 | | rsvg_handle_write( p_handle, |
|---|
| 405 | | ( guchar* )p_svg->psz_text, strlen( p_svg->psz_text ) + 1, |
|---|
| 406 | | &error ); |
|---|
| 407 | | if( error != NULL ) |
|---|
| | 414 | if( ! rsvg_handle_write( p_handle, |
|---|
| | 415 | ( guchar* )p_svg->psz_text, strlen( p_svg->psz_text ), |
|---|
| | 416 | &error ) ) |
|---|
| 408 | 417 | { |
|---|
| 409 | 418 | msg_Err( p_filter, "error while rendering SVG: %s\n", error->message ); |
|---|
| | 419 | g_object_unref( G_OBJECT( p_handle ) ); |
|---|
| 410 | 420 | return; |
|---|
| 411 | 421 | } |
|---|
| 412 | | rsvg_handle_close( p_handle, &error ); |
|---|
| | 422 | |
|---|
| | 423 | if( ! rsvg_handle_close( p_handle, &error ) ) |
|---|
| | 424 | { |
|---|
| | 425 | msg_Err( p_filter, "error while rendering SVG (close): %s\n", error->message ); |
|---|
| | 426 | g_object_unref( G_OBJECT( p_handle ) ); |
|---|
| | 427 | return; |
|---|
| | 428 | } |
|---|
| 413 | 429 | |
|---|
| 414 | 430 | p_svg->p_rendition = rsvg_handle_get_pixbuf( p_handle ); |
|---|
| 415 | | rsvg_handle_free( p_handle ); |
|---|
| | 431 | |
|---|
| | 432 | g_object_unref( G_OBJECT( p_handle ) ); |
|---|
| 416 | 433 | } |
|---|
| 417 | 434 | |
|---|