diff options
Diffstat (limited to 'imageloader.c')
-rw-r--r-- | imageloader.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/imageloader.c b/imageloader.c index 569d9fd..6a68b5b 100644 --- a/imageloader.c +++ b/imageloader.c @@ -57,7 +57,7 @@ bool cImageLoader::LoadIcon(const char *cIcon, int size) { return true; } -bool cImageLoader::LoadIcon(const char *cIcon, int width, int height) { +bool cImageLoader::LoadIcon(const char *cIcon, int width, int height, bool preserveAspect) { try { if ((width == 0)||(height==0)) return false; @@ -78,7 +78,12 @@ bool cImageLoader::LoadIcon(const char *cIcon, int width, int height) { } if (!success) return false; - buffer.sample(Geometry(width, height)); + if (preserveAspect) { + buffer.sample(Geometry(width, height)); + } else { + cString geometry = cString::sprintf("%dx%d!", width, height); + buffer.scale(Geometry(*geometry)); + } return true; } catch (...) { |