Fix for sun/moon tonemaps: don't upscale 1px images.
authorAaron Suen <warr1024@gmail.com>
Mon, 23 Mar 2015 06:23:29 +0000 (02:23 -0400)
committerCraig Robbins <kde.psych@gmail.com>
Mon, 23 Mar 2015 07:01:37 +0000 (17:01 +1000)
src/client/tile.cpp

index 7b326c15221d33e71ed0f96f5488b85b8f43c71d..1cf9f150666c3695efcfeeb911b1ceaa9f720734 100644 (file)
@@ -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;