From 7252c141970eaa7c17214e9890b917221be70fd0 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 28 May 2009 13:03:19 +0100 Subject: [PATCH] [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(). --- clutter/clutter-main.c | 14 ++++++++------ clutter/clutter-texture.c | 10 +++++----- clutter/cogl/cogl.h.in | 10 ++++++---- clutter/cogl/common/cogl.c | 16 ++++++++-------- 4 files changed, 27 insertions(+), 23 deletions(-) diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index b5f5c3785..a4a690b46 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -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); } diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c index 2321f6304..3bb1e6448 100644 --- a/clutter/clutter-texture.c +++ b/clutter/clutter-texture.c @@ -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 */ diff --git a/clutter/cogl/cogl.h.in b/clutter/cogl/cogl.h.in index 188af09cd..a671aa00d 100644 --- a/clutter/cogl/cogl.h.in +++ b/clutter/cogl/cogl.h.in @@ -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, diff --git a/clutter/cogl/common/cogl.c b/clutter/cogl/common/cogl.c index adeb479d2..336303917 100644 --- a/clutter/cogl/common/cogl.c +++ b/clutter/cogl/common/cogl.c @@ -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);