mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 06:01:14 +00:00
Fix AtlasTexture::draw_rect flipping for non-zero margin
This commit is contained in:
parent
446e7a7c22
commit
88b29539f7
2 changed files with 8 additions and 25 deletions
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "texture_rect.h"
|
||||
|
||||
#include "scene/resources/atlas_texture.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
void TextureRect::_notification(int p_what) {
|
||||
|
|
@ -92,15 +91,6 @@ void TextureRect::_notification(int p_what) {
|
|||
} break;
|
||||
}
|
||||
|
||||
Ref<AtlasTexture> p_atlas = texture;
|
||||
|
||||
if (p_atlas.is_valid() && !region.has_area()) {
|
||||
Size2 scale_size(size.width / texture->get_width(), size.height / texture->get_height());
|
||||
|
||||
offset.width += hflip ? p_atlas->get_margin().get_position().width * scale_size.width * 2 : 0;
|
||||
offset.height += vflip ? p_atlas->get_margin().get_position().height * scale_size.height * 2 : 0;
|
||||
}
|
||||
|
||||
size.width *= hflip ? -1.0f : 1.0f;
|
||||
size.height *= vflip ? -1.0f : 1.0f;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue