diff --git a/ChangeLog b/ChangeLog index 924b8aeb4..c2308ce3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-06-01 Tomas Frydrych + + * 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 * clutter/clutter-fixed.h: diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index 31fb2b69d..c35847b20 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -384,6 +384,43 @@ clutter_stage_class_init (ClutterStageClass *klass) g_type_class_add_private (gobject_class, sizeof (ClutterStagePrivate)); } +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) { @@ -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