glcomp: inline and remove 'copy_glcomp_color'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 30 Apr 2022 02:02:50 +0000 (19:02 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 2 May 2022 00:43:10 +0000 (17:43 -0700)
The C compiler knows how to copy a struct without needing it spelled out
member-by-member.

cmd/smyrna/gui/glcompui.c
lib/glcomp/glcompset.c
lib/glcomp/glutils.c
lib/glcomp/glutils.h

index 70d2c6d6cca80a94da9c7cb300f1856a38e5e2d3..9a452008713994dd59477a2a0c93e8b3e6ee21f8 100644 (file)
@@ -257,8 +257,7 @@ glCompSet *glcreate_gl_topview_menu(void)
     b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, "");
     glCompButtonAddPngGlyph(b, smyrnaPath("details.png"));
     b->common.callbacks.click = attrList;
-    copy_glcomp_color(&c, &b->common.color);
-
+    b->common.color = c;
        
     y = y + off;
        
@@ -266,14 +265,14 @@ glCompSet *glcreate_gl_topview_menu(void)
     glCompButtonAddPngGlyph(b, smyrnaPath("zoomin.png"));
     b->groupid = 0;
     b->common.callbacks.click = menu_click_zoom_plus;
-    copy_glcomp_color(&c, &b->common.color);
+    b->common.color = c;
     y = y + off;
 
 
     b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, "");
     glCompButtonAddPngGlyph(b, smyrnaPath("zoomout.png"));
     b->common.callbacks.click = menu_click_zoom_minus;
-    copy_glcomp_color(&c, &b->common.color);
+    b->common.color = c;
 
     y = y + off;
 
@@ -281,18 +280,7 @@ glCompSet *glcreate_gl_topview_menu(void)
     b = glCompButtonNew((glCompObj *) p, 1, y, 42, 42, "");
     glCompButtonAddPngGlyph(b, smyrnaPath("center.png"));
     b->common.callbacks.click = menu_click_center;
-    copy_glcomp_color(&c, &b->common.color);
-
-
-
-       
-       
-
-
-
-
-
-
+    b->common.color = c;
 
     p = glCompPanelNew((glCompObj *) s, -250, 550, 150, 175);
     p->common.borderWidth = 0;
index c91c5eca61e632cba5df47619bbba2e4f0306a77..f6c6e681dd5a42795815f584e49126fc16e16001 100644 (file)
@@ -176,7 +176,7 @@ void glCompInitCommon(glCompObj * childObj, glCompObj * parentObj,
     if (parentObj) {
        c->parent = &parentObj->common;
        parent = &parentObj->common;
-       copy_glcomp_color(&parent->color, &c->color);
+       c->color = parent->color;
        c->layer = parent->layer + 1;
        c->pos.z = parent->pos.z;
        glCompSetAddObj((glCompSet *) parent->compset, childObj);
index a5ae69fffb8c0a77e405b079e568eb170cd7f833..0c42ce8913df24fc57e051e457e415824cd31b78 100644 (file)
@@ -373,15 +373,6 @@ void glCompDrawRectPrism(glCompPoint * p, GLfloat w, GLfloat h, GLfloat b,
 
 }
 
-void copy_glcomp_color(glCompColor * source, glCompColor * target)
-{
-    target->R = source->R;
-    target->G = source->G;
-    target->B = source->B;
-    target->A = source->A;
-
-}
-
 GLfloat distBetweenPts(glCompPoint A,glCompPoint B,float R)
 {
     GLfloat rv=0;      
index e9420ab79dbcf2c9590267b0a1aa960bbe4e38e0..96366a302f871f8b03ef158580cb19bda89911e1 100644 (file)
@@ -40,8 +40,6 @@ extern "C" {
     extern void glCompDrawRectPrism(glCompPoint * p, GLfloat w, GLfloat h,
                                    GLfloat b, GLfloat d, glCompColor * c,
                                    int bumped);
-    extern void copy_glcomp_color(glCompColor * source,
-                                 glCompColor * target);
     extern void glCompSetColor(glCompColor * c);
 
     extern GLfloat distBetweenPts(glCompPoint A,glCompPoint B,float R);