Fixed a bug in osg::Image::ensureDimensionsArePowerOfTwo() which only

scaled dimensions if *both* axis wern't a power of two, have fixed it
to rescale if either of the axis arn't a power to two.
This commit is contained in:
Robert Osfield 2001-10-05 10:38:16 +00:00
parent e4a20dfecf
commit c16fe83d0a

View File

@ -118,8 +118,9 @@ void Image::ensureDimensionsArePowerOfTwo()
float tp2 = logf((float)_t)/logf(2.0f); float tp2 = logf((float)_t)/logf(2.0f);
float rounded_tp2 = floorf(tp2+0.5f); float rounded_tp2 = floorf(tp2+0.5f);
int new_t = (int)(powf(2.0f,rounded_tp2)); int new_t = (int)(powf(2.0f,rounded_tp2));
if (new_s!=_s && new_t!=_t)
if (new_s!=_s || new_t!=_t)
{ {
if (!_fileName.empty()) notify(NOTICE) << "Scaling image '"<<_fileName<<"' from ("<<_s<<","<<_t<<") to ("<<new_s<<","<<new_t<<")"<<endl; if (!_fileName.empty()) notify(NOTICE) << "Scaling image '"<<_fileName<<"' from ("<<_s<<","<<_t<<") to ("<<new_s<<","<<new_t<<")"<<endl;
else notify(NOTICE) << "Scaling image from ("<<_s<<","<<_t<<") to ("<<new_s<<","<<new_t<<")"<<endl; else notify(NOTICE) << "Scaling image from ("<<_s<<","<<_t<<") to ("<<new_s<<","<<new_t<<")"<<endl;