summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-10-08 19:24:12 +0200
committerGravatar waker <wakeroid@gmail.com>2011-10-08 19:24:12 +0200
commite869c5e86c6cb27c8b76fd92c264184c22634881 (patch)
treeba48dbd7d962d820d93ff54fc12187e6ff29a2e5 /plugins
parent106af524dc03ebebca8602a5df5d5c75ed93c99d (diff)
fixed cairo renderer for tabstrip and playlist header
Diffstat (limited to 'plugins')
-rw-r--r--plugins/gtkui/ddblistview.c4
-rw-r--r--plugins/gtkui/ddbtabstrip.c34
2 files changed, 23 insertions, 15 deletions
diff --git a/plugins/gtkui/ddblistview.c b/plugins/gtkui/ddblistview.c
index 88dab3cc..4123dfc0 100644
--- a/plugins/gtkui/ddblistview.c
+++ b/plugins/gtkui/ddblistview.c
@@ -2140,8 +2140,8 @@ ddb_listview_header_render (DdbListview *ps, cairo_t *cr) {
cairo_fill (cr);
gtkui_get_tabstrip_dark_color (&clr);
cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.f);
- cairo_move_to (cr, 0, a.height-1);
- cairo_line_to (cr, a.width, a.height-1);
+ cairo_move_to (cr, 0, a.height);
+ cairo_line_to (cr, a.width, a.height);
cairo_stroke (cr);
#else
#if GTK_CHECK_VERSION(3,0,0)
diff --git a/plugins/gtkui/ddbtabstrip.c b/plugins/gtkui/ddbtabstrip.c
index 31812e01..791409e2 100644
--- a/plugins/gtkui/ddbtabstrip.c
+++ b/plugins/gtkui/ddbtabstrip.c
@@ -339,14 +339,22 @@ static int tab_moved = 0;
static void
cairo_draw_lines (cairo_t *cr, GdkPoint *pts, int cnt) {
- cairo_new_path (cr);
+ for (int i = 1; i < cnt; i++) {
+ cairo_move_to (cr, pts[i-1].x+1, pts[i-1].y+1);
+ cairo_line_to (cr, pts[i].x+1, pts[i].y+1);
+ }
+}
+
+static void
+cairo_draw_poly (cairo_t *cr, GdkPoint *pts, int cnt) {
cairo_move_to (cr, pts[0].x, pts[0].y);
for (int i = 1; i < cnt; i++) {
cairo_line_to (cr, pts[i].x, pts[i].y);
}
- cairo_close_path (cr);
}
+
+
void
ddb_tabstrip_draw_tab (GtkWidget *widget, cairo_t *cr, int idx, int selected, int x, int y, int w, int h) {
GdkPoint points_filled[] = {
@@ -357,7 +365,7 @@ ddb_tabstrip_draw_tab (GtkWidget *widget, cairo_t *cr, int idx, int selected, in
};
GdkPoint points_frame1[] = {
{ x, y + h-2 },
- { x, y + 1 },
+ { x, y + 0 },
{ x + 1, y + 0 },
{ x + w - h - 1, y + 0 },
{ x + w - h, y + 1 },
@@ -368,14 +376,13 @@ ddb_tabstrip_draw_tab (GtkWidget *widget, cairo_t *cr, int idx, int selected, in
};
GdkPoint points_frame2[] = {
{ x + 1, y + h + 1 },
- { x + 1, y + 1 },
+ { x + 1, y + 0 },
{ x + w - h - 1, y + 1 },
{ x + w - h, y + 2 },
{ x + w - h + 1, y + 2 },
{ x + w-3, y + h - 2 },
{ x + w-2, y + h - 2 },
};
- //gdk_draw_rectangle (gtk_widget_get_window(widget), widget->style->black_gc, FALSE, x-1, y-1, w+2, h+2);
GdkColor clr_bg;
GdkColor clr_outer_frame;
GdkColor clr_inner_frame;
@@ -410,7 +417,9 @@ ddb_tabstrip_draw_tab (GtkWidget *widget, cairo_t *cr, int idx, int selected, in
gtkui_get_tabstrip_mid_color (&clr_inner_frame);
}
cairo_set_source_rgb (cr, clr_bg.red/65535.f, clr_bg.green/65535.f, clr_bg.blue/65535.0);
- cairo_draw_lines (cr, points_filled, 4);
+ cairo_new_path (cr);
+ cairo_draw_poly (cr, points_filled, 4);
+ cairo_close_path (cr);
cairo_fill (cr);
cairo_set_source_rgb (cr, clr_outer_frame.red/65535.f, clr_outer_frame.green/65535.f, clr_outer_frame.blue/65535.0);
cairo_draw_lines (cr, points_frame1, 9);
@@ -588,8 +597,8 @@ tabstrip_render (DdbTabStrip *ts, cairo_t *cr) {
gtkui_get_tabstrip_dark_color (&clr);
cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.0);
- cairo_move_to (cr, 0, 0);
- cairo_line_to (cr, a.width, 0);
+ cairo_move_to (cr, 0, 1);
+ cairo_line_to (cr, a.width, 1);
cairo_stroke (cr);
int y = 4;
@@ -630,13 +639,13 @@ tabstrip_render (DdbTabStrip *ts, cairo_t *cr) {
}
GdkColor *pclr = &gtk_widget_get_style (widget)->dark[GTK_STATE_NORMAL];
cairo_set_source_rgb (cr, pclr->red/65535.f, pclr->green/65535.f, pclr->blue/65535.0);
- cairo_move_to (cr, 0, a.height-2);
- cairo_line_to (cr, a.width, a.height-2);
+ cairo_move_to (cr, 0, a.height-1);
+ cairo_line_to (cr, a.width, a.height-1);
cairo_stroke (cr);
pclr = &gtk_widget_get_style (widget)->light[GTK_STATE_NORMAL];
cairo_set_source_rgb (cr, pclr->red/65535.f, pclr->green/65535.f, pclr->blue/65535.0);
- cairo_move_to (cr, 0, a.height-1);
- cairo_line_to (cr, a.width, a.height-1);
+ cairo_move_to (cr, 0, a.height);
+ cairo_line_to (cr, a.width, a.height);
cairo_stroke (cr);
// calc position for drawin selected tab
x = -hscroll;
@@ -683,7 +692,6 @@ tabstrip_render (DdbTabStrip *ts, cairo_t *cr) {
x += w - tab_overlap_size;
}
}
-
if (need_arrows) {
int sz = a.height-3;
gtkui_get_tabstrip_mid_color (&clr);