From a4a12a2b7b2f1acfae0d0f1158a1b14e79958da5 Mon Sep 17 00:00:00 2001
From: Robert Hernandez <killerjaguar26@gmail.com>
Date: Thu, 30 Mar 2017 21:09:25 -0400
Subject: Fixed AtlasTexture being incorrectly

Fixed StyleBoxTexture and NinePatchRect drawing the entire texture of an
AtlasTexture.
---
 scene/gui/patch_9_rect.cpp | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)

(limited to 'scene/gui/patch_9_rect.cpp')

diff --git a/scene/gui/patch_9_rect.cpp b/scene/gui/patch_9_rect.cpp
index d0bd45e435..77178b902f 100644
--- a/scene/gui/patch_9_rect.cpp
+++ b/scene/gui/patch_9_rect.cpp
@@ -37,27 +37,13 @@ void NinePatchRect::_notification(int p_what) {
 		if (texture.is_null())
 			return;
 
-		Size2 s = get_size();
+		Rect2 rect = Rect2(Point2(), get_size());
+		Rect2 src_rect = region_rect;
+		
+		texture->get_rect_region(rect, src_rect, rect, src_rect);
+		
 		RID ci = get_canvas_item();
-		VS::get_singleton()->canvas_item_add_nine_patch(ci, Rect2(Point2(), s), region_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, draw_center);
-		//draw_texture_rect(texture,Rect2(Point2(),s),false,modulate);
-
-		/*
-		Vector<Point2> points;
-		points.resize(4);
-		points[0]=Point2(0,0);
-		points[1]=Point2(s.x,0);
-		points[2]=Point2(s.x,s.y);
-		points[3]=Point2(0,s.y);
-		Vector<Point2> uvs;
-		uvs.resize(4);
-		uvs[0]=Point2(0,0);
-		uvs[1]=Point2(1,0);
-		uvs[2]=Point2(1,1);
-		uvs[3]=Point2(0,1);
-
-		VisualServer::get_singleton()->canvas_item_add_primitive(ci,points,Vector<Color>(),uvs,texture->get_rid());
-*/
+		VS::get_singleton()->canvas_item_add_nine_patch(ci, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, draw_center);
 	}
 }
 
-- 
cgit v1.2.3


From 7a428206fec3018f2535768b8a1f20ab9f02aa22 Mon Sep 17 00:00:00 2001
From: Robert Hernandez <killerjaguar26@gmail.com>
Date: Thu, 30 Mar 2017 23:35:57 -0400
Subject: Fixed WindowDialog not aligning properly

---
 scene/gui/patch_9_rect.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'scene/gui/patch_9_rect.cpp')

diff --git a/scene/gui/patch_9_rect.cpp b/scene/gui/patch_9_rect.cpp
index 77178b902f..f53036085f 100644
--- a/scene/gui/patch_9_rect.cpp
+++ b/scene/gui/patch_9_rect.cpp
@@ -39,9 +39,9 @@ void NinePatchRect::_notification(int p_what) {
 
 		Rect2 rect = Rect2(Point2(), get_size());
 		Rect2 src_rect = region_rect;
-		
+
 		texture->get_rect_region(rect, src_rect, rect, src_rect);
-		
+
 		RID ci = get_canvas_item();
 		VS::get_singleton()->canvas_item_add_nine_patch(ci, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, draw_center);
 	}
-- 
cgit v1.2.3