diff options
author | Philip Chimento <philip@endlessm.com> | 2013-07-31 09:35:52 -0700 |
---|---|---|
committer | Philip Chimento <philip@endlessm.com> | 2013-07-31 09:35:52 -0700 |
commit | 0cd660b8b050e4ece61923d3946f30a9dc1764a1 (patch) | |
tree | 207acf714eeaf68e902b846119340da5089018e2 | |
parent | ce3acb0de39663eb1162cc8c9d25f4385ad3f1fb (diff) |
Category images not cropped unnecessarily
Ensure that category images are not cropped if they are already smaller
than the requested size.
[endlessm/eos-sdk#193]
-rw-r--r-- | wikipedia/src/endless_wikipedia/CategoryButton.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/wikipedia/src/endless_wikipedia/CategoryButton.js b/wikipedia/src/endless_wikipedia/CategoryButton.js index e1b428e..8df4e18 100644 --- a/wikipedia/src/endless_wikipedia/CategoryButton.js +++ b/wikipedia/src/endless_wikipedia/CategoryButton.js @@ -119,7 +119,9 @@ const CategoryButton = new Lang.Class({ source_width = -1; let source_pixbuf = GdkPixbuf.Pixbuf.new_from_resource_at_scale(res_path, source_width, source_height, true); - let cropped_pixbuf = source_pixbuf.new_subpixbuf(0, 0, width, height); + let cropped_pixbuf = source_pixbuf; + if(width < source_pixbuf.width || height < source_pixbuf.height) + cropped_pixbuf = source_pixbuf.new_subpixbuf(0, 0, width, height); this._image.set_from_pixbuf(cropped_pixbuf); } }); |