mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Fix is_pixel_opaque bound checks.
This commit is contained in:
parent
2d3bdcac35
commit
f3d3bf9d03
3 changed files with 6 additions and 6 deletions
|
|
@ -269,8 +269,8 @@ bool CompressedTexture2D::is_pixel_opaque(int p_x, int p_y) const {
|
||||||
int x = p_x * aw / w;
|
int x = p_x * aw / w;
|
||||||
int y = p_y * ah / h;
|
int y = p_y * ah / h;
|
||||||
|
|
||||||
x = CLAMP(x, 0, aw);
|
x = CLAMP(x, 0, aw - 1);
|
||||||
y = CLAMP(y, 0, ah);
|
y = CLAMP(y, 0, ah - 1);
|
||||||
|
|
||||||
return alpha_cache->get_bit(x, y);
|
return alpha_cache->get_bit(x, y);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -197,8 +197,8 @@ bool ImageTexture::is_pixel_opaque(int p_x, int p_y) const {
|
||||||
int x = p_x * aw / w;
|
int x = p_x * aw / w;
|
||||||
int y = p_y * ah / h;
|
int y = p_y * ah / h;
|
||||||
|
|
||||||
x = CLAMP(x, 0, aw);
|
x = CLAMP(x, 0, aw - 1);
|
||||||
y = CLAMP(y, 0, ah);
|
y = CLAMP(y, 0, ah - 1);
|
||||||
|
|
||||||
return alpha_cache->get_bit(x, y);
|
return alpha_cache->get_bit(x, y);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -313,8 +313,8 @@ bool PortableCompressedTexture2D::is_pixel_opaque(int p_x, int p_y) const {
|
||||||
int x = p_x * aw / size.width;
|
int x = p_x * aw / size.width;
|
||||||
int y = p_y * ah / size.height;
|
int y = p_y * ah / size.height;
|
||||||
|
|
||||||
x = CLAMP(x, 0, aw);
|
x = CLAMP(x, 0, aw - 1);
|
||||||
y = CLAMP(y, 0, ah);
|
y = CLAMP(y, 0, ah - 1);
|
||||||
|
|
||||||
return alpha_cache->get_bit(x, y);
|
return alpha_cache->get_bit(x, y);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue