Skip to content
Snippets Groups Projects
Commit 8e284856 authored by gb10's avatar gb10
Browse files

Fixed a bug with drawing clipped intron lines

parent ba9b29ed
No related branches found
No related tags found
No related merge requests found
......@@ -147,33 +147,32 @@ static void drawIntronLine(DrawData *data, const gint x1, const gint y1, const g
int xEnd = x2;
int yStart = y1;
int yEnd = y2;
gboolean clip = FALSE;
/* Clip the start/end x values if out of range */
if (xStart < clipRect->x)
{
const int origWidth = abs(xEnd - xStart);
xStart = clipRect->x;
clip = TRUE;
const int newWidth = abs(xEnd - xStart);
const int newHeight = roundNearest((double)(yEnd - yStart) * (double)newWidth / (double)origWidth); /* negative if yend < ystart */
yStart = yEnd - newHeight;
}
if (xEnd > xMax)
{
const int origWidth = abs(xEnd - xStart);
xEnd = xMax;
clip = TRUE;
}
if (clip)
{
/* Reduce the height by the same amount as the width has reduced */
int newWidth = abs(xEnd - xStart);
int newHeight = abs(y2 - y1) * newWidth / clipRect->width;
const int newWidth = abs(xEnd - xStart);
const int newHeight = roundNearest((double)(yEnd - yStart) * (double)newWidth / (double)origWidth);
if (yStart > yEnd)
yEnd = yStart - newHeight;
else
yStart = yEnd - newHeight;
yEnd = yStart + newHeight;
}
gdk_draw_line(data->drawable, data->gc, xStart, yStart, xEnd, yEnd);
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment