mirror of
https://github.com/godotengine/godot.git
synced 2025-04-01 00:41:35 +08:00
Merge pull request #24504 from harrisyu/AtlasCheckPixelOpaque
Fix #24470 Atlas Texture with margin setting cause error in editor.
This commit is contained in:
commit
bc9899fb9f
@ -1087,8 +1087,12 @@ bool AtlasTexture::is_pixel_opaque(int p_x, int p_y) const {
|
||||
if (!atlas.is_valid())
|
||||
return true;
|
||||
|
||||
int x = p_x + region.position.x + margin.position.x;
|
||||
int y = p_y + region.position.y + margin.position.y;
|
||||
int x = p_x + region.position.x - margin.position.x;
|
||||
int y = p_y + region.position.y - margin.position.y;
|
||||
|
||||
// margin edge may outside of atlas
|
||||
if (x < 0 || x >= atlas->get_width()) return false;
|
||||
if (y < 0 || y >= atlas->get_height()) return false;
|
||||
|
||||
return atlas->is_pixel_opaque(x, y);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user