Do not scale texture unless necessary.
authorLars Hofhansl <larsh@apache.org>
Sun, 5 Nov 2017 01:05:47 +0000 (18:05 -0700)
committerSmallJoker <mk939@ymail.com>
Sun, 3 Jun 2018 15:32:00 +0000 (17:32 +0200)
This avoids scaling textures to 'texture_min_size' unless it is actually
required (because either auto-scaling or bi/trilinear filtering is enabled)

src/client/tile.cpp

index 99495132b53acfd0ad8c017a06d74cb872639223..cfdff1bb2521ae71b196fa1392443092d34e464e 100644 (file)
@@ -1805,7 +1805,8 @@ bool TextureSource::generateImagePart(std::string part_of_name,
                         * mix high- and low-res textures, or for mods with least-common-denominator
                         * textures that don't have the resources to offer high-res alternatives.
                         */
-                       s32 scaleto = g_settings->getS32("texture_min_size");
+                       const bool filter = m_setting_trilinear_filter || m_setting_bilinear_filter;
+                       const s32 scaleto = filter ? g_settings->getS32("texture_min_size") : 1;
                        if (scaleto > 1) {
                                const core::dimension2d<u32> dim = baseimg->getDimension();