Fixed calculation of scale factors, more debug messages

This commit is contained in:
Manuel Reimer 2014-10-28 22:15:22 +01:00
parent 8bf7b33c1d
commit 87aa10dc28
1 changed files with 11 additions and 3 deletions

View File

@ -28,8 +28,8 @@ cImage *cImageMagickWrapper::CreateImage(int width, int height, bool preserveAsp
cairo_t *cr;
cr = cairo_create(surface);
double sx = width / w;
double sy = height / h;
double sx = width / (double)w;
double sy = height / (double)h;
if (preserveAspect) {
if (sx < sy)
sy = sx;
@ -41,6 +41,10 @@ cImage *cImageMagickWrapper::CreateImage(int width, int height, bool preserveAsp
cairo_set_source_surface(cr, image, 0, 0);
cairo_paint(cr);
cairo_status_t status = cairo_status (cr);
if (status)
dsyslog("skindesigner: Cairo CreateImage Error %s", cairo_status_to_string(status));
unsigned char *data = cairo_image_surface_get_data(surface);
cImage *cimage = new cImage(cSize(width, height), (tColor*)data);
@ -57,11 +61,15 @@ bool cImageMagickWrapper::LoadImage(const char *fullpath) {
if (image != NULL) cairo_surface_destroy(image);
if (config.debugImageLoading)
dsyslog("skindesigner: trying to load: %s", fullpath);
image = cairo_image_surface_create_from_png(fullpath);
if (cairo_surface_status(image)) {
if (config.debugImageLoading)
dsyslog("skindesigner: Cairo Error: %s", cairo_status_to_string(cairo_surface_status(image)));
dsyslog("skindesigner: Cairo LoadImage Error: %s", cairo_status_to_string(cairo_surface_status(image)));
image = NULL;
return false;
}