diff options
author | Martin Mathieson <martin.r.mathieson@googlemail.com> | 2012-07-29 23:03:50 +0000 |
---|---|---|
committer | Martin Mathieson <martin.r.mathieson@googlemail.com> | 2012-07-29 23:03:50 +0000 |
commit | e0d889336262d0e5f02caf089e374ee4f8e3b1ce (patch) | |
tree | 4a74d7c5b6941d85d0e2f6ff8a75dc6d437a7844 | |
parent | 4944c79982860c824fcea156fa5839ae8804d6bb (diff) | |
download | wireshark-e0d889336262d0e5f02caf089e374ee4f8e3b1ce.tar.gz |
Don't try to clip the line to the outside of the visible area - let
cairo do it. The clipping that was done worked properly for horizontal/verical
lines only, but would not for diagonal ones.
svn path=/trunk/; revision=44125
-rw-r--r-- | ui/gtk/tcp_graph.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ui/gtk/tcp_graph.c b/ui/gtk/tcp_graph.c index 3e28a664e9..1d8fdd0616 100644 --- a/ui/gtk/tcp_graph.c +++ b/ui/gtk/tcp_graph.c @@ -2266,6 +2266,8 @@ static void graph_pixmap_draw (struct graph *g) /* Changing colour */ current_line_color = color_to_set = e->elment_color_p; } + + /* Draw the line */ draw_element_line (g, e, cr, color_to_set); break; @@ -2315,20 +2317,18 @@ static void draw_element_line (struct graph *g, struct element *e, cairo_t *cr, yy2=yy1; yy1=tmp; } - if ((xx1<0 && xx2<0) || (xx1>=g->wp.width && xx2>=g->wp.width) || - (yy1<0 && yy2<0) || (yy1>=g->wp.height && yy2>=g->wp.height)) { + + /* If line completely out of the area, we won't show it */ + if ((xx1<0 && xx2<0) || (xx1>=g->wp.width && xx2>=g->wp.width) || + (yy1<0 && yy2<0) || (yy1>=g->wp.height && yy2>=g->wp.height)) { debug(DBS_GRAPH_DRAWING) printf (" refusing: (%d,%d)->(%d,%d)\n", xx1, yy1, xx2, yy2); return; } - if (xx2 > g->wp.width-1) - xx2 = g->wp.width-1; - if (xx1 < 0) - xx1 = 0; - if (yy2 > g->wp.height-1) - yy2 = g->wp.height-1; - if (yy1 < 0) - yy1 = 0; + + /* If one end of the line is out of bounds, don't worry. Cairo will + clip the line to the outside of g->wp at the correct angle! */ + debug(DBS_GRAPH_DRAWING) printf ("line: (%d,%d)->(%d,%d)\n", xx1, yy1, xx2,yy2); g_assert(e->elment_color_p!=NULL); |