fix for image resizing bad request
[convexer.git] / nbvtf / nbvtf.h
index e6318c00f7242faae6f98df5b38f4733d27803f5..111ba9e2f301a07d6c0874bedeeae5b2cff8c27f 100644 (file)
@@ -768,12 +768,15 @@ int nbvtf_convert( const char *src, int w, int h, int mipmap,
                        return 0;
                }
                
-               // Image size needs retargeting
+               // Image size needs to be made smaller
                if( (w && h) && ( x > w || y > h ) )
+      {
          nbvtf_downscale( data, x, y, w, h, data );
+         x = w;
+         y = h;
+      }
                
-               int status = nbvtf_write( data, w, h, mipmap, format, qual, 
-            usr_flags, dest );
+               int status = nbvtf_write( data, x,y, mipmap, format, qual, usr_flags, dest );
 
                stbi_image_free( data );