From 82150fd3a939ee74fafd0eb403d0dcee66ab0d7b Mon Sep 17 00:00:00 2001 From: Misa Date: Sun, 21 Jan 2024 10:52:37 -0800 Subject: [PATCH] Remove unnecessary calls to resize() Just a small optimization. For example, consider the calls in adjust(). After the first resize(), the lines after only change the x-position and y-position of the text box and depend on the x-position, y-position, width, and height. However, resize() only changes the width and height if the contents of the text box change, which after the first call, they don't. So remove the second call to resize(), because it's completely unnecessary. By similar reasoning, the second calls to resize() in centerx() and centery() are unnecessary too. --- desktop_version/src/Textbox.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/desktop_version/src/Textbox.cpp b/desktop_version/src/Textbox.cpp index 37f9ed8c..4ba7b751 100644 --- a/desktop_version/src/Textbox.cpp +++ b/desktop_version/src/Textbox.cpp @@ -66,13 +66,11 @@ void textboxclass::centerx(void) { resize(); xp = 160 - (w / 2); - resize(); } void textboxclass::centery(void) { resize(); yp = 120 - (h / 2); - resize(); } void textboxclass::applyposition(void) @@ -100,7 +98,6 @@ void textboxclass::adjust(void) if (yp < 10) yp = 10; if (xp + w > 310) xp = 310 - w; if (yp + h > 230) yp = 230 - h; - resize(); } void textboxclass::initcol(int rr, int gg, int bb)