Merge pull request #11744 from Kelebek1/no_res_no_rescaled

Do not set rescaled flag when rescaling is disabled
This commit is contained in:
liamwhite 2023-10-11 17:54:59 -04:00 committed by GitHub
commit 07ae6659e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 14 deletions

View File

@ -1048,6 +1048,10 @@ void Image::Scale(bool up_scale) {
} }
bool Image::ScaleUp(bool ignore) { bool Image::ScaleUp(bool ignore) {
const auto& resolution = runtime->resolution;
if (!resolution.active) {
return false;
}
if (True(flags & ImageFlagBits::Rescaled)) { if (True(flags & ImageFlagBits::Rescaled)) {
return false; return false;
} }
@ -1060,9 +1064,6 @@ bool Image::ScaleUp(bool ignore) {
return false; return false;
} }
flags |= ImageFlagBits::Rescaled; flags |= ImageFlagBits::Rescaled;
if (!runtime->resolution.active) {
return false;
}
has_scaled = true; has_scaled = true;
if (ignore) { if (ignore) {
current_texture = upscaled_backup.handle; current_texture = upscaled_backup.handle;
@ -1073,13 +1074,14 @@ bool Image::ScaleUp(bool ignore) {
} }
bool Image::ScaleDown(bool ignore) { bool Image::ScaleDown(bool ignore) {
const auto& resolution = runtime->resolution;
if (!resolution.active) {
return false;
}
if (False(flags & ImageFlagBits::Rescaled)) { if (False(flags & ImageFlagBits::Rescaled)) {
return false; return false;
} }
flags &= ~ImageFlagBits::Rescaled; flags &= ~ImageFlagBits::Rescaled;
if (!runtime->resolution.active) {
return false;
}
if (ignore) { if (ignore) {
current_texture = texture.handle; current_texture = texture.handle;
return true; return true;

View File

@ -1530,15 +1530,15 @@ bool Image::IsRescaled() const noexcept {
} }
bool Image::ScaleUp(bool ignore) { bool Image::ScaleUp(bool ignore) {
const auto& resolution = runtime->resolution;
if (!resolution.active) {
return false;
}
if (True(flags & ImageFlagBits::Rescaled)) { if (True(flags & ImageFlagBits::Rescaled)) {
return false; return false;
} }
ASSERT(info.type != ImageType::Linear); ASSERT(info.type != ImageType::Linear);
flags |= ImageFlagBits::Rescaled; flags |= ImageFlagBits::Rescaled;
const auto& resolution = runtime->resolution;
if (!resolution.active) {
return false;
}
has_scaled = true; has_scaled = true;
if (!scaled_image) { if (!scaled_image) {
const bool is_2d = info.type == ImageType::e2D; const bool is_2d = info.type == ImageType::e2D;
@ -1567,15 +1567,15 @@ bool Image::ScaleUp(bool ignore) {
} }
bool Image::ScaleDown(bool ignore) { bool Image::ScaleDown(bool ignore) {
const auto& resolution = runtime->resolution;
if (!resolution.active) {
return false;
}
if (False(flags & ImageFlagBits::Rescaled)) { if (False(flags & ImageFlagBits::Rescaled)) {
return false; return false;
} }
ASSERT(info.type != ImageType::Linear); ASSERT(info.type != ImageType::Linear);
flags &= ~ImageFlagBits::Rescaled; flags &= ~ImageFlagBits::Rescaled;
const auto& resolution = runtime->resolution;
if (!resolution.active) {
return false;
}
current_image = *original_image; current_image = *original_image;
if (ignore) { if (ignore) {
return true; return true;