Revision: 45387
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45387
Author:   campbellbarton
Date:     2012-04-04 01:02:15 +0000 (Wed, 04 Apr 2012)
Log Message:
-----------
use 'const float' when passing readonly colors, and include array size.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/colortools.c
    trunk/blender/source/blender/editors/include/UI_interface_icons.h
    trunk/blender/source/blender/editors/interface/interface_icons.c
    trunk/blender/source/blender/editors/interface/interface_regions.c

Modified: trunk/blender/source/blender/blenkernel/intern/colortools.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/colortools.c 2012-04-04 
00:50:41 UTC (rev 45386)
+++ trunk/blender/source/blender/blenkernel/intern/colortools.c 2012-04-04 
01:02:15 UTC (rev 45387)
@@ -867,7 +867,7 @@
        return bin;
 }
 
-DO_INLINE void save_sample_line(Scopes *scopes, const int idx, const float fx, 
float *rgb, float *ycc)
+DO_INLINE void save_sample_line(Scopes *scopes, const int idx, const float fx, 
const float rgb[3], const float ycc[3])
 {
        float yuv[3];
 

Modified: trunk/blender/source/blender/editors/include/UI_interface_icons.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_interface_icons.h   
2012-04-04 00:50:41 UTC (rev 45386)
+++ trunk/blender/source/blender/editors/include/UI_interface_icons.h   
2012-04-04 01:02:15 UTC (rev 45387)
@@ -66,7 +66,7 @@
 void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float 
aspect, int size);
 
 void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float 
alpha);
-void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, 
float *rgb);
+void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, 
const float rgb[3]);
 void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha);
 void UI_icons_free(void);
 void UI_icons_free_drawinfo(void *drawinfo);

Modified: trunk/blender/source/blender/editors/interface/interface_icons.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_icons.c    
2012-04-04 00:50:41 UTC (rev 45386)
+++ trunk/blender/source/blender/editors/interface/interface_icons.c    
2012-04-04 01:02:15 UTC (rev 45387)
@@ -858,7 +858,7 @@
                            prv_img->w[size], prv_img->h[size]);
 }
 
-static void icon_draw_rect(float x, float y, int w, int h, float 
UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb, 
short is_preview)
+static void icon_draw_rect(float x, float y, int w, int h, float 
UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, const float 
rgb[3], short is_preview)
 {
        ImBuf *ima = NULL;
 
@@ -911,7 +911,7 @@
        }
 }
 
-static void icon_draw_texture(float x, float y, float w, float h, int ix, int 
iy, int UNUSED(iw), int ih, float alpha, float *rgb)
+static void icon_draw_texture(float x, float y, float w, float h, int ix, int 
iy, int UNUSED(iw), int ih, float alpha, const float rgb[3])
 {
        float x1, x2, y1, y2;
 
@@ -954,7 +954,7 @@
        return 0;
 }
 
-static void icon_draw_size(float x, float y, int icon_id, float aspect, float 
alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), 
short is_preview)
+static void icon_draw_size(float x, float y, int icon_id, float aspect, float 
alpha, const float rgb[3], enum eIconSizes size, int draw_size, int 
UNUSED(nocreate), short is_preview)
 {
        bTheme *btheme = UI_GetTheme();
        Icon *icon = NULL;
@@ -1147,7 +1147,7 @@
        icon_draw_at_size(x, y, icon_id, aspect, alpha, ICON_SIZE_ICON, 0);
 }
 
-void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, 
float *rgb)
+void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, 
const float rgb[3])
 {
        int draw_size = get_draw_size(ICON_SIZE_ICON);
        icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, ICON_SIZE_ICON, 
draw_size, FALSE, FALSE);

Modified: trunk/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_regions.c  
2012-04-04 00:50:41 UTC (rev 45386)
+++ trunk/blender/source/blender/editors/interface/interface_regions.c  
2012-04-04 01:02:15 UTC (rev 45387)
@@ -1845,7 +1845,7 @@
 }
 
 /* also used by small picker, be careful with name checks below... */
-static void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
+static void ui_update_block_buts_rgb(uiBlock *block, const float rgb[3])
 {
        uiBut *bt;
        float *hsv = ui_block_hsv_get(block);
@@ -2051,7 +2051,7 @@
 
 
 /* a HS circle, V slider, rgb/hsv/hex sliders */
-static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, 
PropertyRNA *prop)
+static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, 
PropertyRNA *prop)
 {
        static short colormode = 0;  /* temp? 0=rgb, 1=hsv, 2=hex */
        uiBut *bt;
@@ -2070,19 +2070,19 @@
        /* existence of profile means storage is in linear color space, with 
display correction */
        if (block->color_profile == BLI_PR_NONE) {
                BLI_strncpy(tip, "Value in Display Color Space", sizeof(tip));
-               copy_v3_v3(rgb_gamma, rgb);
+               copy_v3_v3(rgb_gamma, rgba);
        }
        else {
                BLI_strncpy(tip, "Value in Linear RGB Color Space", 
sizeof(tip));
                /* make an sRGB version, for Hex code */
-               linearrgb_to_srgb_v3_v3(rgb_gamma, rgb);
+               linearrgb_to_srgb_v3_v3(rgb_gamma, rgba);
        }
        
        /* sneaky way to check for alpha */
-       rgb[3] = FLT_MAX;
+       rgba[3] = FLT_MAX;
 
        RNA_property_float_ui_range(ptr, prop, &min, &max, &step, &precision);
-       RNA_property_float_get_array(ptr, prop, rgb);
+       RNA_property_float_get_array(ptr, prop, rgba);
 
        switch (U.color_picker_type) {
                case USER_CP_CIRCLE:
@@ -2134,12 +2134,12 @@
        uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
        uiBlockEndAlign(block);
 
-       if (rgb[3] != FLT_MAX) {
+       if (rgba[3] != FLT_MAX) {
                bt = uiDefButR_prop(block, NUMSLI, 0, "A ",  0, -120, butwidth, 
UI_UNIT_Y, ptr, prop, 3, 0.0, 0.0, 0, 0, "Alpha");
                uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
        }
        else {
-               rgb[3] = 1.0f;
+               rgba[3] = 1.0f;
        }
 
        BLI_snprintf(hexcol, sizeof(hexcol), "%02X%02X%02X", 
FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2]));
@@ -2148,7 +2148,7 @@
        uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol);
        uiDefBut(block, LABEL, 0, "(Gamma Corrected)", 0, -80, butwidth, 
UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
 
-       rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2);
+       rgb_to_hsv(rgba[0], rgba[1], rgba[2], hsv, hsv + 1, hsv + 2);
 
        picker_new_hide_reveal(block, colormode);
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to