From 8c3a132ecb3ce805c45dad70c05417713ed9d05d Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Tue, 3 Nov 2009 13:26:58 +0000 Subject: [PATCH] [cogl] deprecate cogl_viewport() in favour of cogl_set_viewport() cogl_viewport only accepted a viewport width and height, but there are times when it's also desireable to have a viewport offset so that a scene can be translated after projection but before hitting the framebuffer. --- README | 6 ++++++ clutter/clutter-texture.c | 2 +- clutter/cogl/cogl/cogl.c | 12 ++++++------ clutter/cogl/cogl/cogl.h.in | 22 +++++++++++++++++++++- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/README b/README index 668296055..464ebe9ee 100644 --- a/README +++ b/README @@ -212,6 +212,12 @@ Release Notes for Clutter 1.2 * Clutter now depends on the system copy of JSON-GLib, and will fall back to the internal copy only if JSON-GLib is not installed. +Cogl API changes for Clutter 1.2 +-------------------------------- + +* cogl_viewport is now deprecated in favour of cogl_set_viewport which + accepts a viewport offset. + Release Notes for Clutter 1.0 ------------------------------- diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c index 4d2996208..aab1435f2 100644 --- a/clutter/clutter-texture.c +++ b/clutter/clutter-texture.c @@ -571,7 +571,7 @@ clutter_texture_paint (ClutterActor *self) clutter_texture_set_fbo_projection (self); /* Reset the viewport to the size of the FBO */ - cogl_viewport (priv->image_width, priv->image_height); + cogl_set_viewport (0, 0, priv->image_width, priv->image_height); /* Reapply the source's parent transformations */ if ((source_parent = clutter_actor_get_parent (priv->fbo_source))) diff --git a/clutter/cogl/cogl/cogl.c b/clutter/cogl/cogl/cogl.c index e2fd88d88..3e1f69c12 100644 --- a/clutter/cogl/cogl/cogl.c +++ b/clutter/cogl/cogl/cogl.c @@ -538,10 +538,10 @@ _cogl_disable_clip_planes (void) } void -_cogl_set_viewport (int x, - int y, - int width, - int height) +cogl_set_viewport (int x, + int y, + int width, + int height) { CoglHandle draw_buffer; @@ -562,7 +562,7 @@ void cogl_viewport (guint width, guint height) { - _cogl_set_viewport (0, 0, width, height); + cogl_set_viewport (0, 0, width, height); } void @@ -579,7 +579,7 @@ _cogl_setup_viewport (guint width, _COGL_GET_CONTEXT (ctx, NO_RETVAL); - cogl_viewport (width, height); + cogl_set_viewport (0, 0, width, height); /* For Ortho projection. * _cogl_matrix_stack_ortho (projection_stack, 0, width, 0, height, -1, 1); diff --git a/clutter/cogl/cogl/cogl.h.in b/clutter/cogl/cogl/cogl.h.in index 9ce95ba35..03ab052d9 100644 --- a/clutter/cogl/cogl/cogl.h.in +++ b/clutter/cogl/cogl/cogl.h.in @@ -219,6 +219,8 @@ void _cogl_setup_viewport (guint width, float z_near, float z_far); +#ifndef COGL_DISABLE_DEPRECATED + /** * cogl_viewport: * @width: Width of the viewport @@ -229,7 +231,25 @@ void _cogl_setup_viewport (guint width, * Since: 0.8.2 */ void cogl_viewport (guint width, - guint height); + guint height) G_GNUC_DEPRECATED; + +#endif + +/** + * cogl_set_viewport: + * @x: viewport X offset + * @x: viewport Y offset + * @width: Width of the viewport + * @height: Height of the viewport + * + * Replace the current viewport with the given values. + * + * Since: 1.2 + */ +void cogl_set_viewport (int x, + int y, + int width, + int height); /** * cogl_push_matrix: