From cc75fc88ee8939bab6951a67ed514b93fb457e26 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 25 Sep 2018 16:48:35 -0300 Subject: [PATCH] clutter/paint-nodes: Use texture position to draw pango layout When painting a ClutterText, there are two different aspects that should be taken into account: 1. The allocated size of the actor; and 2. The reported size of the PangoLayout, which may be smaller or bigger than (1) When (2) is bigger than (1), ClutterText has to clip the text to only draw at the visible contents over the actor surface. In addition to that, ClutterText also tracks the cursor position, which makes clipping a bit more complicated. The current ClutterTextNode.draw() implementation assumes that the (1) also represents (2), which is not true. This makes clipping not work. Fix that by assuming that the position to draw the PangoLayout is passed as the second rectangle, and the actor size is the first one. --- clutter/clutter/clutter-paint-nodes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clutter/clutter/clutter-paint-nodes.c b/clutter/clutter/clutter-paint-nodes.c index 3870ba663..aaea80b38 100644 --- a/clutter/clutter/clutter-paint-nodes.c +++ b/clutter/clutter/clutter-paint-nodes.c @@ -820,8 +820,8 @@ clutter_text_node_draw (ClutterPaintNode *node) } cogl_pango_render_layout (tnode->layout, - op->op.texrect[0], - op->op.texrect[1], + op->op.texrect[4], + op->op.texrect[5], &tnode->color, 0);