Initicalize stage perspective matrix for defaults
authorTomas Frydrych <tf@openedhand.com>
Fri, 1 Jun 2007 11:30:52 +0000 (11:30 +0000)
committerTomas Frydrych <tf@openedhand.com>
Fri, 1 Jun 2007 11:30:52 +0000 (11:30 +0000)
ChangeLog
clutter/clutter-stage.c

index 924b8ae..c2308ce 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2007-06-01  Tomas Frydrych  <tf@openedhand.com>
 
+       * clutter/clutter-stage.c:
+       (clutter_stage_init):
+       Call _clutter_stage_refresh_perspective_matrix to initialize the
+       matrix for default values.
+       
+2007-06-01  Tomas Frydrych  <tf@openedhand.com>
+
        * clutter/clutter-fixed.h:
        * clutter/clutter-behaviour-ellipse.h:
        * clutter/clutter-behaviour-ellipse.c:
index 31fb2b6..c35847b 100644 (file)
@@ -385,6 +385,43 @@ clutter_stage_class_init (ClutterStageClass *klass)
 }
 
 static void
+_clutter_stage_refresh_perspective_matrix (ClutterStagePrivate * priv)
+{
+  ClutterFixed xmax, ymax;
+  ClutterFixed x, y, c, d;
+
+  memset (&priv->perspective_mtx[0], 0, sizeof (priv->perspective_mtx));
+
+  ymax = clutter_qmulx (priv->perspective.z_near,
+                       clutter_tani (priv->perspective.fovy >> 1));
+  
+  xmax = clutter_qmulx (ymax, priv->perspective.aspect);
+
+  x = CFX_DIV (priv->perspective.z_near, xmax);
+  y = CFX_DIV (priv->perspective.z_near, ymax);
+  c = CFX_DIV (-(priv->perspective.z_far + priv->perspective.z_near),
+              ( priv->perspective.z_far - priv->perspective.z_near));
+  
+  d = CFX_DIV (-(clutter_qmulx (2 * priv->perspective.z_far,
+                               priv->perspective.z_near)),
+              (priv->perspective.z_far - priv->perspective.z_near));
+
+#define M(row,col)  priv->perspective_mtx[col*4+row]
+  M(0,0) = x;
+  M(1,1) = y;
+  M(2,2) = c;
+  M(2,3) = d;
+  M(3,2) = -CFX_ONE;
+#undef M
+}
+
+const ClutterFixed *
+_clutter_stage_get_perspective_matrix (ClutterStage * stage)
+{
+  return &stage->priv->perspective_mtx[0];
+}
+
+static void
 clutter_stage_init (ClutterStage *self)
 {
   ClutterStagePrivate *priv;
@@ -407,6 +444,8 @@ clutter_stage_init (ClutterStage *self)
   priv->perspective.aspect = CFX_ONE;
   priv->perspective.z_near = CLUTTER_FLOAT_TO_FIXED (0.1);
   priv->perspective.z_far  = CLUTTER_FLOAT_TO_FIXED (100.0);
+
+  _clutter_stage_refresh_perspective_matrix (priv);
   
   clutter_actor_set_size (CLUTTER_ACTOR (self), 640, 480);
 }
@@ -486,43 +525,6 @@ clutter_stage_get_color (ClutterStage *stage,
   color->alpha = priv->color.alpha;
 }
 
-static void
-_clutter_stage_refresh_perspective_matrix (ClutterStagePrivate * priv)
-{
-  ClutterFixed xmax, ymax;
-  ClutterFixed x, y, c, d;
-
-  memset (&priv->perspective_mtx[0], 0, sizeof (priv->perspective_mtx));
-
-  ymax = clutter_qmulx (priv->perspective.z_near,
-                       clutter_tani (priv->perspective.fovy >> 1));
-  
-  xmax = clutter_qmulx (ymax, priv->perspective.aspect);
-
-  x = CFX_DIV (priv->perspective.z_near, xmax);
-  y = CFX_DIV (priv->perspective.z_near, ymax);
-  c = CFX_DIV (-(priv->perspective.z_far + priv->perspective.z_near),
-              ( priv->perspective.z_far - priv->perspective.z_near));
-  
-  d = CFX_DIV (-(clutter_qmulx (2 * priv->perspective.z_far,
-                               priv->perspective.z_near)),
-              (priv->perspective.z_far - priv->perspective.z_near));
-
-#define M(row,col)  priv->perspective_mtx[col*4+row]
-  M(0,0) = x;
-  M(1,1) = y;
-  M(2,2) = c;
-  M(2,3) = d;
-  M(3,2) = -CFX_ONE;
-#undef M
-}
-
-const ClutterFixed *
-_clutter_stage_get_perspective_matrix (ClutterStage * stage)
-{
-  return &stage->priv->perspective_mtx[0];
-}
-
 /**
  * clutter_stage_set_perspectivex
  * @stage: A #ClutterStage