Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-03-20 13:45:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-20 13:45:17 +0400
commitdb13daff24073a934732053f07e97b0b5394f861 (patch)
tree603e77f5d51f44dcfb9df8061cf7d975110b4af7 /source/blender/blenlib/intern
parent9dd0c4c232fcdd2e88a2f8ba9391017a8bd55ce3 (diff)
replace SETCOL defines with inline function: rgba_char_args_set
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r--source/blender/blenlib/intern/math_color_inline.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c
index 47ee54d6215..2f04bdc9b4b 100644
--- a/source/blender/blenlib/intern/math_color_inline.c
+++ b/source/blender/blenlib/intern/math_color_inline.c
@@ -193,4 +193,25 @@ MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned
srgb_to_linearrgb_predivide_v4(linear, fsrgb);
}
+/* color macros for themes */
+#define rgba_char_args_set_fl(col, r, g, b, a) rgba_char_args_set(col, r * 255, g * 255, b * 255, a * 255)
+
+MINLINE void rgba_char_args_set(char col[4], const char r, const char g, const char b, const char a)
+{
+ col[0] = r;
+ col[1] = g;
+ col[2] = b;
+ col[3] = a;
+}
+
+MINLINE void rgba_char_args_test_set(char col[4], const char r, const char g, const char b, const char a)
+{
+ if (col[3] == 0) {
+ col[0] = r;
+ col[1] = g;
+ col[2] = b;
+ col[3] = a;
+ }
+}
+
#endif /* __MATH_COLOR_INLINE_C__ */