diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2015-08-24 10:01:03 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2015-08-24 10:01:03 +0100 |
commit | 84c5846aa07080c825702af798d3bae4c888b240 (patch) | |
tree | 0d57b218cff27d9851b94bfcce1c532cf381ccdc | |
parent | af010d5e2daf09f8ce4e453e32efa4920b3d103a (diff) | |
download | clutter-84c5846aa07080c825702af798d3bae4c888b240.tar.gz |
image: Use internal function for the texture node
ClutterActor has a convenience function that removes the need to query
the actor's state and apply it to a ClutterTextureNode, so we should use
it.
-rw-r--r-- | clutter/clutter-image.c | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/clutter/clutter-image.c b/clutter/clutter-image.c index 269be0c57..f944ec43a 100644 --- a/clutter/clutter-image.c +++ b/clutter/clutter-image.c @@ -44,6 +44,7 @@ #include "clutter-image.h" +#include "clutter-actor-private.h" #include "clutter-color.h" #include "clutter-content-private.h" #include "clutter-debug.h" @@ -101,49 +102,13 @@ clutter_image_paint_content (ClutterContent *content, ClutterPaintNode *root) { ClutterImagePrivate *priv = CLUTTER_IMAGE (content)->priv; - ClutterScalingFilter min_f, mag_f; - ClutterContentRepeat repeat; ClutterPaintNode *node; - ClutterActorBox box; - ClutterColor color; - guint8 paint_opacity; if (priv->texture == NULL) return; - clutter_actor_get_content_box (actor, &box); - paint_opacity = clutter_actor_get_paint_opacity (actor); - clutter_actor_get_content_scaling_filters (actor, &min_f, &mag_f); - repeat = clutter_actor_get_content_repeat (actor); - - /* ClutterTextureNode will premultiply the blend color, so we - * want it to be white with the paint opacity - */ - color.red = 255; - color.green = 255; - color.blue = 255; - color.alpha = paint_opacity; - - node = clutter_texture_node_new (priv->texture, &color, min_f, mag_f); - clutter_paint_node_set_name (node, "Image"); - - if (repeat == CLUTTER_REPEAT_NONE) - clutter_paint_node_add_rectangle (node, &box); - else - { - float t_w = 1.f, t_h = 1.f; - - if ((repeat & CLUTTER_REPEAT_X_AXIS) != FALSE) - t_w = (box.x2 - box.x1) / cogl_texture_get_width (priv->texture); - - if ((repeat & CLUTTER_REPEAT_Y_AXIS) != FALSE) - t_h = (box.y2 - box.y1) / cogl_texture_get_height (priv->texture); - - clutter_paint_node_add_texture_rectangle (node, &box, - 0.f, 0.f, - t_w, t_h); - } - + node = clutter_actor_create_texture_paint_node (actor, priv->texture); + clutter_paint_node_set_name (node, "Image Content"); clutter_paint_node_add_child (root, node); clutter_paint_node_unref (node); } |