mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 07:23:09 +02:00
fix svg resize
This commit is contained in:
@@ -46,7 +46,7 @@ extern int fh_crw_id (const char *);
|
|||||||
#ifdef FBV_SUPPORT_SVG
|
#ifdef FBV_SUPPORT_SVG
|
||||||
extern int fh_svg_getsize (const char *, int *, int *, int, int);
|
extern int fh_svg_getsize (const char *, int *, int *, int, int);
|
||||||
extern int fh_svg_load (const char *, unsigned char **, int *, int *);
|
extern int fh_svg_load (const char *, unsigned char **, int *, int *);
|
||||||
extern int svg_load_resize(const char *name, unsigned char **buffer, int* ox, int* oy, int* dx, int* dy);
|
extern int svg_load_resize(const char *name, unsigned char **buffer, int* ox, int* oy, int dx, int dy);
|
||||||
extern int fh_svg_id (const char *);
|
extern int fh_svg_id (const char *);
|
||||||
#endif
|
#endif
|
||||||
double CPictureViewer::m_aspect_ratio_correction;
|
double CPictureViewer::m_aspect_ratio_correction;
|
||||||
@@ -865,7 +865,7 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width,
|
|||||||
#ifdef FBV_SUPPORT_SVG
|
#ifdef FBV_SUPPORT_SVG
|
||||||
if (name.find(".svg") == (name.length() - 4))
|
if (name.find(".svg") == (name.length() - 4))
|
||||||
{
|
{
|
||||||
svg_load_resize(name.c_str(), &buffer, &x, &y, width, height);
|
svg_load_resize(name.c_str(), &buffer, &x, &y, *width, *height);
|
||||||
if (x != *width || y != *height)
|
if (x != *width || y != *height)
|
||||||
buffer = ResizeA(buffer, x, y, *width, *height);
|
buffer = ResizeA(buffer, x, y, *width, *height);
|
||||||
}
|
}
|
||||||
|
@@ -108,9 +108,9 @@ error:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int svg_load_resize(const char *name, unsigned char **buffer, int* ox, int* oy, int* dx, int* dy);
|
int svg_load_resize(const char *name, unsigned char **buffer, int* ox, int* oy, int dx, int dy);
|
||||||
|
|
||||||
int svg_load_resize(const char *name, unsigned char **buffer, int* ox, int* oy, int* dx, int* dy)
|
int svg_load_resize(const char *name, unsigned char **buffer, int* ox, int* oy, int dx, int dy)
|
||||||
{
|
{
|
||||||
NSVGimage *image = NULL;
|
NSVGimage *image = NULL;
|
||||||
NSVGrasterizer *rast = NULL;
|
NSVGrasterizer *rast = NULL;
|
||||||
@@ -134,8 +134,8 @@ int svg_load_resize(const char *name, unsigned char **buffer, int* ox, int* oy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
float scale_w,scale_h;
|
float scale_w,scale_h;
|
||||||
scale_w = *dx/w;
|
scale_w = (float)dx/(float)w;
|
||||||
scale_h = *dy/h;
|
scale_h = (float)dy/(float)h;
|
||||||
|
|
||||||
w = (int)(w*scale_w);
|
w = (int)(w*scale_w);
|
||||||
h = (int)(h*scale_h);
|
h = (int)(h*scale_h);
|
||||||
|
Reference in New Issue
Block a user