[cogl] Make cogl_setup_viewport() a private function

The setup_viewport() function should only be used by Clutter and
not by application code.

It can be emulated by changing the Stage size and perspective and
requeueing a redraw after calling clutter_stage_ensure_viewport().
This commit is contained in:
Emmanuele Bassi 2009-05-28 13:03:19 +01:00
parent 32018584c0
commit 7252c14197
4 changed files with 27 additions and 23 deletions

View File

@ -160,13 +160,15 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage)
clutter_actor_get_size (CLUTTER_ACTOR (stage), &width, &height);
clutter_stage_get_perspective (stage, &perspective);
CLUTTER_NOTE (PAINT, "Setting up the viewport");
CLUTTER_NOTE (PAINT,
"Setting up the viewport { w:%.2f, h:%.2f }",
width, height);
cogl_setup_viewport (width, height,
perspective.fovy,
perspective.aspect,
perspective.z_near,
perspective.z_far);
_cogl_setup_viewport (width, height,
perspective.fovy,
perspective.aspect,
perspective.z_near,
perspective.z_far);
CLUTTER_UNSET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES);
}

View File

@ -556,11 +556,11 @@ clutter_texture_paint (ClutterActor *self)
/* Use below to set the modelview matrix as if the viewport
was still the same size as the stage */
cogl_setup_viewport (stage_width, stage_height,
perspective.fovy,
perspective.aspect,
perspective.z_near,
perspective.z_far);
_cogl_setup_viewport (stage_width, stage_height,
perspective.fovy,
perspective.aspect,
perspective.z_near,
perspective.z_far);
/* Use a projection matrix that makes the actor appear as it
would if it was rendered at its normal screen location */

View File

@ -193,8 +193,8 @@ void cogl_ortho (float left,
float near,
float far);
/**
* cogl_setup_viewport:
/*
* _cogl_setup_viewport:
* @width: Width of the viewport
* @height: Height of the viewport
* @fovy: Field of view angle in degrees
@ -208,9 +208,11 @@ void cogl_ortho (float left,
* with one that has a viewing angle of @fovy along the y-axis and a
* view scaled according to @aspect along the x-axis. The view is
* clipped according to @z_near and @z_far on the z-axis.
*
* This function is used only by Clutter.
*/
void cogl_setup_viewport (guint width,
guint height,
void _cogl_setup_viewport (guint width,
guint height,
float fovy,
float aspect,
float z_near,

View File

@ -475,12 +475,12 @@ cogl_viewport (guint width,
}
void
cogl_setup_viewport (guint width,
guint height,
float fovy,
float aspect,
float z_near,
float z_far)
_cogl_setup_viewport (guint width,
guint height,
float fovy,
float aspect,
float z_near,
float z_far)
{
float z_camera;
CoglMatrix projection_matrix;
@ -488,7 +488,7 @@ cogl_setup_viewport (guint width,
GE( glViewport (0, 0, width, height) );
/* For Ortho projection.
* _cogl_current_matrix_ortho (0, width << 16, 0, height << 16, -1 << 16, 1 << 16);
* _cogl_current_matrix_ortho (0, width, 0, height, -1, 1);
*/
cogl_perspective (fovy, aspect, z_near, z_far);
@ -542,7 +542,7 @@ cogl_setup_viewport (guint width,
}
CoglFeatureFlags
cogl_get_features ()
cogl_get_features (void)
{
_COGL_GET_CONTEXT (ctx, 0);