Much faster redraw of treeviews.

svn path=/trunk/netsurf/; revision=11058
This commit is contained in:
Michael Drake 2010-12-15 10:38:41 +00:00
parent f474bc06bf
commit bf4968f334

View File

@ -1552,7 +1552,9 @@ static void tree_draw_node_element(struct tree *tree,
if (icon != NULL && (content_get_status(icon) == if (icon != NULL && (content_get_status(icon) ==
CONTENT_STATUS_READY || CONTENT_STATUS_READY ||
content_get_status(icon) == content_get_status(icon) ==
CONTENT_STATUS_DONE)) { CONTENT_STATUS_DONE) &&
x + TREE_ICON_SIZE > clip.x0 &&
x < clip.x1) {
struct rect c; struct rect c;
/* Clip to image area */ /* Clip to image area */
c.x0 = x; c.x0 = x;
@ -1563,6 +1565,9 @@ static void tree_draw_node_element(struct tree *tree,
if (c.y0 < clip.y0) c.y0 = clip.y0; if (c.y0 < clip.y0) c.y0 = clip.y0;
if (c.x1 > clip.x1) c.x1 = clip.x1; if (c.x1 > clip.x1) c.x1 = clip.x1;
if (c.y1 > clip.y1) c.y1 = clip.y1; if (c.y1 > clip.y1) c.y1 = clip.y1;
if (c.x1 > c.x0 && c.y1 > c.y0) {
/* Valid clip rectangles only */
plot.clip(c.x0, c.y0, c.x1, c.y1); plot.clip(c.x0, c.y0, c.x1, c.y1);
content_redraw(icon , x, y + icon_inset, content_redraw(icon , x, y + icon_inset,
TREE_ICON_SIZE, TREE_ICON_SIZE, TREE_ICON_SIZE, TREE_ICON_SIZE,
@ -1571,13 +1576,14 @@ static void tree_draw_node_element(struct tree *tree,
/* Restore previous clipping area */ /* Restore previous clipping area */
plot.clip(clip.x0, clip.y0, clip.x1, clip.y1); plot.clip(clip.x0, clip.y0, clip.x1, clip.y1);
} }
}
x += NODE_INSTEP; x += NODE_INSTEP;
width -= NODE_INSTEP; width -= NODE_INSTEP;
/* fall through */ /* fall through */
case NODE_ELEMENT_TEXT: case NODE_ELEMENT_TEXT:
if (element->text == NULL) if (element->text == NULL || clip.x1 < x)
break; break;
if (element == tree->editing) if (element == tree->editing)
@ -1658,6 +1664,11 @@ static void tree_draw_node(struct tree *tree, struct node *node,
if (clip.x1 > node_extents.x1) clip.x1 = node_extents.x1; if (clip.x1 > node_extents.x1) clip.x1 = node_extents.x1;
if (clip.y1 > node_extents.y1) clip.y1 = node_extents.y1; if (clip.y1 > node_extents.y1) clip.y1 = node_extents.y1;
if (clip.x0 >= clip.x1 || clip.y0 >= clip.y1) {
/* Invalid clip rectangle */
return;
}
/* Set up the clipping area */ /* Set up the clipping area */
plot.clip(clip.x0, clip.y0, clip.x1, clip.y1); plot.clip(clip.x0, clip.y0, clip.x1, clip.y1);