2007-12-24 Emmanuele Bassi <ebassi@openedhand.com>
authorEmmanuele Bassi <ebassi@openedhand.com>
Mon, 24 Dec 2007 14:21:19 +0000 (14:21 +0000)
committerEmmanuele Bassi <ebassi@openedhand.com>
Mon, 24 Dec 2007 14:21:19 +0000 (14:21 +0000)
* clutter.symbols: Add clutter_actor_set_clipu() and
clutter_actor_get_clipu()

* clutter/clutter-actor.h:
* clutter/clutter-actor.c:
(clutter_actor_set_clipu), (clutter_actor_get_clipu): Add the
new units-based versions of the clip accessors

(clutter_actor_set_clip), (clutter_actor_get_clip): Reimplement
the pixels-based clip accessors as proxies for the units-based
ones

ChangeLog
clutter.symbols
clutter/clutter-actor.c
clutter/clutter-actor.h
doc/reference/ChangeLog
doc/reference/clutter-sections.txt

index a38e383..3c17e01 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2007-12-24  Emmanuele Bassi  <ebassi@openedhand.com>
 
+       * clutter.symbols: Add clutter_actor_set_clipu() and
+       clutter_actor_get_clipu()
+
+       * clutter/clutter-actor.h:
+       * clutter/clutter-actor.c:
+       (clutter_actor_set_clipu), (clutter_actor_get_clipu): Add the
+       new units-based versions of the clip accessors
+
+       (clutter_actor_set_clip), (clutter_actor_get_clip): Reimplement
+       the pixels-based clip accessors as proxies for the units-based
+       ones
+
+2007-12-24  Emmanuele Bassi  <ebassi@openedhand.com>
+
        * clutter/cogl/cogl.h: Update cogl_clip_set() to accept the
        clip components as ClutterFixed values
 
index 8c7236e..8e82a81 100644 (file)
@@ -7,6 +7,7 @@ clutter_actor_get_abs_size
 clutter_actor_get_anchor_point
 clutter_actor_get_anchor_pointu
 clutter_actor_get_clip
+clutter_actor_get_clipu
 clutter_actor_get_coords
 clutter_actor_get_depth
 clutter_actor_get_geometry
@@ -50,6 +51,7 @@ clutter_actor_set_anchor_point
 clutter_actor_set_anchor_point_from_gravity
 clutter_actor_set_anchor_pointu
 clutter_actor_set_clip
+clutter_actor_set_clipu
 clutter_actor_set_depth
 clutter_actor_set_geometry
 clutter_actor_set_height
index 78ddb3e..e2abaaf 100644 (file)
@@ -3384,23 +3384,27 @@ clutter_actor_get_rotation (ClutterActor      *self,
 }
 
 /**
- * clutter_actor_set_clip:
+ * clutter_actor_set_clipu:
  * @self: A #ClutterActor
- * @xoff: X offset of the clip rectangle
- * @yoff: Y offset of the clip rectangle
- * @width: Width of the clip rectangle
- * @height: Height of the clip rectangle
+ * @xoff: X offset of the clip rectangle, in #ClutterUnit<!-- -->s
+ * @yoff: Y offset of the clip rectangle, in #ClutterUnit<!-- -->s
+ * @width: Width of the clip rectangle, in #ClutterUnit<!-- -->s
+ * @height: Height of the clip rectangle, in #ClutterUnit<!-- -->s
  *
- * Sets clip area in pixels for @self. The clip area is always computed
- * from the upper left corner of the actor, even if the anchor point is
- * set otherwise.
+ * Unit-based variant of clutter_actor_set_clip()
+ *
+ * Sets clip area for @self. The clip area is always computed from the
+ * upper left corner of the actor, even if the anchor point is set
+ * otherwise.
+ *
+ * Since: 0.6
  */
 void
-clutter_actor_set_clip (ClutterActor *self,
-                       gint          xoff,
-                       gint          yoff,
-                       gint          width,
-                       gint          height)
+clutter_actor_set_clipu (ClutterActor *self,
+                        ClutterUnit   xoff,
+                        ClutterUnit   yoff,
+                        ClutterUnit   width,
+                        ClutterUnit   height)
 {
   ClutterActorPrivate *priv;
 
@@ -3408,10 +3412,10 @@ clutter_actor_set_clip (ClutterActor *self,
 
   priv = self->priv;
 
-  priv->clip[0] = CLUTTER_UNITS_FROM_DEVICE (xoff);
-  priv->clip[1] = CLUTTER_UNITS_FROM_DEVICE (yoff);
-  priv->clip[2] = CLUTTER_UNITS_FROM_DEVICE (width);
-  priv->clip[3] = CLUTTER_UNITS_FROM_DEVICE (height);
+  priv->clip[0] = xoff;
+  priv->clip[1] = yoff;
+  priv->clip[2] = width;
+  priv->clip[3] = height;
 
   priv->has_clip = TRUE;
 
@@ -3420,6 +3424,34 @@ clutter_actor_set_clip (ClutterActor *self,
 }
 
 /**
+ * clutter_actor_set_clip:
+ * @self: A #ClutterActor
+ * @xoff: X offset of the clip rectangle, in pixels
+ * @yoff: Y offset of the clip rectangle, in pixels
+ * @width: Width of the clip rectangle, in pixels
+ * @height: Height of the clip rectangle, in pixels
+ *
+ * Sets clip area in pixels for @self. The clip area is always computed
+ * from the upper left corner of the actor, even if the anchor point is
+ * set otherwise.
+ */
+void
+clutter_actor_set_clip (ClutterActor *self,
+                        gint          xoff,
+                        gint          yoff,
+                        gint          width,
+                        gint          height)
+{
+  g_return_if_fail (CLUTTER_IS_ACTOR (self));
+
+  clutter_actor_set_clipu (self,
+                           CLUTTER_UNITS_FROM_DEVICE (xoff),
+                           CLUTTER_UNITS_FROM_DEVICE (yoff),
+                           CLUTTER_UNITS_FROM_DEVICE (width),
+                           CLUTTER_UNITS_FROM_DEVICE (height));
+}
+
+/**
  * clutter_actor_remove_clip
  * @self: A #ClutterActor
  *
@@ -3454,23 +3486,25 @@ clutter_actor_has_clip (ClutterActor *self)
 }
 
 /**
- * clutter_actor_get_clip:
+ * clutter_actor_get_clipu:
  * @self: a #ClutterActor
  * @xoff: return location for the X offset of the clip rectangle, or %NULL
  * @yoff: return location for the Y offset of the clip rectangle, or %NULL
  * @width: return location for the width of the clip rectangle, or %NULL
  * @height: return location for the height of the clip rectangle, or %NULL
  *
- * Gets the clip area for @self, in pixels.
+ * Unit-based variant of clutter_actor_get_clip().
+ *
+ * Gets the clip area for @self, in #ClutterUnit<!-- -->s.
  *
  * Since: 0.6
  */
 void
-clutter_actor_get_clip (ClutterActor *self,
-                       gint         *xoff,
-                       gint         *yoff,
-                       gint         *width,
-                       gint         *height)
+clutter_actor_get_clipu (ClutterActor *self,
+                         ClutterUnit  *xoff,
+                        ClutterUnit  *yoff,
+                        ClutterUnit  *width,
+                        ClutterUnit  *height)
 {
   ClutterActorPrivate *priv;
 
@@ -3482,16 +3516,54 @@ clutter_actor_get_clip (ClutterActor *self,
     return;
 
   if (xoff)
-    *xoff = CLUTTER_UNITS_TO_DEVICE (priv->clip[0]);
+    *xoff = priv->clip[0];
+
+  if (yoff)
+    *yoff = priv->clip[1];
+
+  if (width)
+    *width = priv->clip[2];
+
+  if (height)
+    *height = priv->clip[3];
+}
+
+/**
+ * clutter_actor_get_clip:
+ * @self: a #ClutterActor
+ * @xoff: return location for the X offset of the clip rectangle, or %NULL
+ * @yoff: return location for the Y offset of the clip rectangle, or %NULL
+ * @width: return location for the width of the clip rectangle, or %NULL
+ * @height: return location for the height of the clip rectangle, or %NULL
+ *
+ * Gets the clip area for @self, in pixels.
+ *
+ * Since: 0.6
+ */
+void
+clutter_actor_get_clip (ClutterActor *self,
+                        gint         *xoff,
+                        gint         *yoff,
+                        gint         *width,
+                        gint         *height)
+{
+  struct clipu { ClutterUnit x, y, width, height; } c = { 0, };
+
+  g_return_if_fail (CLUTTER_IS_ACTOR (self));
+
+  clutter_actor_get_clipu (self, &c.x, &c.y, &c.width, &c.height);
+
+  if (xoff)
+    *xoff = CLUTTER_UNITS_TO_DEVICE (c.x);
 
   if (yoff)
-    *yoff = CLUTTER_UNITS_TO_DEVICE (priv->clip[1]);
+    *yoff = CLUTTER_UNITS_TO_DEVICE (c.y);
 
   if (width)
-    *width = CLUTTER_UNITS_TO_DEVICE (priv->clip[2]);
+    *width = CLUTTER_UNITS_TO_DEVICE (c.width);
 
   if (height)
-    *height = CLUTTER_UNITS_TO_DEVICE (priv->clip[3]);
+    *height = CLUTTER_UNITS_TO_DEVICE (c.height);
 }
 
 /**
index 0f63415..8b9e60b 100644 (file)
@@ -334,6 +334,11 @@ void                  clutter_actor_set_clip         (ClutterActor          *sel
                                                      gint                   yoff,
                                                      gint                   width,
                                                      gint                   height);
+void                  clutter_actor_set_clipu        (ClutterActor          *self,
+                                                     ClutterUnit            xoff,
+                                                     ClutterUnit            yoff,
+                                                     ClutterUnit            width,
+                                                     ClutterUnit            height);
 void                  clutter_actor_remove_clip      (ClutterActor          *self);
 gboolean              clutter_actor_has_clip         (ClutterActor          *self);
 void                  clutter_actor_get_clip         (ClutterActor          *self,
@@ -341,6 +346,11 @@ void                  clutter_actor_get_clip         (ClutterActor          *sel
                                                       gint                  *yoff,
                                                       gint                  *width,
                                                       gint                  *height);
+void                  clutter_actor_get_clipu        (ClutterActor          *self,
+                                                      ClutterUnit           *xoff,
+                                                      ClutterUnit           *yoff,
+                                                      ClutterUnit           *width,
+                                                      ClutterUnit           *height);
 void                  clutter_actor_set_parent       (ClutterActor          *self,
                                                      ClutterActor          *parent);
 ClutterActor *        clutter_actor_get_parent       (ClutterActor          *self);
index 77e0b62..5d79657 100644 (file)
@@ -1,3 +1,9 @@
+2007-12-24  Emmanuele Bassi,,,  <ebassi@sprite>
+
+       reviewed by: <delete if not using a buddy>
+
+       * clutter-sections.txt:
+
 2007-12-21  Emmanuele Bassi  <ebassi@openedhand.com>
 
        * clutter-sections.txt: Add clutter_group_add() and
index 78e9cca..1a4325d 100644 (file)
@@ -384,6 +384,8 @@ clutter_actor_set_sizeu
 clutter_actor_get_sizeu
 clutter_actor_set_anchor_pointu
 clutter_actor_get_anchor_pointu
+clutter_actor_set_clipu
+clutter_actor_get_clipu
 
 <SUBSECTION>
 clutter_actor_set_scalex