fix svg resize

Origin commit data
------------------
Branch: ni/coolstream
Commit: 8ced48eafd
Author: TangoCash <eric@loxat.de>
Date: 2021-11-02 (Tue, 02 Nov 2021)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
TangoCash
2021-11-02 17:36:19 +01:00
committed by vanhofen
parent 47146d97c3
commit edb861b010
2 changed files with 6 additions and 6 deletions

View File

@@ -46,7 +46,7 @@ extern int fh_crw_id (const char *);
#ifdef FBV_SUPPORT_SVG
extern int fh_svg_getsize (const char *, int *, int *, 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 *);
#endif
double CPictureViewer::m_aspect_ratio_correction;
@@ -894,7 +894,7 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width,
#ifdef FBV_SUPPORT_SVG
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)
buffer = ResizeA(buffer, x, y, *width, *height);
}

View File

@@ -108,9 +108,9 @@ error:
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;
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;
scale_w = *dx/w;
scale_h = *dy/h;
scale_w = (float)dx/(float)w;
scale_h = (float)dy/(float)h;
w = (int)(w*scale_w);
h = (int)(h*scale_h);