summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-10-08 16:15:45 +0200
committerGitHub <noreply@github.com>2019-10-08 16:15:45 +0200
commit45577e42334acd71cf178a8cc188ec5b1469e5e1 (patch)
treee98b30ae4c0e657cf281e6687a2b3af385115622 /servers
parente2f1b305659728c23ff30a9bbe2684066a6f63ac (diff)
parentf73e1fae370f55774697ae0e3b30a97e0a8e78aa (diff)
Merge pull request #32571 from DavidSichma/rect_flip
Correctly flip texture src region
Diffstat (limited to 'servers')
-rw-r--r--servers/visual/visual_server_canvas.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp
index f5a1276c27..ed06a67e4c 100644
--- a/servers/visual/visual_server_canvas.cpp
+++ b/servers/visual/visual_server_canvas.cpp
@@ -680,11 +680,22 @@ void VisualServerCanvas::canvas_item_add_texture_rect_region(RID p_item, const R
rect->flags |= RasterizerCanvas::CANVAS_RECT_FLIP_H;
rect->rect.size.x = -rect->rect.size.x;
}
+ if (p_src_rect.size.x < 0) {
+
+ rect->flags ^= RasterizerCanvas::CANVAS_RECT_FLIP_H;
+ rect->source.size.x = -rect->source.size.x;
+ }
if (p_rect.size.y < 0) {
rect->flags |= RasterizerCanvas::CANVAS_RECT_FLIP_V;
rect->rect.size.y = -rect->rect.size.y;
}
+ if (p_src_rect.size.y < 0) {
+
+ rect->flags ^= RasterizerCanvas::CANVAS_RECT_FLIP_V;
+ rect->source.size.y = -rect->source.size.y;
+ }
+
if (p_transpose) {
rect->flags |= RasterizerCanvas::CANVAS_RECT_TRANSPOSE;
SWAP(rect->rect.size.x, rect->rect.size.y);