pass colors to glColor as vectors where possible.
authorCampbell Barton <ideasman42@gmail.com>
Wed, 4 May 2011 12:00:11 +0000 (12:00 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 4 May 2011 12:00:11 +0000 (12:00 +0000)
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/editors/gpencil/drawgpencil.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/windowmanager/intern/wm_operators.c

index 8bd650b1a423e25a41f293ffb348b72b710d4fc9..baf89f9f494c67114cf9de9a5fc2d11a666ddb9f 100644 (file)
@@ -594,26 +594,26 @@ static void cdDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned cha
                                glBegin(glmode = new_glmode);
                        }
                                
-                       glColor3ub(cp1[0], cp1[1], cp1[2]);
+                       glColor3ubv(cp1+0);
                        glVertex3fv(mvert[mface->v1].co);
-                       glColor3ub(cp1[4], cp1[5], cp1[6]);
+                       glColor3ubv(cp1+4);
                        glVertex3fv(mvert[mface->v2].co);
-                       glColor3ub(cp1[8], cp1[9], cp1[10]);
+                       glColor3ubv(cp1+8);
                        glVertex3fv(mvert[mface->v3].co);
                        if(mface->v4) {
-                               glColor3ub(cp1[12], cp1[13], cp1[14]);
+                               glColor3ubv(cp1+12);
                                glVertex3fv(mvert[mface->v4].co);
                        }
                                
                        if(useTwoSided) {
-                               glColor3ub(cp2[8], cp2[9], cp2[10]);
+                               glColor3ubv(cp2+8);
                                glVertex3fv(mvert[mface->v3].co );
-                               glColor3ub(cp2[4], cp2[5], cp2[6]);
+                               glColor3ubv(cp2+4);
                                glVertex3fv(mvert[mface->v2].co );
-                               glColor3ub(cp2[0], cp2[1], cp2[2]);
+                               glColor3ubv(cp2+0);
                                glVertex3fv(mvert[mface->v1].co );
                                if(mface->v4) {
-                                       glColor3ub(cp2[12], cp2[13], cp2[14]);
+                                       glColor3ubv(cp2+12);
                                        glVertex3fv(mvert[mface->v4].co );
                                }
                        }
index 1a9ef4be70fa17bead51b05deb28a97bbc16f0b4..b93e4b0730202328084bdde43f60107ba6a96a30 100644 (file)
@@ -486,7 +486,7 @@ static void gp_draw_strokes (bGPDframe *gpf, int offsx, int offsy, int winx, int
        bGPDstroke *gps;
        
        /* set color first (may need to reset it again later too) */
-       glColor4f(color[0], color[1], color[2], color[3]);
+       glColor4fv(color);
        
        for (gps= gpf->strokes.first; gps; gps= gps->next) {
                /* check if stroke can be drawn - checks here generally fall into pairs */
@@ -579,7 +579,7 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy
                glLineWidth(lthick);
                QUATCOPY(color, gpl->color); // just for copying 4 array elements
                QUATCOPY(tcolor, gpl->color); // additional copy of color (for ghosting)
-               glColor4f(color[0], color[1], color[2], color[3]);
+               glColor4fv(color);
                glPointSize((float)(gpl->thickness + 2));
                
                /* apply xray layer setting */
@@ -620,7 +620,7 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy
                                }       
                                
                                /* restore alpha */
-                               glColor4f(color[0], color[1], color[2], color[3]);
+                               glColor4fv(color);
                        }
                        else {
                                /* draw the strokes for the ghost frames (at half of the alpha set by user) */
@@ -635,7 +635,7 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy
                                }
                                
                                /* restore alpha */
-                               glColor4f(color[0], color[1], color[2], color[3]);
+                               glColor4fv(color);
                        }
                }
                
index 022fa8b64c3462715038217949246e6de1fa17ce..7c66cec5730e9e6c4f11ba32b106f9eee948406e 100644 (file)
@@ -129,7 +129,7 @@ static void set_pchan_colorset (Object *ob, bPoseChannel *pchan)
 }
 
 /* This function is for brightening/darkening a given color (like UI_ThemeColorShade()) */
-static void cp_shade_color3ub (char cp[], int offset)
+static void cp_shade_color3ub (unsigned char cp[3], const int offset)
 {
        int r, g, b;
        
@@ -152,7 +152,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
        case PCHAN_COLOR_NORMAL:
        {
                if (bcolor) {
-                       char cp[3];
+                       unsigned char cp[3];
                        
                        if (boneflag & BONE_DRAW_ACTIVE) {
                                VECCOPY(cp, bcolor->active);
@@ -169,7 +169,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
                                cp_shade_color3ub(cp, -50);
                        }
                        
-                       glColor3ub(cp[0], cp[1], cp[2]);
+                       glColor3ubv(cp);
                }
                else {
                        if (boneflag & BONE_DRAW_ACTIVE && boneflag & BONE_SELECTED) UI_ThemeColorShade(TH_BONE_POSE, 40);
@@ -185,8 +185,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
        case PCHAN_COLOR_SOLID:
        {
                if (bcolor) {
-                       char *cp= bcolor->solid;
-                       glColor3ub(cp[0], cp[1], cp[2]);
+                       glColor3ubv((unsigned char *)bcolor->solid);
                }
                else 
                        UI_ThemeColor(TH_BONE_SOLID);
@@ -215,7 +214,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
        case PCHAN_COLOR_SPHEREBONE_BASE:
        {
                if (bcolor) {
-                       char cp[3];
+                       unsigned char cp[3];
                        
                        if (boneflag & BONE_DRAW_ACTIVE) {
                                VECCOPY(cp, bcolor->active);
@@ -227,7 +226,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
                                VECCOPY(cp, bcolor->solid);
                        }
                        
-                       glColor3ub(cp[0], cp[1], cp[2]);
+                       glColor3ubv(cp);
                }
                else {
                        if (boneflag & BONE_DRAW_ACTIVE) UI_ThemeColorShade(TH_BONE_POSE, 40);
@@ -241,7 +240,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
        case PCHAN_COLOR_SPHEREBONE_END:
        {
                if (bcolor) {
-                       char cp[3];
+                       unsigned char cp[3];
                        
                        if (boneflag & BONE_DRAW_ACTIVE) {
                                VECCOPY(cp, bcolor->active);
@@ -256,7 +255,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
                                cp_shade_color3ub(cp, -30);
                        }
                        
-                       glColor3ub(cp[0], cp[1], cp[2]);
+                       glColor3ubv(cp);
                }
                else {
                        if (boneflag & BONE_DRAW_ACTIVE) UI_ThemeColorShade(TH_BONE_POSE, 10);
index b3a6d44233f31b66c4126ce72c337a563e8d71a3..7148c16faa8337ff9889e1237addfc89894f5a8e 100644 (file)
@@ -2725,7 +2725,7 @@ static void wm_radial_control_paint(bContext *C, int x, int y, void *customdata)
 
                glEnable(GL_TEXTURE_2D);
                glBegin(GL_QUADS);
-               glColor4f(rc->tex_col[0], rc->tex_col[1], rc->tex_col[2], rc->tex_col[3]);
+               glColor4fv(rc->tex_col);
                glTexCoord2f(0,0);
                glVertex2f(-r3, -r3);
                glTexCoord2f(1,0);
@@ -2739,7 +2739,7 @@ static void wm_radial_control_paint(bContext *C, int x, int y, void *customdata)
        }
 
        if(rc->mode == WM_RADIALCONTROL_ANGLE) {
-               glColor4f(rc->col[0], rc->col[1], rc->col[2], rc->col[3]);
+               glColor4fv(rc->col);
                glEnable(GL_LINE_SMOOTH);
                glRotatef(-angle, 0, 0, 1);
                fdrawline(0.0f, 0.0f, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);
@@ -2748,7 +2748,7 @@ static void wm_radial_control_paint(bContext *C, int x, int y, void *customdata)
                glDisable(GL_LINE_SMOOTH);
        }
 
-       glColor4f(rc->col[0], rc->col[1], rc->col[2], rc->col[3]);
+       glColor4fv(rc->col);
        glutil_draw_lined_arc(0.0, (float)(M_PI*2.0), r1, 40);
        glutil_draw_lined_arc(0.0, (float)(M_PI*2.0), r2, 40);
        glDisable(GL_BLEND);