paint-nodes: Use logical extents for the TextNode::draw

When we decide if we ought to clip, we should use the logical extents of
the PangoLayout, just like we do for ClutterText.
This commit is contained in:
Emmanuele Bassi 2012-02-20 10:09:05 +00:00 committed by Emmanuele Bassi
parent fa77274e80
commit 51cca132e0

View File

@ -701,13 +701,13 @@ static void
clutter_text_node_draw (ClutterPaintNode *node) clutter_text_node_draw (ClutterPaintNode *node)
{ {
ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node); ClutterTextNode *tnode = CLUTTER_TEXT_NODE (node);
PangoRectangle ink_extents; PangoRectangle extents;
guint i; guint i;
if (node->operations == NULL) if (node->operations == NULL)
return; return;
pango_layout_get_pixel_extents (tnode->layout, &ink_extents, NULL); pango_layout_get_pixel_extents (tnode->layout, NULL, &extents);
for (i = 0; i < node->operations->len; i++) for (i = 0; i < node->operations->len; i++)
{ {
@ -727,8 +727,8 @@ clutter_text_node_draw (ClutterPaintNode *node)
* we clip the layout when drawin, to avoid spilling * we clip the layout when drawin, to avoid spilling
* it out * it out
*/ */
if (ink_extents.width > op_width || if (extents.width > op_width ||
ink_extents.height > op_height) extents.height > op_height)
{ {
cogl_clip_push_rectangle (op->op.texrect[0], cogl_clip_push_rectangle (op->op.texrect[0],
op->op.texrect[1], op->op.texrect[1],