Lines where x1==x2 or y1==y2 may have the second element
null. Lines where both are null, and the width is zero, are points. This speeds things up surprisingly much. * src/ui/theme-parser.c: * src/ui/theme.c: svn path=/trunk/; revision=4119
This commit is contained in:
parent
45cbaa2d13
commit
5df096baf3
@ -1,3 +1,12 @@
|
|||||||
|
2009-02-05 Thomas Thurman <tthurman@gnome.org>
|
||||||
|
|
||||||
|
Lines where x1==x2 or y1==y2 may have the second element
|
||||||
|
null. Lines where both are null, and the width is zero,
|
||||||
|
are points. This speeds things up surprisingly much.
|
||||||
|
|
||||||
|
* src/ui/theme-parser.c:
|
||||||
|
* src/ui/theme.c:
|
||||||
|
|
||||||
2009-02-05 Thomas Thurman <tthurman@gnome.org>
|
2009-02-05 Thomas Thurman <tthurman@gnome.org>
|
||||||
|
|
||||||
* src/core/main.c: incredibly baroque system to make sure
|
* src/core/main.c: incredibly baroque system to make sure
|
||||||
|
@ -1658,7 +1658,15 @@ parse_draw_op_element (GMarkupParseContext *context,
|
|||||||
|
|
||||||
op->data.line.x1 = meta_draw_spec_new (info->theme, x1, NULL);
|
op->data.line.x1 = meta_draw_spec_new (info->theme, x1, NULL);
|
||||||
op->data.line.y1 = meta_draw_spec_new (info->theme, y1, NULL);
|
op->data.line.y1 = meta_draw_spec_new (info->theme, y1, NULL);
|
||||||
|
|
||||||
|
if (strcmp(x1, x2)==0)
|
||||||
|
op->data.line.x2 = NULL;
|
||||||
|
else
|
||||||
op->data.line.x2 = meta_draw_spec_new (info->theme, x2, NULL);
|
op->data.line.x2 = meta_draw_spec_new (info->theme, x2, NULL);
|
||||||
|
|
||||||
|
if (strcmp(y1, y2)==0)
|
||||||
|
op->data.line.y2 = NULL;
|
||||||
|
else
|
||||||
op->data.line.y2 = meta_draw_spec_new (info->theme, y2, NULL);
|
op->data.line.y2 = meta_draw_spec_new (info->theme, y2, NULL);
|
||||||
|
|
||||||
op->data.line.width = width_val;
|
op->data.line.width = width_val;
|
||||||
|
@ -2645,6 +2645,7 @@ parse_size_unchecked (MetaDrawSpec *spec,
|
|||||||
void
|
void
|
||||||
meta_draw_spec_free (MetaDrawSpec *spec)
|
meta_draw_spec_free (MetaDrawSpec *spec)
|
||||||
{
|
{
|
||||||
|
if (!spec) return;
|
||||||
free_tokens (spec->tokens, spec->n_tokens);
|
free_tokens (spec->tokens, spec->n_tokens);
|
||||||
g_slice_free (MetaDrawSpec, spec);
|
g_slice_free (MetaDrawSpec, spec);
|
||||||
}
|
}
|
||||||
@ -3489,10 +3490,25 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
|
|||||||
|
|
||||||
x1 = parse_x_position_unchecked (op->data.line.x1, env);
|
x1 = parse_x_position_unchecked (op->data.line.x1, env);
|
||||||
y1 = parse_y_position_unchecked (op->data.line.y1, env);
|
y1 = parse_y_position_unchecked (op->data.line.y1, env);
|
||||||
|
|
||||||
|
if (!op->data.line.x2 &&
|
||||||
|
!op->data.line.y2 &&
|
||||||
|
op->data.line.width==0)
|
||||||
|
gdk_draw_point (drawable, gc, x1, y1);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (op->data.line.x2)
|
||||||
x2 = parse_x_position_unchecked (op->data.line.x2, env);
|
x2 = parse_x_position_unchecked (op->data.line.x2, env);
|
||||||
|
else
|
||||||
|
x2 = x1;
|
||||||
|
|
||||||
|
if (op->data.line.y2)
|
||||||
y2 = parse_y_position_unchecked (op->data.line.y2, env);
|
y2 = parse_y_position_unchecked (op->data.line.y2, env);
|
||||||
|
else
|
||||||
|
y2 = y1;
|
||||||
|
|
||||||
gdk_draw_line (drawable, gc, x1, y1, x2, y2);
|
gdk_draw_line (drawable, gc, x1, y1, x2, y2);
|
||||||
|
}
|
||||||
|
|
||||||
g_object_unref (G_OBJECT (gc));
|
g_object_unref (G_OBJECT (gc));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user