mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
cogl-matrix-stack: Convert to be a CoglObject
We will want to use ref-counting on the CoglMatrixStack so it might as well be a CoglObject.
This commit is contained in:
parent
d678125dd4
commit
c11f72fd6d
@ -166,10 +166,10 @@ _cogl_framebuffer_free (CoglFramebuffer *framebuffer)
|
|||||||
{
|
{
|
||||||
_cogl_clip_state_destroy (&framebuffer->clip_state);
|
_cogl_clip_state_destroy (&framebuffer->clip_state);
|
||||||
|
|
||||||
_cogl_matrix_stack_destroy (framebuffer->modelview_stack);
|
cogl_object_unref (framebuffer->modelview_stack);
|
||||||
framebuffer->modelview_stack = NULL;
|
framebuffer->modelview_stack = NULL;
|
||||||
|
|
||||||
_cogl_matrix_stack_destroy (framebuffer->projection_stack);
|
cogl_object_unref (framebuffer->projection_stack);
|
||||||
framebuffer->projection_stack = NULL;
|
framebuffer->projection_stack = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "cogl-internal.h"
|
#include "cogl-internal.h"
|
||||||
#include "cogl-matrix-stack.h"
|
#include "cogl-matrix-stack.h"
|
||||||
#include "cogl-framebuffer-private.h"
|
#include "cogl-framebuffer-private.h"
|
||||||
|
#include "cogl-object-private.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CoglMatrix matrix;
|
CoglMatrix matrix;
|
||||||
@ -53,6 +54,8 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
struct _CoglMatrixStack
|
struct _CoglMatrixStack
|
||||||
{
|
{
|
||||||
|
CoglObject _parent;
|
||||||
|
|
||||||
GArray *stack;
|
GArray *stack;
|
||||||
|
|
||||||
/* which state does GL have, NULL if unknown */
|
/* which state does GL have, NULL if unknown */
|
||||||
@ -62,6 +65,10 @@ struct _CoglMatrixStack
|
|||||||
unsigned int age;
|
unsigned int age;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void _cogl_matrix_stack_free (CoglMatrixStack *stack);
|
||||||
|
|
||||||
|
COGL_OBJECT_INTERNAL_DEFINE (MatrixStack, matrix_stack);
|
||||||
|
|
||||||
/* XXX: this doesn't initialize the matrix! */
|
/* XXX: this doesn't initialize the matrix! */
|
||||||
static void
|
static void
|
||||||
_cogl_matrix_state_init (CoglMatrixState *state)
|
_cogl_matrix_state_init (CoglMatrixState *state)
|
||||||
@ -142,11 +149,11 @@ _cogl_matrix_stack_new (void)
|
|||||||
|
|
||||||
stack->age = 0;
|
stack->age = 0;
|
||||||
|
|
||||||
return stack;
|
return _cogl_matrix_stack_object_new (stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
_cogl_matrix_stack_destroy (CoglMatrixStack *stack)
|
_cogl_matrix_stack_free (CoglMatrixStack *stack)
|
||||||
{
|
{
|
||||||
g_array_free (stack->stack, TRUE);
|
g_array_free (stack->stack, TRUE);
|
||||||
g_slice_free (CoglMatrixStack, stack);
|
g_slice_free (CoglMatrixStack, stack);
|
||||||
|
@ -42,9 +42,6 @@ typedef enum {
|
|||||||
CoglMatrixStack *
|
CoglMatrixStack *
|
||||||
_cogl_matrix_stack_new (void);
|
_cogl_matrix_stack_new (void);
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_matrix_stack_destroy (CoglMatrixStack *stack);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_matrix_stack_push (CoglMatrixStack *stack);
|
_cogl_matrix_stack_push (CoglMatrixStack *stack);
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ texture_unit_free (CoglTextureUnit *unit)
|
|||||||
{
|
{
|
||||||
if (unit->layer)
|
if (unit->layer)
|
||||||
cogl_object_unref (unit->layer);
|
cogl_object_unref (unit->layer);
|
||||||
_cogl_matrix_stack_destroy (unit->matrix_stack);
|
cogl_object_unref (unit->matrix_stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglTextureUnit *
|
CoglTextureUnit *
|
||||||
|
Loading…
Reference in New Issue
Block a user