[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43350] trunk/blender/source/blender/ editors/interface/interface_widgets.c: alpha value for button triangles ignored the alpha value ( was no way to change alpha of `Tick` in boolean option button).

Campbell Barton ideasman42 at gmail.com
Fri Jan 13 10:26:09 CET 2012


Revision: 43350
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43350
Author:   campbellbarton
Date:     2012-01-13 09:26:06 +0000 (Fri, 13 Jan 2012)
Log Message:
-----------
alpha value for button triangles ignored the alpha value (was no way to change alpha of `Tick` in boolean option button).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_widgets.c

Modified: trunk/blender/source/blender/editors/interface/interface_widgets.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_widgets.c	2012-01-13 09:20:13 UTC (rev 43349)
+++ trunk/blender/source/blender/editors/interface/interface_widgets.c	2012-01-13 09:26:06 UTC (rev 43350)
@@ -130,9 +130,12 @@
 static float cornervec[WIDGET_CURVE_RESOLU][2]= {{0.0, 0.0}, {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169},
 {0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}, {1.0, 1.0}};
 
-static float jit[8][2]= {{0.468813 , -0.481430}, {-0.155755 , -0.352820}, 
-{0.219306 , -0.238501},  {-0.393286 , -0.110949}, {-0.024699 , 0.013908}, 
-{0.343805 , 0.147431}, {-0.272855 , 0.269918}, {0.095909 , 0.388710}};
+#define WIDGET_AA_JITTER 8
+static float jit[WIDGET_AA_JITTER][2]= {
+    { 0.468813 , -0.481430}, {-0.155755 , -0.352820},
+    { 0.219306 , -0.238501}, {-0.393286 , -0.110949},
+    {-0.024699 ,  0.013908}, { 0.343805 ,  0.147431},
+    {-0.272855 ,  0.269918}, { 0.095909 ,  0.388710}};
 
 static float num_tria_vert[3][2]= { 
 {-0.352077, 0.532607}, {-0.352077, -0.549313}, {0.330000, -0.008353}};
@@ -192,7 +195,7 @@
 	glVertexPointer(2, GL_FLOAT, 0, tri_arr);
 
 	/* for each AA step */
-	for(j=0; j<8; j++) {
+	for (j = 0; j < WIDGET_AA_JITTER; j++) {
 		glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
 		glDrawArrays(GL_TRIANGLES, 0, 3);
 		glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f);
@@ -212,7 +215,7 @@
 	color[3] *= 0.125f;
 	glColor4fv(color);
 	
-	for(j=0; j<8; j++) {
+	for (j = 0;  j < WIDGET_AA_JITTER; j++) {
 		glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
 		uiDrawBox(mode, minx, miny, maxx, maxy, rad);
 		glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f);
@@ -749,6 +752,11 @@
 		float quad_strip[WIDGET_SIZE_MAX*2+2][2]; /* + 2 because the last pair is wrapped */
 		float quad_strip_emboss[WIDGET_SIZE_MAX*2][2]; /* only for emboss */
 
+		const GLubyte tcol[4] = {wcol->outline[0],
+		                         wcol->outline[1],
+		                         wcol->outline[2],
+		                         wcol->outline[3] / (WIDGET_AA_JITTER / 2)};
+
 		widget_verts_to_quad_strip(wtb, wtb->totvert, quad_strip);
 
 		if(wtb->emboss) {
@@ -757,11 +765,11 @@
 
 		glEnableClientState(GL_VERTEX_ARRAY);
 
-		for(j=0; j<8; j++) {
+		for (j = 0; j < WIDGET_AA_JITTER; j++) {
 			glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
 			
 			/* outline */
-			glColor4ub(wcol->outline[0], wcol->outline[1], wcol->outline[2], 32);
+			glColor4ubv(tcol);
 
 			glVertexPointer(2, GL_FLOAT, 0, quad_strip);
 			glDrawArrays(GL_QUAD_STRIP, 0, wtb->totvert*2 + 2);
@@ -782,16 +790,20 @@
 	
 	/* decoration */
 	if(wtb->tria1.tot || wtb->tria2.tot) {
+		const GLubyte tcol[4] = {wcol->item[0],
+		                         wcol->item[1],
+		                         wcol->item[2],
+		                         wcol->item[3] / (WIDGET_AA_JITTER / 2)};
 		/* for each AA step */
-		for(j=0; j<8; j++) {
+		for (j = 0; j < WIDGET_AA_JITTER; j++) {
 			glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
 
 			if(wtb->tria1.tot) {
-				glColor4ub(wcol->item[0], wcol->item[1], wcol->item[2], 32);
+				glColor4ubv(tcol);
 				widget_trias_draw(&wtb->tria1);
 			}
 			if(wtb->tria2.tot) {
-				glColor4ub(wcol->item[0], wcol->item[1], wcol->item[2], 32);
+				glColor4ubv(tcol);
 				widget_trias_draw(&wtb->tria2);
 			}
 		




More information about the Bf-blender-cvs mailing list