[Cogl] [PATCH] matrix-stack: make CoglMatrixStack public
Neil Roberts
neil at linux.intel.com
Thu Nov 29 07:19:50 PST 2012
Robert Bragg <robert at sixbynine.org> writes:
> static void
> _cogl_matrix_stack_free (CoglMatrixStack *stack)
> {
> - _cogl_matrix_entry_unref (stack->last_entry);
> + cogl_matrix_entry_unref (stack->last_entry);
> + cogl_matrix_entry_ref (&stack->context->identity_entry);
Shouldn't that be an unref?
> +CoglMatrixEntry *
> +cogl_matrix_stack_get_entry (CoglMatrixStack *stack)
> +{
> + return cogl_matrix_entry_ref (stack->last_entry);
> +}
I think it would be better if this didn't take a reference. There is no
precedent for a getter that takes a reference, is there? It seems like
if it needs to take a ref it should have a different name.
> CoglBool
> -_cogl_matrix_entry_has_identity_flag (CoglMatrixEntry *entry)
> +cogl_matrix_entry_is_identity (CoglMatrixEntry *entry)
We've discussed this before, but ‘is_identity’ doesn't seem like a good
name because that's not really what it does if it can have false
negatives. But well, I guess it's just bike-shedding and I can't think
of a better name so that's fine by me.
I also have some minor corrections to the docs which I'll just attach as
a diff:
diff --git a/cogl/cogl-matrix-stack.h b/cogl/cogl-matrix-stack.h
index 5d1848a..0923b81 100644
--- a/cogl/cogl-matrix-stack.h
+++ b/cogl/cogl-matrix-stack.h
@@ -358,7 +358,7 @@ cogl_matrix_stack_frustum (CoglMatrixStack *stack,
* Replaces the current matrix with a perspective matrix based on the
* provided values.
*
- * <note>You should be careful not to have to great a @z_far / @z_near
+ * <note>You should be careful not to have too great a @z_far / @z_near
* ratio since that will reduce the effectiveness of depth testing
* since there wont be enough precision to identify the depth of
* objects near to each other.</note>
@@ -528,7 +528,7 @@ cogl_is_matrix_stack (void *object);
* @z: (out): The destination for the z-component of the translation
*
* Determines if the only difference between two transforms is a
- * translation and if so returns what the @x, @y, and z@ components of
+ * translation and if so returns what the @x, @y, and @z components of
* the translation are.
*
* If the difference between the two translations involves anything
@@ -571,7 +571,7 @@ cogl_matrix_entry_is_identity (CoglMatrixEntry *entry);
* returning %TRUE if they are equal or %FALSE otherwise.
*
* <note>In many cases it is unnecessary to use this api and instead
- * direct pointer comparisons of entries is good enough and much
+ * direct pointer comparisons of entries are good enough and much
* cheaper too.</note>
*
* Return value: %TRUE if @entry0 represents the same transform as
Regards,
- Neil
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
More information about the Cogl
mailing list