[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43521] trunk/blender/source: rename rgb_float_to_byte, rgb_byte_to_float to rgb_float_to_uchar, rgb_uchar_to_float and swap args ( math functions mostly have dest arg first like strcpy).
Campbell Barton
ideasman42 at gmail.com
Thu Jan 19 10:09:10 CET 2012
Revision: 43521
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43521
Author: campbellbarton
Date: 2012-01-19 09:09:00 +0000 (Thu, 19 Jan 2012)
Log Message:
-----------
rename rgb_float_to_byte, rgb_byte_to_float to rgb_float_to_uchar, rgb_uchar_to_float and swap args (math functions mostly have dest arg first like strcpy).
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/sequencer.c
trunk/blender/source/blender/blenlib/BLI_math_color.h
trunk/blender/source/blender/blenlib/intern/math_color.c
trunk/blender/source/blender/editors/animation/anim_channels_defines.c
trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
trunk/blender/source/blender/editors/space_view3d/drawarmature.c
trunk/blender/source/blender/editors/space_view3d/drawobject.c
trunk/blender/source/tests/bl_mesh_modifiers.py
Modified: trunk/blender/source/blender/blenkernel/intern/sequencer.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sequencer.c 2012-01-19 08:22:23 UTC (rev 43520)
+++ trunk/blender/source/blender/blenkernel/intern/sequencer.c 2012-01-19 09:09:00 UTC (rev 43521)
@@ -1690,10 +1690,10 @@
if(rct) {
float rgb[3];
for (i = ibuf->x * ibuf->y; i > 0; i--, rct+=4) {
- rgb_byte_to_float(rct, rgb);
+ rgb_uchar_to_float(rgb, rct);
rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rgb, rgb+1, rgb+2);
- rgb_float_to_byte(rgb, rct);
+ rgb_float_to_uchar(rct, rgb);
}
}
Modified: trunk/blender/source/blender/blenlib/BLI_math_color.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_color.h 2012-01-19 08:22:23 UTC (rev 43520)
+++ trunk/blender/source/blender/blenlib/BLI_math_color.h 2012-01-19 09:09:00 UTC (rev 43521)
@@ -101,8 +101,8 @@
void rgb_float_set_hue_float_offset(float * rgb, float hue_offset);
void rgb_byte_set_hue_float_offset(unsigned char * rgb, float hue_offset);
-void rgb_byte_to_float(const unsigned char in[3], float out[3]);
-void rgb_float_to_byte(const float in[3], unsigned char out[3]);
+void rgb_uchar_to_float(float col_r[3], const unsigned char col_ub[3]);
+void rgb_float_to_uchar(unsigned char col_r[3], const float col_f[3]);
/***************** lift/gamma/gain / ASC-CDL conversion *****************/
Modified: trunk/blender/source/blender/blenlib/intern/math_color.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_color.c 2012-01-19 08:22:23 UTC (rev 43520)
+++ trunk/blender/source/blender/blenlib/intern/math_color.c 2012-01-19 09:09:00 UTC (rev 43521)
@@ -337,24 +337,24 @@
*b /= 255.0f;
}
-void rgb_byte_to_float(const unsigned char in[3], float out[3])
+void rgb_uchar_to_float(float col_r[3], const unsigned char col_ub[3])
{
- out[0]= ((float)in[0]) / 255.0f;
- out[1]= ((float)in[1]) / 255.0f;
- out[2]= ((float)in[2]) / 255.0f;
+ col_r[0]= ((float)col_ub[0]) / 255.0f;
+ col_r[1]= ((float)col_ub[1]) / 255.0f;
+ col_r[2]= ((float)col_ub[2]) / 255.0f;
}
-void rgb_float_to_byte(const float in[3], unsigned char out[3])
+void rgb_float_to_uchar(unsigned char col_r[3], const float col_f[3])
{
int r, g, b;
- r= (int)(in[0] * 255.0f);
- g= (int)(in[1] * 255.0f);
- b= (int)(in[2] * 255.0f);
+ r= (int)(col_f[0] * 255.0f);
+ g= (int)(col_f[1] * 255.0f);
+ b= (int)(col_f[2] * 255.0f);
- out[0]= (char)((r <= 0)? 0 : (r >= 255)? 255 : r);
- out[1]= (char)((g <= 0)? 0 : (g >= 255)? 255 : g);
- out[2]= (char)((b <= 0)? 0 : (b >= 255)? 255 : b);
+ col_r[0]= (char)((r <= 0)? 0 : (r >= 255)? 255 : r);
+ col_r[1]= (char)((g <= 0)? 0 : (g >= 255)? 255 : g);
+ col_r[2]= (char)((b <= 0)? 0 : (b >= 255)? 255 : b);
}
/* ********************************* color transforms ********************************* */
@@ -490,9 +490,9 @@
{
float rgb_float[3];
- rgb_byte_to_float(rgb, rgb_float);
+ rgb_uchar_to_float(rgb_float, rgb);
rgb_float_set_hue_float_offset(rgb_float, hue_offset);
- rgb_float_to_byte(rgb_float, rgb);
+ rgb_float_to_uchar(rgb, rgb_float);
}
Modified: trunk/blender/source/blender/editors/animation/anim_channels_defines.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_channels_defines.c 2012-01-19 08:22:23 UTC (rev 43520)
+++ trunk/blender/source/blender/editors/animation/anim_channels_defines.c 2012-01-19 09:09:00 UTC (rev 43521)
@@ -186,7 +186,7 @@
}
/* copy the colors over, transforming from bytes to floats */
- rgb_byte_to_float(cp, color);
+ rgb_uchar_to_float(color, cp);
}
else {
// FIXME: what happens when the indention is 1 greater than what it should be (due to grouping)?
Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c 2012-01-19 08:22:23 UTC (rev 43520)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c 2012-01-19 09:09:00 UTC (rev 43521)
@@ -143,7 +143,7 @@
case SEQ_COLOR:
if (colvars->col) {
- rgb_float_to_byte(colvars->col, col);
+ rgb_float_to_uchar(col, colvars->col);
} else {
col[0] = col[1] = col[2] = 128;
}
Modified: trunk/blender/source/blender/editors/space_view3d/drawarmature.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawarmature.c 2012-01-19 08:22:23 UTC (rev 43520)
+++ trunk/blender/source/blender/editors/space_view3d/drawarmature.c 2012-01-19 09:09:00 UTC (rev 43521)
@@ -1966,7 +1966,7 @@
unsigned char col[4];
float col_f[4];
glGetFloatv(GL_CURRENT_COLOR, col_f); /* incase this is not set below */
- rgb_float_to_byte(col_f, col);
+ rgb_float_to_uchar(col, col_f);
col[3]= 255;
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c 2012-01-19 08:22:23 UTC (rev 43520)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c 2012-01-19 09:09:00 UTC (rev 43521)
@@ -4100,7 +4100,7 @@
if(v3d->zbuf) glDepthMask(1);
if((ma) && (part->draw_col == PART_DRAW_COL_MAT)) {
- rgb_float_to_byte(&(ma->r), tcol);
+ rgb_float_to_uchar(tcol, &(ma->r));
copy_v3_v3(ma_col, &ma->r);
}
@@ -6152,7 +6152,7 @@
float curcol[4];
unsigned char tcol[4];
glGetFloatv(GL_CURRENT_COLOR, curcol);
- rgb_float_to_byte(curcol, tcol);
+ rgb_float_to_uchar(tcol, curcol);
tcol[3]= 255;
eul_to_mat4(mat,&data->axX);
@@ -6775,7 +6775,7 @@
float curcol[4];
unsigned char tcol[4];
glGetFloatv(GL_CURRENT_COLOR, curcol);
- rgb_float_to_byte(curcol, tcol);
+ rgb_float_to_uchar(tcol, curcol);
tcol[3]= 255;
view3d_cached_text_draw_add(zero, ob->id.name+2, 10, 0, tcol);
}
Modified: trunk/blender/source/tests/bl_mesh_modifiers.py
===================================================================
--- trunk/blender/source/tests/bl_mesh_modifiers.py 2012-01-19 08:22:23 UTC (rev 43520)
+++ trunk/blender/source/tests/bl_mesh_modifiers.py 2012-01-19 09:09:00 UTC (rev 43521)
@@ -301,7 +301,7 @@
face_verts = mesh_bmesh_poly_vertices(poly)
poly_cols = mesh_bmesh_poly_elems(poly, col_list)
for i, c in enumerate(poly_cols):
- c.color = colors[i % 4]
+ c.color = colors_get(face_verts[i])
else:
for i, col in enumerate(vcol_lay.data):
face_verts = mesh.faces[i].vertices
More information about the Bf-blender-cvs
mailing list