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.
This commit is contained in:
Georges Basile Stavracas Neto 2018-09-25 16:48:35 -03:00
parent 68ec9ac017
commit cc75fc88ee
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385

View File

@ -820,8 +820,8 @@ clutter_text_node_draw (ClutterPaintNode *node)
} }
cogl_pango_render_layout (tnode->layout, cogl_pango_render_layout (tnode->layout,
op->op.texrect[0], op->op.texrect[4],
op->op.texrect[1], op->op.texrect[5],
&tnode->color, &tnode->color,
0); 0);