interactive/content: Define the size of the text geometry

So that Clutter can decide whether or not to clip the text properly.
This commit is contained in:
Emmanuele Bassi 2012-02-20 10:09:58 +00:00 committed by Emmanuele Bassi
parent 51cca132e0
commit ff7eb6c0a9

View File

@ -78,6 +78,8 @@ color_content_paint_content (ClutterContent *content,
/* top-left */ /* top-left */
box.x1 = clutter_actor_box_get_x (&content_box); box.x1 = clutter_actor_box_get_x (&content_box);
box.y1 = clutter_actor_box_get_y (&content_box); box.y1 = clutter_actor_box_get_y (&content_box);
box.x2 = box.x1 + logical.width;
box.y2 = box.y1 + logical.height;
clutter_paint_node_add_rectangle (node, &box); clutter_paint_node_add_rectangle (node, &box);
/* top-right */ /* top-right */
@ -85,6 +87,8 @@ color_content_paint_content (ClutterContent *content,
+ clutter_actor_box_get_width (&content_box) + clutter_actor_box_get_width (&content_box)
- logical.width; - logical.width;
box.y1 = clutter_actor_box_get_y (&content_box); box.y1 = clutter_actor_box_get_y (&content_box);
box.x2 = box.x1 + logical.width;
box.y2 = box.y1 + logical.height;
clutter_paint_node_add_rectangle (node, &box); clutter_paint_node_add_rectangle (node, &box);
/* bottom-right */ /* bottom-right */
@ -94,6 +98,8 @@ color_content_paint_content (ClutterContent *content,
box.y1 = clutter_actor_box_get_y (&content_box) box.y1 = clutter_actor_box_get_y (&content_box)
+ clutter_actor_box_get_height (&content_box) + clutter_actor_box_get_height (&content_box)
- logical.height; - logical.height;
box.x2 = box.x1 + logical.width;
box.y2 = box.y1 + logical.height;
clutter_paint_node_add_rectangle (node, &box); clutter_paint_node_add_rectangle (node, &box);
/* bottom-left */ /* bottom-left */
@ -101,6 +107,8 @@ color_content_paint_content (ClutterContent *content,
box.y1 = clutter_actor_box_get_y (&content_box) box.y1 = clutter_actor_box_get_y (&content_box)
+ clutter_actor_box_get_height (&content_box) + clutter_actor_box_get_height (&content_box)
- logical.height; - logical.height;
box.x2 = box.x1 + logical.width;
box.y2 = box.y1 + logical.height;
clutter_paint_node_add_rectangle (node, &box); clutter_paint_node_add_rectangle (node, &box);
/* center */ /* center */
@ -108,6 +116,8 @@ color_content_paint_content (ClutterContent *content,
+ (clutter_actor_box_get_width (&content_box) - logical.width) / 2.0; + (clutter_actor_box_get_width (&content_box) - logical.width) / 2.0;
box.y1 = clutter_actor_box_get_y (&content_box) box.y1 = clutter_actor_box_get_y (&content_box)
+ (clutter_actor_box_get_height (&content_box) - logical.height) / 2.0; + (clutter_actor_box_get_height (&content_box) - logical.height) / 2.0;
box.x2 = box.x1 + logical.width;
box.y2 = box.y1 + logical.height;
clutter_paint_node_add_rectangle (node, &box); clutter_paint_node_add_rectangle (node, &box);
clutter_paint_node_add_child (root, node); clutter_paint_node_add_child (root, node);