[cairo-commit] goocanvas/src goocanvasitemsimple.c, 1.9,
1.10 goocanvasitemsimple.h, 1.7, 1.8 goocanvastextview.c, 1.11, 1.12
Damon Chaplin
commit at pdx.freedesktop.org
Fri May 12 07:42:12 PDT 2006
Committed by: damon
Update of /cvs/cairo/goocanvas/src
In directory kemper:/tmp/cvs-serv8258/src
Modified Files:
goocanvasitemsimple.c goocanvasitemsimple.h
goocanvastextview.c
Log Message:
2006-05-12 Damon Chaplin <damon at gnome.org>
* src/goocanvastextview.c (goo_canvas_text_view_create_layout): if
there is no text return an empty layout rather than NULL.
(goo_canvas_text_view_get_item_at): check if there is no text first.
* src/goocanvasitemsimple.[hc]: rename operator to op since operator
is a C++ keyword (reported by Yevgen Muntyan).
Index: goocanvasitemsimple.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemsimple.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- goocanvasitemsimple.c 22 Apr 2006 19:17:28 -0000 1.9
+++ goocanvasitemsimple.c 12 May 2006 14:42:10 -0000 1.10
@@ -100,7 +100,7 @@
style->line_width = 2.0;
style->line_join_miter_limit = 10.0;
style->fill_rule = CAIRO_FILL_RULE_WINDING;
- style->operator = CAIRO_OPERATOR_OVER;
+ style->op = CAIRO_OPERATOR_OVER;
style->antialias = CAIRO_ANTIALIAS_DEFAULT;
style->line_cap = CAIRO_LINE_CAP_BUTT;
style->line_join = CAIRO_LINE_JOIN_MITER;
@@ -132,7 +132,7 @@
style->line_join_miter_limit = orig_style->line_join_miter_limit;
style->dash = goo_canvas_line_dash_ref (orig_style->dash);
style->fill_rule = orig_style->fill_rule;
- style->operator = orig_style->operator;
+ style->op = orig_style->op;
style->antialias = orig_style->antialias;
style->line_cap = orig_style->line_cap;
style->line_join = orig_style->line_join;
@@ -385,7 +385,7 @@
break;
case PROP_OPERATOR:
g_value_set_enum (value, mask & GOO_CANVAS_STYLE_OPERATOR
- ? style->operator : CAIRO_OPERATOR_OVER);
+ ? style->op : CAIRO_OPERATOR_OVER);
break;
case PROP_ANTIALIAS:
g_value_set_enum (value, mask & GOO_CANVAS_STYLE_ANTIALIAS
@@ -492,7 +492,7 @@
style->mask |= GOO_CANVAS_STYLE_FILL_RULE;
break;
case PROP_OPERATOR:
- style->operator = g_value_get_enum (value);
+ style->op = g_value_get_enum (value);
style->mask |= GOO_CANVAS_STYLE_OPERATOR;
break;
case PROP_ANTIALIAS:
@@ -721,7 +721,7 @@
mask = style->mask;
if (mask & GOO_CANVAS_STYLE_OPERATOR)
- cairo_set_operator (cr, style->operator);
+ cairo_set_operator (cr, style->op);
if (mask & GOO_CANVAS_STYLE_ANTIALIAS)
cairo_set_antialias (cr, style->antialias);
@@ -755,7 +755,7 @@
mask = style->mask;
if (mask & GOO_CANVAS_STYLE_OPERATOR)
- cairo_set_operator (cr, style->operator);
+ cairo_set_operator (cr, style->op);
if (mask & GOO_CANVAS_STYLE_ANTIALIAS)
cairo_set_antialias (cr, style->antialias);
Index: goocanvasitemsimple.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemsimple.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- goocanvasitemsimple.h 18 Apr 2006 23:40:44 -0000 1.7
+++ goocanvasitemsimple.h 12 May 2006 14:42:10 -0000 1.8
@@ -86,7 +86,7 @@
/* We use bitmasks here to cut down on memory use a bit. I've given each
field a few bits more than it needs to allow for new values. */
cairo_fill_rule_t fill_rule : 3;
- cairo_operator_t operator : 6;
+ cairo_operator_t op : 6;
cairo_antialias_t antialias : 4;
cairo_line_cap_t line_cap : 4;
cairo_line_join_t line_join : 4;
Index: goocanvastextview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvastextview.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- goocanvastextview.c 24 Apr 2006 13:53:42 -0000 1.11
+++ goocanvastextview.c 12 May 2006 14:42:10 -0000 1.12
@@ -104,14 +104,9 @@
PangoContext *context;
PangoRectangle logical_rect;
double width, height;
+ gchar *string;
- /* If there is no text just return. */
- if (!text->text || !text->text[0])
- {
- if (bounds)
- bounds->x1 = bounds->y1 = bounds->x2 = bounds->y2 = 0.0;
- return NULL;
- }
+ string = text->text ? text->text : "";
layout = pango_cairo_create_layout (cr);
@@ -124,9 +119,9 @@
pango_layout_set_width (layout, (double) text->width * PANGO_SCALE);
if (text->use_markup)
- pango_layout_set_markup (layout, text->text, -1);
+ pango_layout_set_markup (layout, string, -1);
else
- pango_layout_set_text (layout, text->text, -1);
+ pango_layout_set_text (layout, string, -1);
if (text->font_desc)
pango_layout_set_font_description (layout, text->font_desc);
@@ -134,6 +129,8 @@
if (text->alignment != PANGO_ALIGN_LEFT)
pango_layout_set_alignment (layout, text->alignment);
+ /* FIXME: Sometimes we should be using the ink_rect rather than the
+ logical rect, e.g. for the actual bounds of the item view. */
if (bounds)
{
/* Get size of the text, so we can position it according to anchor. */
@@ -244,6 +241,11 @@
PangoRectangle log_rect;
int px, py;
double user_x = x, user_y = y;
+ int line_num = 0;
+
+ /* If there is no text just return. */
+ if (!text->text || !text->text[0])
+ return NULL;
if (simple_view->flags & GOO_CANVAS_ITEM_VIEW_NEED_UPDATE)
goo_canvas_item_view_ensure_updated (view);
More information about the cairo-commit
mailing list