You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Fix some warnings raised by MSVC 2017
Disabled signed/unsigned warnings like for GCC/Clang (warning C4018: '>=': signed/unsigned mismatch). Fixes the following MSVC 2017 warnings: ``` core\image.cpp(999): warning C4804: '>': unsafe use of type 'bool' in operation core\io\compression.cpp(178): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) editor\doc\doc_dump.cpp(226): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) scene/resources/material.h(289): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) scene/resources/material.h(298): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) editor\editor_themes.cpp(379): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation ```
This commit is contained in:
@@ -307,6 +307,7 @@ void Image::_get_mipmap_offset_and_size(int p_mipmap, int &r_offset, int &r_widt
|
||||
r_width = w;
|
||||
r_height = h;
|
||||
}
|
||||
|
||||
int Image::get_mipmap_offset(int p_mipmap) const {
|
||||
|
||||
ERR_FAIL_INDEX_V(p_mipmap, get_mipmap_count() + 1, -1);
|
||||
@@ -499,8 +500,6 @@ void Image::convert(Format p_new_format) {
|
||||
|
||||
bool gen_mipmaps = mipmaps;
|
||||
|
||||
//mipmaps=false;
|
||||
|
||||
_copy_internals_from(new_img);
|
||||
|
||||
if (gen_mipmaps)
|
||||
@@ -799,6 +798,7 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
|
||||
if (interpolate_mipmaps) {
|
||||
dst2.create(p_width, p_height, 0, format);
|
||||
}
|
||||
|
||||
bool had_mipmaps = mipmaps;
|
||||
if (interpolate_mipmaps && !had_mipmaps) {
|
||||
generate_mipmaps();
|
||||
@@ -951,6 +951,7 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
|
||||
}
|
||||
|
||||
void Image::crop_from_point(int p_x, int p_y, int p_width, int p_height) {
|
||||
|
||||
if (!_can_modify(format)) {
|
||||
ERR_EXPLAIN("Cannot crop in indexed, compressed or custom image formats.");
|
||||
ERR_FAIL();
|
||||
@@ -996,7 +997,7 @@ void Image::crop_from_point(int p_x, int p_y, int p_width, int p_height) {
|
||||
}
|
||||
}
|
||||
|
||||
if (mipmaps > 0)
|
||||
if (has_mipmaps())
|
||||
dst.generate_mipmaps();
|
||||
_copy_internals_from(dst);
|
||||
}
|
||||
@@ -1013,10 +1014,10 @@ void Image::flip_y() {
|
||||
ERR_FAIL();
|
||||
}
|
||||
|
||||
bool gm = mipmaps;
|
||||
|
||||
if (gm)
|
||||
bool used_mipmaps = has_mipmaps();
|
||||
if (used_mipmaps) {
|
||||
clear_mipmaps();
|
||||
}
|
||||
|
||||
{
|
||||
PoolVector<uint8_t>::Write w = data.write();
|
||||
@@ -1037,8 +1038,9 @@ void Image::flip_y() {
|
||||
}
|
||||
}
|
||||
|
||||
if (gm)
|
||||
if (used_mipmaps) {
|
||||
generate_mipmaps();
|
||||
}
|
||||
}
|
||||
|
||||
void Image::flip_x() {
|
||||
@@ -1048,9 +1050,10 @@ void Image::flip_x() {
|
||||
ERR_FAIL();
|
||||
}
|
||||
|
||||
bool gm = mipmaps;
|
||||
if (gm)
|
||||
bool used_mipmaps = has_mipmaps();
|
||||
if (used_mipmaps) {
|
||||
clear_mipmaps();
|
||||
}
|
||||
|
||||
{
|
||||
PoolVector<uint8_t>::Write w = data.write();
|
||||
@@ -1071,8 +1074,9 @@ void Image::flip_x() {
|
||||
}
|
||||
}
|
||||
|
||||
if (gm)
|
||||
if (used_mipmaps) {
|
||||
generate_mipmaps();
|
||||
}
|
||||
}
|
||||
|
||||
int Image::_get_dst_image_size(int p_width, int p_height, Format p_format, int &r_mipmaps, int p_mipmaps) {
|
||||
@@ -1167,12 +1171,13 @@ void Image::expand_x2_hq2x() {
|
||||
|
||||
ERR_FAIL_COND(!_can_modify(format));
|
||||
|
||||
Format current = format;
|
||||
bool mm = has_mipmaps();
|
||||
if (mm) {
|
||||
bool used_mipmaps = has_mipmaps();
|
||||
if (used_mipmaps) {
|
||||
clear_mipmaps();
|
||||
}
|
||||
|
||||
Format current = format;
|
||||
|
||||
if (current != FORMAT_RGBA8)
|
||||
convert(FORMAT_RGBA8);
|
||||
|
||||
@@ -1193,7 +1198,7 @@ void Image::expand_x2_hq2x() {
|
||||
if (current != FORMAT_RGBA8)
|
||||
convert(current);
|
||||
|
||||
if (mipmaps) {
|
||||
if (used_mipmaps) {
|
||||
generate_mipmaps();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user