summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2013-01-31 21:55:46 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2013-01-31 21:55:46 +0000
commit71b23adf38b7d0cdc586327214ddb363f60af994 (patch)
tree8ac5ce5ae5be0a0837cbe1eed724082192bed038 /src
parentText toolbar will display style options for the first font in a font-family l... (diff)
downloadinkscape-71b23adf38b7d0cdc586327214ddb363f60af994.tar.gz
inkscape-71b23adf38b7d0cdc586327214ddb363f60af994.zip
Clean up Cairo rendering in a couple of widgets
(bzr r12083)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp29
-rw-r--r--src/widgets/sp-color-slider.cpp59
2 files changed, 25 insertions, 63 deletions
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 418132abb..50f30e8f4 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -1730,8 +1730,6 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtr<Cair
(bg_color_active.green + fg_color_active.green)/2.0,
(bg_color_active.blue + fg_color_active.blue)/2.0,
(bg_color_active.alpha + fg_color_active.alpha)/2.0};
-
- GdkRGBA black = {0,0,0,1};
#else
GtkStyle *style = gtk_widget_get_style(GTK_WIDGET(gobj()));
#endif
@@ -1902,11 +1900,7 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtr<Cair
// Draw drag connection
if(row_prim == prim && _in_drag) {
cr->save();
-#if GTK_CHECK_VERSION(3,0,0)
- gdk_cairo_set_source_rgba(cr->cobj(), &black);
-#else
- gdk_cairo_set_source_color(cr->cobj(), &(style->black));
-#endif
+ cr->set_source_rgb(0.0, 0.0, 0.0);
cr->move_to(outline_x, con_drag_y);
cr->line_to(mx, con_drag_y);
cr->line_to(mx, my);
@@ -1936,8 +1930,6 @@ void FilterEffectsDialog::PrimitiveList::draw_connection(const Cairo::RefPtr<Cai
(bg_color.green + fg_color.green)/2.0,
(bg_color.blue + fg_color.blue)/2.0,
(bg_color.alpha + fg_color.alpha)/2.0};
-
- GdkRGBA black = {0,0,0,1};
#else
GtkStyle *style = gtk_widget_get_style(GTK_WIDGET(gobj()));
#endif
@@ -1955,17 +1947,14 @@ void FilterEffectsDialog::PrimitiveList::draw_connection(const Cairo::RefPtr<Cai
const int tw = get_input_type_width();
gint end_x = text_start_x + tw * src_id + (int)(tw * 0.5f) + 1;
-#if GTK_CHECK_VERSION(3,0,0)
if(use_default && is_first)
- gdk_cairo_set_source_rgba(cr->cobj(), &mid_color);
- else
- gdk_cairo_set_source_rgba(cr->cobj(), &black);
+#if GTK_CHECK_VERSION(3,0,0)
+ gdk_cairo_set_source_rgba(cr->cobj(), &mid_color);
#else
- if(use_default && is_first)
- gdk_cairo_set_source_color(cr->cobj(), &(style->dark[GTK_STATE_NORMAL]));
- else
- gdk_cairo_set_source_color(cr->cobj(), &(style->black));
+ gdk_cairo_set_source_color(cr->cobj(), &(style->dark[GTK_STATE_NORMAL]));
#endif
+ else
+ cr->set_source_rgb(0.0, 0.0, 0.0);
cr->rectangle(end_x-2, y1-2, 5, 5);
cr->fill_preserve();
@@ -1993,11 +1982,7 @@ void FilterEffectsDialog::PrimitiveList::draw_connection(const Cairo::RefPtr<Cai
const int y2 = rct.get_y() + rct.get_height();
// Draw a bevelled 'L'-shaped connection
-#if GTK_CHECK_VERSION(3,0,0)
- gdk_cairo_set_source_rgba(cr->cobj(), &black);
-#else
- gdk_cairo_set_source_color(cr->cobj(), &(style->black));
-#endif
+ cr->set_source_rgb(0.0, 0.0, 0.0);
cr->move_to(x1, y1);
cr->line_to(x2-fheight/4, y1);
cr->line_to(x2, y1-fheight/4);
diff --git a/src/widgets/sp-color-slider.cpp b/src/widgets/sp-color-slider.cpp
index 37cccda9f..471ee3852 100644
--- a/src/widgets/sp-color-slider.cpp
+++ b/src/widgets/sp-color-slider.cpp
@@ -642,49 +642,26 @@ static gboolean sp_color_slider_draw(GtkWidget *widget, cairo_t *cr)
gint x = (int)(slider->value * (carea.width - 1) - ARROW_SIZE / 2 + carea.x);
gint y1 = carea.y;
gint y2 = carea.y + carea.height - 1;
- gint w = ARROW_SIZE;
cairo_set_line_width(cr, 1.0);
-#if GTK_CHECK_VERSION(3,0,0)
- GdkRGBA white = {1,1,1,1};
- GdkRGBA black = {0,0,0,1};
-#else
- GdkColor white, black;
- gdk_color_parse("#fff", &white);
- gdk_color_parse("#000", &black);
-#endif
-
- while ( w > 0 )
- {
-#if GTK_CHECK_VERSION(3,0,0)
- gdk_cairo_set_source_rgba(cr, &white);
-#else
- gdk_cairo_set_source_color(cr, &white);
-#endif
- cairo_move_to(cr, x - 0.5, y1 + 0.5);
- cairo_line_to(cr, x + w - 1 + 0.5, y1 + 0.5);
- cairo_move_to(cr, x - 0.5, y2 + 0.5);
- cairo_line_to(cr, x + w - 1 + 0.5, y2 + 0.5);
- cairo_stroke(cr);
- w -=2;
- x++;
- if ( w > 0 )
- {
-#if GTK_CHECK_VERSION(3,0,0)
- gdk_cairo_set_source_rgba(cr, &black);
-#else
- gdk_cairo_set_source_color(cr, &black);
-#endif
- cairo_move_to(cr, x - 0.5, y1 + 0.5);
- cairo_line_to(cr, x + w - 1 + 0.5, y1 + 0.5);
- cairo_move_to(cr, x - 0.5, y2 + 0.5);
- cairo_line_to(cr, x + w - 1 + 0.5, y2 + 0.5);
- cairo_stroke(cr);
- }
- y1++;
- y2--;
- }
-
+ // Define top arrow
+ cairo_move_to(cr, x - 0.5, y1 + 0.5);
+ cairo_line_to(cr, x + ARROW_SIZE - 0.5, y1 + 0.5);
+ cairo_line_to(cr, x + (ARROW_SIZE-1)/2.0, y1 + ARROW_SIZE/2.0 + 0.5);
+ cairo_line_to(cr, x - 0.5, y1 + 0.5);
+
+ // Define bottom arrow
+ cairo_move_to(cr, x - 0.5, y2 + 0.5);
+ cairo_line_to(cr, x + ARROW_SIZE - 0.5, y2 + 0.5);
+ cairo_line_to(cr, x + (ARROW_SIZE-1)/2.0, y2 - ARROW_SIZE/2.0 + 0.5);
+ cairo_line_to(cr, x - 0.5, y2 + 0.5);
+
+ // Render both arrows
+ cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
+ cairo_stroke_preserve(cr);
+ cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
+ cairo_fill(cr);
+
return FALSE;
}