Fix regression in 1.9.0: loaded textures not always rescaled to POT

This commit is contained in:
rdb 2015-06-03 19:55:28 +02:00
parent f42c6645d5
commit ecaffd5eaa
1 changed files with 12 additions and 6 deletions

View File

@ -2883,6 +2883,8 @@ do_read_one(CData *cdata, const Filename &fullpath, const Filename &alpha_fullpa
}
image.copy_header_from(*image_reader);
AutoTextureScale auto_texture_scale = do_get_auto_texture_scale(cdata);
// If it's a floating-point image file, read it by default into a
// floating-point texture.
bool read_floating_point;
@ -2920,9 +2922,7 @@ do_read_one(CData *cdata, const Filename &fullpath, const Filename &alpha_fullpa
y_size = 1;
} else {
consider_rescale(image, fullpath.get_basename(), do_get_auto_texture_scale(cdata));
x_size = image.get_read_x_size();
y_size = image.get_read_y_size();
adjust_size(x_size, y_size, fullpath.get_basename(), false, auto_texture_scale);
}
if (read_floating_point) {
@ -2940,9 +2940,15 @@ do_read_one(CData *cdata, const Filename &fullpath, const Filename &alpha_fullpa
} else {
if (z == 0 && n == 0) {
cdata->_orig_file_x_size = image.get_x_size();
cdata->_orig_file_y_size = image.get_y_size();
consider_rescale(image, fullpath.get_basename(), do_get_auto_texture_scale(cdata));
int x_size = image.get_x_size();
int y_size = image.get_y_size();
cdata->_orig_file_x_size = x_size;
cdata->_orig_file_y_size = y_size;
if (adjust_size(x_size, y_size, fullpath.get_basename(), false, auto_texture_scale)) {
image.set_read_size(x_size, y_size);
}
} else {
image.set_read_size(do_get_expected_mipmap_x_size(cdata, n),
do_get_expected_mipmap_y_size(cdata, n));