aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron Suen <warr1024@gmail.com>2015-03-23 02:23:29 -0400
committerCraig Robbins <kde.psych@gmail.com>2015-03-23 17:01:37 +1000
commit6cf7c89236d6b222f53ca9c8d681d6cde656bea1 (patch)
tree4d1f4a902d8def7d8c0c79dfe9453bc4340244f2 /src
parent15d9cd3a6f318a433e3a3b87068b0660e1b2dedc (diff)
downloadminetest-6cf7c89236d6b222f53ca9c8d681d6cde656bea1.tar.gz
minetest-6cf7c89236d6b222f53ca9c8d681d6cde656bea1.tar.bz2
minetest-6cf7c89236d6b222f53ca9c8d681d6cde656bea1.zip
Fix for sun/moon tonemaps: don't upscale 1px images.
Diffstat (limited to 'src')
-rw-r--r--src/client/tile.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/client/tile.cpp b/src/client/tile.cpp
index 7b326c152..1cf9f1506 100644
--- a/src/client/tile.cpp
+++ b/src/client/tile.cpp
@@ -192,13 +192,18 @@ video::IImage *textureMinSizeUpscale(video::IVideoDriver *driver, video::IImage
if(orig == NULL)
return orig;
s32 scaleto = g_settings->getS32("texture_min_size");
- if (scaleto > 0) {
+ if (scaleto > 1) {
+ const core::dimension2d<u32> dim = orig->getDimension();
+
+ // Don't upscale 1px images. They don't benefit from it anyway
+ // (wouldn't have been blurred) and MIGHT be sun/moon tonemaps.
+ if ((dim.Width <= 1) || (dim.Height <= 1))
+ return orig;
/* Calculate scaling needed to make the shortest texture dimension
* equal to the target minimum. If e.g. this is a vertical frames
* animation, the short dimension will be the real size.
*/
- const core::dimension2d<u32> dim = orig->getDimension();
u32 xscale = scaleto / dim.Width;
u32 yscale = scaleto / dim.Height;
u32 scale = (xscale > yscale) ? xscale : yscale;