Fix AtlasTexture::draw_rect
flipping for non-zero margin
#93828
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
AtlasTexture::draw_rect
was incorrectly handling flipping anAtlasTexture
with non-zero margins (flipping is done by passing a destination rect with negative width/height).This was noticable e.g. in
TextureRect
(which included incorrect workaround for that) whenstretch_mode != STRETCH_KEEP_ASPECT_COVERED
as that's when it usesCanvasItem::draw_texture_rect
(which ends up callingAtlasTexture::draw_rect
).This PR makes
AtlasTexture::draw_rect
useAtlasTexture::get_rect_region
to handle flipping logic etc. the same way as inAtlasTexture::draw_rect_region
.Properly fixes #37526 (#37615 was incorrect, it only made the issue hardly noticable for the test case reported in there specifically because of almost equal top/bottom margins; see the red/green discrepancy in the image below).
Modified MRP from #37526 with the examples below: Testing-AtlasTextureFlip4x.zip
TextureRect
incorrectly flippingAtlasTexture
with non-equal top/bottom margins (TestScene.tscn
):(v4.3.beta2.official [b75f048])
(this PR)
Setup:
TestSceneWithAnim.tscn
):(v4.3.beta2.official [b75f048])
(this PR)