示例#1
0
gboolean
coord_within_actor (ClutterActor *actor, gint x, gint y)
{
  gint x1, x2, y1, y2;

  clutter_actor_get_coords (actor, &x1, &y1, &x2, &y2);

  return ((x >= x1 && x < x2 || x == x2) && (y >= y1 && y < y2 || y == y2));
}
示例#2
0
static void
clutter_reflect_texture_paint (ClutterActor *self)
{
  ClutterReflectTexturePrivate  *priv;
  ClutterActor                *parent_texture;
  gint                         x1, y1, x2, y2;
  GLenum                       target_type;

  priv = CLUTTER_REFLECT_TEXTURE (self)->priv;

  /* no need to paint stuff if we don't have a texture to reflect */
  if (!clutter_clone_texture_get_parent_texture(CLUTTER_CLONE_TEXTURE(self)))
    return;

  /* parent texture may have been hidden, there for need to make sure its 
   * realised with resources available.  
  */
  parent_texture = CLUTTER_ACTOR (clutter_clone_texture_get_parent_texture(CLUTTER_CLONE_TEXTURE(self)));
  if (!CLUTTER_ACTOR_IS_REALIZED (parent_texture))
    clutter_actor_realize (parent_texture);

  /* FIXME: figure out nicer way of getting at this info...  
   */  
  if (clutter_feature_available (CLUTTER_FEATURE_TEXTURE_RECTANGLE) &&
      clutter_texture_is_tiled (CLUTTER_TEXTURE (parent_texture)) == FALSE)
    {
      target_type = CGL_TEXTURE_RECTANGLE_ARB;
      cogl_enable (CGL_ENABLE_TEXTURE_RECT | CGL_ENABLE_BLEND);
    }
  else
    {
      target_type = CGL_TEXTURE_2D;
      cogl_enable (CGL_ENABLE_TEXTURE_2D|CGL_ENABLE_BLEND);
    }
  
  cogl_push_matrix ();

  glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

  glColor4ub (255, 255, 255, clutter_actor_get_opacity (self));

  clutter_actor_get_coords (self, &x1, &y1, &x2, &y2);

  /* Parent paint translated us into position */
  reflect_texture_render_to_gl_quad (CLUTTER_REFLECT_TEXTURE (self), 
				   0, 0, x2 - x1, y2 - y1);

  cogl_pop_matrix ();
}