The color gradients displayed on the sliders in the color editor were being calculate...
[synfig.git] / synfig-studio / trunk / src / gtkmm / widget_coloredit.cpp
index ac85260..fc87e3c 100644 (file)
@@ -50,11 +50,6 @@ using namespace studio;
 
 /* === M A C R O S ========================================================= */
 
-#define use_colorspace_gamma() App::use_colorspace_gamma
-#define colorspace_gamma()     (2.2f)
-#define gamma_in(x)            ((x>=0)?pow((float)x,1.0f/colorspace_gamma()):-pow((float)-x,1.0f/colorspace_gamma()))
-#define gamma_out(x)   ((x>=0)?pow((float)x,colorspace_gamma()):-pow((float)-x,colorspace_gamma()))
-
 /* === G L O B A L S ======================================================= */
 
 /* === P R O C E D U R E S ================================================= */
@@ -162,38 +157,18 @@ ColorSlider::redraw(GdkEventExpose */*bleh*/)
        int i;
        for(i=width-1;i>=0;i--)
        {
-               color_func(color,float(i)/float(width));
+               color_func(color,gamma_out(float(i)/float(width)));
                const Color c1(Color::blend(color,bg1,1.0).clamped());
                const Color c2(Color::blend(color,bg2,1.0).clamped());
                assert(c1.is_valid());
                assert(c2.is_valid());
 
-               gushort r1;
-               gushort g1;
-               gushort b1;
-               gushort r2;
-               gushort g2;
-               gushort b2;
-
-               if(use_colorspace_gamma() && (type<TYPE_U))
-               {
-                       r1=(256*App::gamma.r_F32_to_U8(gamma_out(c1.get_r())));
-                       g1=(256*App::gamma.g_F32_to_U8(gamma_out(c1.get_g())));
-                       b1=(256*App::gamma.b_F32_to_U8(gamma_out(c1.get_b())));
-                       r2=(256*App::gamma.r_F32_to_U8(gamma_out(c2.get_r())));
-                       g2=(256*App::gamma.g_F32_to_U8(gamma_out(c2.get_g())));
-                       b2=(256*App::gamma.b_F32_to_U8(gamma_out(c2.get_b())));
-               }
-               else
-               {
-                       r1=(256*App::gamma.r_F32_to_U8(c1.get_r()));
-                       g1=(256*App::gamma.g_F32_to_U8(c1.get_g()));
-                       b1=(256*App::gamma.b_F32_to_U8(c1.get_b()));
-                       r2=(256*App::gamma.r_F32_to_U8(c2.get_r()));
-                       g2=(256*App::gamma.g_F32_to_U8(c2.get_g()));
-                       b2=(256*App::gamma.b_F32_to_U8(c2.get_b()));
-               }
-
+               gushort r1=256*App::gamma.r_F32_to_U8(c1.get_r());
+               gushort g1=256*App::gamma.g_F32_to_U8(c1.get_g());
+               gushort b1=256*App::gamma.b_F32_to_U8(c1.get_b());
+               gushort r2=256*App::gamma.r_F32_to_U8(c2.get_r());
+               gushort g2=256*App::gamma.g_F32_to_U8(c2.get_g());
+               gushort b2=256*App::gamma.b_F32_to_U8(c2.get_b());
 
                if((i*2/height)&1)
                {