diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_math_color.h | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_color.c | 26 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_color_inline.c | 12 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_channels_defines.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawarmature.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 6 | ||||
-rw-r--r-- | source/tests/bl_mesh_modifiers.py | 2 |
9 files changed, 30 insertions, 30 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 71377799651..08b53115919 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1690,10 +1690,10 @@ static ImBuf * input_preprocess( 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); } } diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index 6d37aabd6ab..1b8cc08abf7 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -101,8 +101,8 @@ void minmax_rgb(short c[3]); 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 *****************/ diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index 20df893015d..31d69ba68b4 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -337,24 +337,24 @@ void cpack_to_rgb(unsigned int col, float *r, float *g, float *b) *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 @@ void rgb_byte_set_hue_float_offset(unsigned char rgb[3], float hue_offset) { 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); } diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c index 18b0e9c6278..2c7b13b86a2 100644 --- a/source/blender/blenlib/intern/math_color_inline.c +++ b/source/blender/blenlib/intern/math_color_inline.c @@ -66,9 +66,9 @@ MINLINE void linearrgb_to_srgb_uchar3(unsigned char srgb[4], const float linear[ { int r, g, b; - r = 255 * linearrgb_to_srgb(linear[0]) * 255; - g = 255 * linearrgb_to_srgb(linear[1]) * 255; - b = 255 * linearrgb_to_srgb(linear[2]) * 255; + r = 255 * linearrgb_to_srgb(linear[0]); + g = 255 * linearrgb_to_srgb(linear[1]); + b = 255 * linearrgb_to_srgb(linear[2]); srgb[0] = FTOCHAR(r); srgb[1] = FTOCHAR(g); @@ -79,9 +79,9 @@ MINLINE void linearrgb_to_srgb_uchar4(unsigned char srgb[4], const float linear[ { int r, g, b, a; - r = 255 * linearrgb_to_srgb(linear[0]) * 255; - g = 255 * linearrgb_to_srgb(linear[1]) * 255; - b = 255 * linearrgb_to_srgb(linear[2]) * 255; + r = 255 * linearrgb_to_srgb(linear[0]); + g = 255 * linearrgb_to_srgb(linear[1]); + b = 255 * linearrgb_to_srgb(linear[2]); a = 255 * linear[3]; srgb[0] = FTOCHAR(r); diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index f0f3b8f4123..a0082b3258f 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -186,7 +186,7 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa } /* 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)? diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 176ffd91e3b..511f1524fae 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -143,7 +143,7 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[ 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; } diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 17cb1ce2995..2d77ab20808 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1966,7 +1966,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, 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); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 193f9b1f49f..441665377c7 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -4100,7 +4100,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv 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 @@ static void drawRBpivot(bRigidBodyJointConstraint *data) 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 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) 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); } diff --git a/source/tests/bl_mesh_modifiers.py b/source/tests/bl_mesh_modifiers.py index 789a4037659..917ccbc0d24 100644 --- a/source/tests/bl_mesh_modifiers.py +++ b/source/tests/bl_mesh_modifiers.py @@ -301,7 +301,7 @@ def mesh_vcol_add(obj, mode=0): 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 |