Evas: Fix seg fault in the esvg loader, latest code is required, and enable it on Windows.

SVN revision: 75942
This commit is contained in:
Vincent Torri 2012-09-02 18:20:35 +00:00
parent 72010bf66d
commit 0854fe7aba
6 changed files with 31 additions and 15 deletions

View File

@ -1003,3 +1003,8 @@
2012-08-31 Christophe Sadoine
* Added a function: evas_map_util_quat_rotate().
2012-09-02 Vincent Torri
* Fix seg fault in the esvg loader, latest code is required, and
enable it on Windows.

View File

@ -7,6 +7,9 @@ Improvements:
* Function to rotate an evas map with a quaternion: evas_map_util_quat_rotate().
Fixes:
* Fix segmentation fault with the esvg loader.
Evas 1.7.0
Changes since Evas 1.2.0:

View File

@ -146,7 +146,7 @@ case "$host_os" in
want_evas_engine_software_ddraw="yes"
want_evas_engine_direct3d="yes"
want_evas_image_loader_edb="no"
want_evas_image_loader_svg="no"
want_evas_image_loader_svg="yes"
;;
darwin*)
want_evas_engine_software_xlib="auto"

View File

@ -233,8 +233,8 @@ evas_image_loader_[]$1[]_cflags=""
evas_image_loader_[]$1[]_libs=""
PKG_CHECK_MODULES([SVG],
[esvg >= 0.0.16],
[have_dep="yes" have_esvg="yes" requirement="esvg"],
[esvg >= 0.0.16 ender >= 0.0.6],
[have_dep="yes" have_esvg="yes" requirement="esvg >= 0.0.16 ender >= 0.0.6"],
[have_dep="no"])
if test "x${have_dep}" = "xyes" ; then

View File

@ -9,7 +9,8 @@ AM_CPPFLAGS = \
@PIXMAN_CFLAGS@ \
@EVAS_GENERAL_CFLAGS@ \
@FRIBIDI_CFLAGS@ \
@evas_image_loader_svg_cflags@
@evas_image_loader_svg_cflags@ \
@EVIL_CFLAGS@
if BUILD_LOADER_SVG
if !EVAS_STATIC_BUILD_SVG
@ -19,7 +20,7 @@ pkg_LTLIBRARIES = module.la
module_la_SOURCES = evas_image_load_esvg.c
module_la_LIBADD = @EVAS_GENERAL_LIBS@ @evas_image_loader_svg_libs@ $(top_builddir)/src/lib/libevas.la
module_la_LIBADD = @EVAS_GENERAL_LIBS@ @evas_image_loader_svg_libs@ @EVIL_LIBS@ $(top_builddir)/src/lib/libevas.la
module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version
module_la_LIBTOOLFLAGS = --tag=disable-static

View File

@ -1,10 +1,18 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <math.h>
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#include <Esvg.h>
#include "evas_common.h"
#include "evas_private.h"
#include <Esvg.h>
static inline Eina_Bool evas_image_load_file_is_svg(const char *file) EINA_ARG_NONNULL(1) EINA_PURE;
static Eina_Bool evas_image_load_file_head_svg(Image_Entry *ie, const char *file, const char *key, int *error) EINA_ARG_NONNULL(1, 2, 4);
static Eina_Bool evas_image_load_file_data_svg(Image_Entry *ie, const char *file, const char *key, int *error) EINA_ARG_NONNULL(1, 2, 4);
@ -79,17 +87,16 @@ evas_image_load_file_head_svg(Image_Entry *ie, const char *file, const char *key
return EINA_FALSE;
}
esvg_renderable_x_dpi_set(e, 75.0);
esvg_renderable_y_dpi_set(e, 75.0);
esvg_renderable_x_dpi_set(e, 92.0);
esvg_renderable_y_dpi_set(e, 92.0);
esvg_svg_actual_width_get(e, &sw);
esvg_svg_actual_height_get(e, &sh);
esvg_element_setup(e, NULL);
w = (int)ceil(sw);
h = (int)ceil(sh);
if ((w < 1) || (h < 1) || (w > IMG_MAX_SIZE) || (h > IMG_MAX_SIZE) ||
IMG_TOO_BIG(w, h))
{
ender_element_delete(e);
ender_element_unref(e);
if (IMG_TOO_BIG(w, h))
*error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
else
@ -127,7 +134,7 @@ evas_image_load_file_head_svg(Image_Entry *ie, const char *file, const char *key
ie->h = h;
ie->flags.alpha = 1;
ender_element_delete(e);
ender_element_unref(e);
*error = EVAS_LOAD_ERROR_NONE;
return EINA_TRUE;
@ -167,7 +174,7 @@ evas_image_load_file_data_svg(Image_Entry *ie, const char *file, const char *key
h = (int)ceil(sh);
if ((w < 1) || (h < 1) || (w > IMG_MAX_SIZE) || (h > IMG_MAX_SIZE))
{
ender_element_delete(e);
ender_element_unref(e);
if (IMG_TOO_BIG(w, h))
*error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
else
@ -251,7 +258,7 @@ evas_image_load_file_data_svg(Image_Entry *ie, const char *file, const char *key
memcpy (pixels, data, h * stride);
enesim_surface_unref(s);
ender_element_delete(e);
ender_element_unref(e);
evas_common_image_set_alpha_sparse(ie);
@ -260,7 +267,7 @@ evas_image_load_file_data_svg(Image_Entry *ie, const char *file, const char *key
unref_surface:
enesim_surface_unref(s);
unref_renderer:
ender_element_delete(e);
ender_element_unref(e);
return EINA_FALSE;
}