summaryrefslogtreecommitdiff
path: root/src/client/guiscalingfilter.cpp
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2019-07-25 00:11:30 +0200
committersfan5 <sfan5@live.de>2019-08-04 16:12:52 +0200
commit6c2ded4cac1d421355059ca2db919c064978243a (patch)
treead4cabf77ae0873921b732a73fe9cb25b457cece /src/client/guiscalingfilter.cpp
parentca363d3ef805a39fe4e821813b1efa53b2c9c805 (diff)
downloadminetest-6c2ded4cac1d421355059ca2db919c064978243a.tar.gz
minetest-6c2ded4cac1d421355059ca2db919c064978243a.tar.bz2
minetest-6c2ded4cac1d421355059ca2db919c064978243a.zip
Unify GLES support in gui scaling filter
Diffstat (limited to 'src/client/guiscalingfilter.cpp')
-rw-r--r--src/client/guiscalingfilter.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/client/guiscalingfilter.cpp b/src/client/guiscalingfilter.cpp
index 3490c47e8..2ff57ab74 100644
--- a/src/client/guiscalingfilter.cpp
+++ b/src/client/guiscalingfilter.cpp
@@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/numeric.h"
#include <cstdio>
#include "client/renderingengine.h"
+#include "client/tile.h" // hasNPotSupport()
/* Maintain a static cache to store the images that correspond to textures
* in a format that's manipulable by code. Some platforms exhibit issues
@@ -113,17 +114,18 @@ video::ITexture *guiScalingResizeCached(video::IVideoDriver *driver,
(u32)destrect.getHeight()));
imageScaleNNAA(srcimg, srcrect, destimg);
-#ifdef __ANDROID__
- // Android is very picky about textures being powers of 2, so expand
- // the image dimensions to the next power of 2, if necessary, for
- // that platform.
- video::IImage *po2img = driver->createImage(src->getColorFormat(),
- core::dimension2d<u32>(npot2((u32)destrect.getWidth()),
- npot2((u32)destrect.getHeight())));
- po2img->fill(video::SColor(0, 0, 0, 0));
- destimg->copyTo(po2img);
- destimg->drop();
- destimg = po2img;
+#if ENABLE_GLES
+ // Some platforms are picky about textures being powers of 2, so expand
+ // the image dimensions to the next power of 2, if necessary.
+ if (!hasNPotSupport()) {
+ video::IImage *po2img = driver->createImage(src->getColorFormat(),
+ core::dimension2d<u32>(npot2((u32)destrect.getWidth()),
+ npot2((u32)destrect.getHeight())));
+ po2img->fill(video::SColor(0, 0, 0, 0));
+ destimg->copyTo(po2img);
+ destimg->drop();
+ destimg = po2img;
+ }
#endif
// Convert the scaled image back into a texture.