[Bf-blender-cvs] [6444ba2635] blender2.8: added UI_GetThemeColorShade4ubv function

Cyrax noreply at git.blender.org
Thu Feb 9 00:38:16 CET 2017


Commit: 6444ba263529e2b727ed566b984bbd4203a47a0d
Author: Cyrax
Date:   Wed Feb 8 18:33:40 2017 -0500
Branches: blender2.8
https://developer.blender.org/rB6444ba263529e2b727ed566b984bbd4203a47a0d

added UI_GetThemeColorShade4ubv function

And updated UI_ThemeColorShade to use it.

Part of D2438 by @cyrax

===================================================================

M	source/blender/editors/include/UI_resources.h
M	source/blender/editors/interface/resources.c

===================================================================

diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 5924529ddc..2fc76ae956 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -347,6 +347,7 @@ void    UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigne
 // get the color, range 0.0-1.0, complete with shading offset
 void    UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]);
 void    UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]);
+void    UI_GetThemeColorShade4ubv(int colorid, int offset, unsigned char col[4]);
 
 // get three color values, range 0-255, complete with shading offset for the RGB components and blending
 void	UI_GetThemeColorBlendShade3ubv(int colorid1, int colorid2, float fac, int offset, unsigned char col[3]);
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 8bd671873b..fbfbdb13a5 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1287,18 +1287,11 @@ void UI_ThemeColor4(int colorid)
 /* set the color with offset for shades */
 void UI_ThemeColorShade(int colorid, int offset)
 {
-	int r, g, b;
-	const unsigned char *cp;
-
-	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
-	r = offset + (int) cp[0];
-	CLAMP(r, 0, 255);
-	g = offset + (int) cp[1];
-	CLAMP(g, 0, 255);
-	b = offset + (int) cp[2];
-	CLAMP(b, 0, 255);
-	glColor4ub(r, g, b, cp[3]);
+	unsigned char col[4];
+	UI_GetThemeColorShade4ubv(colorid, offset, col);
+	glColor4ubv(col);
 }
+
 void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
 {
 	int r, g, b, a;
@@ -1524,6 +1517,25 @@ void UI_GetThemeColorBlendShade3ubv(int colorid1, int colorid2, float fac, int o
 	CLAMP(col[2], 0, 255);
 }
 
+void UI_GetThemeColorShade4ubv(int colorid, int offset, unsigned char col[4])
+{
+	int r, g, b;
+	const unsigned char *cp;
+
+	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+	r = offset + (int) cp[0];
+	CLAMP(r, 0, 255);
+	g = offset + (int) cp[1];
+	CLAMP(g, 0, 255);
+	b = offset + (int) cp[2];
+	CLAMP(b, 0, 255);
+
+	col[0] = r;
+	col[1] = g;
+	col[2] = b;
+	col[3] = cp[3];
+}
+
 void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4])
 {
 	int r, g, b, a;




More information about the Bf-blender-cvs mailing list