+ // Continue downscaling to below maximum texture size (if possible)
+ scaleFactorIndex = i;
+ fittedScaledWidth = TJSCALED(postXformImageWidth, factors[i]);
+ fittedScaledHeight = TJSCALED(postXformImageHeight, factors[i]);
+
+ if(fittedScaledWidth < maxTextureSize &&
+ fittedScaledHeight < maxTextureSize)
+ {
+ // Current scale-factor downscales to below maximum texture size
+ break;
+ }