From 628e57c11118f6c1cb4f70dfc62f59e4b7aa8d8d Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Sat, 27 Feb 2016 01:30:14 -0500
Subject: [PATCH] simplify gui_atom_draw_border parameters

---
 pd/nw/pdgui.js  | 16 ++++++++++++----
 pd/src/g_text.c |  4 +---
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index aa8d07b7a..f408553d5 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -1473,13 +1473,21 @@ function gui_message_redraw_border(cid, tag, width, height) {
     });
 }
 
+function atom_border_points(width, height) {
+    return [0, 0,
+            width - 4, 0,
+            width, 4,
+            width, height,
+            0, height,
+            0, 0]
+        .join(" ");
+}
 
-function gui_atom_draw_border(cid,tag,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12) {
-    var p_array = [p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12],
-        g = get_gobj(cid, tag),
+function gui_atom_draw_border(cid, tag, width, height) {
+    var g = get_gobj(cid, tag),
         polygon;
     polygon = create_item(cid, "polygon", {
-        points: p_array.join(" "),
+        points: atom_border_points(width, height),
         fill: "none",
         stroke: "gray",
         "stroke-width": 1,
diff --git a/pd/src/g_text.c b/pd/src/g_text.c
index 45af30609..a39ee9b84 100644
--- a/pd/src/g_text.c
+++ b/pd/src/g_text.c
@@ -2211,9 +2211,7 @@ void text_drawborder(t_text *x, t_glist *glist,
             //        tag, tag, (selected ? "selected" : ""));
             /* These coords can be greatly simplified... */
             gui_vmess("gui_atom_draw_border", "xsiiiiiiiiiiii",
-                glist_getcanvas(glist), tag,
-                x1-x1, y1-y1, x2-4-x1, y1-y1, x2-x1,
-                y1+4-y1, x2-x1, y2-y1, x1-x1, y2-y1, x1-x1, y1-y1);
+                glist_getcanvas(glist), tag, x2 - x1, y2 - y1);
         }
         else
         {
-- 
GitLab