From 2b5a72dde5d6e33bed7935755a10905bcc2b0c23 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Thu, 12 Feb 2009 11:08:00 +0000 Subject: [PATCH] [Cogl] cogl_clip_{set*,unset} renamed to cogl_clip_{push*,pop} This is so they self document the stacking semantics of the cogl clip API --- README | 3 +++ clutter/clutter-actor.c | 10 +++++----- clutter/clutter-text.c | 8 ++++---- clutter/cogl/cogl.h.in | 28 +++++++++++++-------------- clutter/cogl/common/cogl-clip-stack.c | 22 ++++++++++----------- doc/reference/cogl/cogl-sections.txt | 8 ++++---- tests/interactive/test-clip.c | 12 ++++++------ 7 files changed, 47 insertions(+), 44 deletions(-) diff --git a/README b/README index 52060f618..7dc89aced 100644 --- a/README +++ b/README @@ -276,6 +276,9 @@ Release Notes for Clutter 1.0 * cogl_scale now supports scaling on the z axis +* cogl_clip_set* and cogl_clip_unset have been renamed to cogl_clip_push and + cogl_clip_pop respectively so they self document their stacking semantics. + Release Notes for Clutter 0.8 ------------------------------- diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 7ac527d5b..674b4e936 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -1548,10 +1548,10 @@ clutter_actor_paint (ClutterActor *self) if (priv->has_clip) { - cogl_clip_set (CLUTTER_UNITS_TO_FIXED (priv->clip[0]), - CLUTTER_UNITS_TO_FIXED (priv->clip[1]), - CLUTTER_UNITS_TO_FIXED (priv->clip[2]), - CLUTTER_UNITS_TO_FIXED (priv->clip[3])); + cogl_clip_push (CLUTTER_UNITS_TO_FIXED (priv->clip[0]), + CLUTTER_UNITS_TO_FIXED (priv->clip[1]), + CLUTTER_UNITS_TO_FIXED (priv->clip[2]), + CLUTTER_UNITS_TO_FIXED (priv->clip[3])); clip_set = TRUE; } @@ -1578,7 +1578,7 @@ clutter_actor_paint (ClutterActor *self) } if (clip_set) - cogl_clip_unset(); + cogl_clip_pop(); cogl_pop_matrix(); diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index e35151eaa..1ff3f6a96 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -1066,9 +1066,9 @@ clutter_text_paint (ClutterActor *self) pango_layout_get_extents (layout, NULL, &logical_rect); - cogl_clip_set (0, 0, - CLUTTER_UNITS_TO_FIXED (alloc.x2 - alloc.x1), - CLUTTER_UNITS_TO_FIXED (alloc.y2 - alloc.y1)); + cogl_clip_push (0, 0, + CLUTTER_UNITS_TO_FIXED (alloc.x2 - alloc.x1), + CLUTTER_UNITS_TO_FIXED (alloc.y2 - alloc.y1)); clip_set = TRUE; actor_width = (CLUTTER_UNITS_TO_DEVICE (alloc.x2 - alloc.x1)) @@ -1126,7 +1126,7 @@ clutter_text_paint (ClutterActor *self) cogl_pango_render_layout (layout, text_x, 0, &color, 0); if (clip_set) - cogl_clip_unset (); + cogl_clip_pop (); priv->text_x = text_x; } diff --git a/clutter/cogl/cogl.h.in b/clutter/cogl/cogl.h.in index 680be2691..8386a435c 100644 --- a/clutter/cogl/cogl.h.in +++ b/clutter/cogl/cogl.h.in @@ -296,7 +296,7 @@ void cogl_get_projection_matrix (float m[16]); void cogl_get_viewport (float v[4]); /** - * cogl_clip_set: + * cogl_clip_push: * @x_offset: left edge of the clip rectangle * @y_offset: top edge of the clip rectangle * @width: width of the clip rectangle @@ -309,44 +309,44 @@ void cogl_get_viewport (float v[4]); * current model-view matrix. * * The rectangle is intersected with the current clip region. To undo - * the effect of this function, call cogl_clip_unset(). + * the effect of this function, call cogl_clip_pop(). */ -void cogl_clip_set (float x_offset, +void cogl_clip_push (float x_offset, float y_offset, float width, float height); /** - * cogl_clip_set_from_path: + * cogl_clip_push_from_path: * * Sets a new clipping area using the current path. The current path * is then cleared. The clipping area is intersected with the previous * clipping area. To restore the previous clipping area, call - * cogl_clip_unset(). + * cogl_clip_pop(). * * Since: 1.0 */ -void cogl_clip_set_from_path (void); +void cogl_clip_push_from_path (void); /** - * cogl_clip_set_from_path_preserve: + * cogl_clip_push_from_path_preserve: * * Sets a new clipping area using the current path. The current path * is then cleared. The clipping area is intersected with the previous * clipping area. To restore the previous clipping area, call - * cogl_clip_unset(). + * cogl_clip_pop(). * * Since: 1.0 */ -void cogl_clip_set_from_path_preserve (void); +void cogl_clip_push_from_path_preserve (void); /** - * cogl_clip_unset: + * cogl_clip_pop: * * Reverts the clipping region to the state before the last call to - * cogl_clip_set(). + * cogl_clip_push(). */ -void cogl_clip_unset (void); +void cogl_clip_pop (void); /** * cogl_clip_ensure: @@ -365,8 +365,8 @@ void cogl_clip_ensure (void); * * Save the entire state of the clipping stack and then clear all * clipping. The previous state can be returned to with - * cogl_clip_stack_restore(). Each call to cogl_clip_set() after this - * must be matched by a call to cogl_clip_unset() before calling + * cogl_clip_stack_restore(). Each call to cogl_clip_push() after this + * must be matched by a call to cogl_clip_pop() before calling * cogl_clip_stack_restore(). * * Since: 0.8.2 diff --git a/clutter/cogl/common/cogl-clip-stack.c b/clutter/cogl/common/cogl-clip-stack.c index 9d8a623e9..23309202c 100644 --- a/clutter/cogl/common/cogl-clip-stack.c +++ b/clutter/cogl/common/cogl-clip-stack.c @@ -99,10 +99,10 @@ struct _CoglClipStackEntryPath }; void -cogl_clip_set (float x_offset, - float y_offset, - float width, - float height) +cogl_clip_push (float x_offset, + float y_offset, + float width, + float height) { CoglClipStackEntryRect *entry; CoglClipStack *stack; @@ -129,7 +129,7 @@ cogl_clip_set (float x_offset, } void -cogl_clip_set_from_path_preserve (void) +cogl_clip_push_from_path_preserve (void) { CoglClipStackEntryPath *entry; CoglClipStack *stack; @@ -157,15 +157,15 @@ cogl_clip_set_from_path_preserve (void) } void -cogl_clip_set_from_path (void) +cogl_clip_push_from_path (void) { - cogl_clip_set_from_path_preserve (); + cogl_clip_push_from_path_preserve (); cogl_path_new (); } void -cogl_clip_unset (void) +cogl_clip_pop (void) { gpointer entry; CoglClipStack *stack; @@ -208,7 +208,7 @@ _cogl_clip_stack_rebuild (void) _cogl_disable_clip_planes (); _cogl_disable_stencil_buffer (); - + /* If the stack is empty then there's nothing else to do */ if (stack->stack_top == NULL) return; @@ -319,7 +319,7 @@ cogl_clip_stack_restore (void) /* Empty the current stack */ while (stack->stack_top) - cogl_clip_unset (); + cogl_clip_pop (); /* Revert to an old stack */ g_slice_free (CoglClipStack, stack); @@ -336,7 +336,7 @@ _cogl_clip_stack_state_init (void) ctx->clip.stacks = NULL; ctx->clip.stack_dirty = TRUE; - + /* Add an intial stack */ cogl_clip_stack_save (); } diff --git a/doc/reference/cogl/cogl-sections.txt b/doc/reference/cogl/cogl-sections.txt index 582e4034e..1a8cd8c6f 100644 --- a/doc/reference/cogl/cogl-sections.txt +++ b/doc/reference/cogl/cogl-sections.txt @@ -42,10 +42,10 @@ cogl_get_bitmasks cogl_paint_init CoglClipStackState -cogl_clip_set -cogl_clip_set_from_path -cogl_clip_set_from_path_preserve -cogl_clip_unset +cogl_clip_push +cogl_clip_push_from_path +cogl_clip_push_from_path_preserve +cogl_clip_pop cogl_clip_stack_save cogl_clip_stack_restore cogl_clip_ensure diff --git a/tests/interactive/test-clip.c b/tests/interactive/test-clip.c index ed3f8d7b0..6f9001448 100644 --- a/tests/interactive/test-clip.c +++ b/tests/interactive/test-clip.c @@ -136,14 +136,14 @@ on_paint (ClutterActor *actor, CallbackData *data) Clip *clip = (Clip *) node->data; if (clip->type == CLIP_RECTANGLE) - cogl_clip_set (CLUTTER_INT_TO_FIXED (clip->x1), - CLUTTER_INT_TO_FIXED (clip->y1), - CLUTTER_INT_TO_FIXED (clip->x2 - clip->x1), - CLUTTER_INT_TO_FIXED (clip->y2 - clip->y1)); + cogl_clip_push (CLUTTER_INT_TO_FIXED (clip->x1), + CLUTTER_INT_TO_FIXED (clip->y1), + CLUTTER_INT_TO_FIXED (clip->x2 - clip->x1), + CLUTTER_INT_TO_FIXED (clip->y2 - clip->y1)); else { make_clip_path (clip); - cogl_clip_set_from_path (); + cogl_clip_push_from_path (); } } @@ -178,7 +178,7 @@ on_paint (ClutterActor *actor, CallbackData *data) draw_shapes (stage_size.width - 310, stage_size.height - 110); /* Remove all of the clipping */ - g_slist_foreach (data->clips, (GFunc) cogl_clip_unset, NULL); + g_slist_foreach (data->clips, (GFunc) cogl_clip_pop, NULL); /* Draw the bounding box for each of the clips */ for (node = data->clips; node; node = node->next)