From d07cf2aeaf95ac90d7eca16ab39a4c4bda9743e6 Mon Sep 17 00:00:00 2001 From: dooglus Date: Tue, 25 Sep 2007 12:29:10 +0000 Subject: [PATCH] Simplify the code by using colorconv_synfig2gdk() rather than repeating its functionality here. Incidentally, the last change fixed a bug illustrated here: http://wiki.synfig.com/images/d/d1/Color-editor-linear-bug.jpg -- the positions of the three R,G,B sliders should all be pointing at the same color, but they weren't. The lower image shows how it looks after the previous commit - all three slider positions are the same color. git-svn-id: http://svn.voria.com/code@754 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/widget_coloredit.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/widget_coloredit.cpp b/synfig-studio/trunk/src/gtkmm/widget_coloredit.cpp index fc87e3c..79cafc3 100644 --- a/synfig-studio/trunk/src/gtkmm/widget_coloredit.cpp +++ b/synfig-studio/trunk/src/gtkmm/widget_coloredit.cpp @@ -153,7 +153,6 @@ ColorSlider::redraw(GdkEventExpose */*bleh*/) Glib::RefPtr gc(Gdk::GC::create(get_window())); const Color bg1(0.75, 0.75, 0.75); const Color bg2(0.5, 0.5, 0.5); - Gdk::Color gdk_c; int i; for(i=width-1;i>=0;i--) { @@ -163,31 +162,20 @@ ColorSlider::redraw(GdkEventExpose */*bleh*/) assert(c1.is_valid()); assert(c2.is_valid()); - 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) { - gdk_c.set_rgb(r1,g1,b1); - gc->set_rgb_fg_color(gdk_c); + gc->set_rgb_fg_color(colorconv_synfig2gdk(c1)); get_window()->draw_rectangle(gc, true, ca.get_x()+i, ca.get_y(), 1, height/2); - gdk_c.set_rgb(r2,g2,b2); - gc->set_rgb_fg_color(gdk_c); + gc->set_rgb_fg_color(colorconv_synfig2gdk(c2)); get_window()->draw_rectangle(gc, true, ca.get_x()+i, ca.get_y()+height/2, 1, height/2); } else { - gdk_c.set_rgb(r2,g2,b2); - gc->set_rgb_fg_color(gdk_c); + gc->set_rgb_fg_color(colorconv_synfig2gdk(c2)); get_window()->draw_rectangle(gc, true, ca.get_x()+i, ca.get_y(), 1, height/2); - gdk_c.set_rgb(r1,g1,b1); - gc->set_rgb_fg_color(gdk_c); + gc->set_rgb_fg_color(colorconv_synfig2gdk(c1)); get_window()->draw_rectangle(gc, true, ca.get_x()+i, ca.get_y()+height/2, 1, height/2); } } -- 2.7.4