summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2011-03-02 12:45:25 -0500
committerNeil Roberts <neil@linux.intel.com>2011-03-10 13:05:43 +0000
commit0b9aa1fa246bf435b220a785e547646e9c1e4886 (patch)
tree9b6c4e8658ab9566c50d1d37a9e5c80d76f6eda7
parent9cba5b83bde0857d606d9668ea420b702378d6a8 (diff)
downloadclutter-0b9aa1fa246bf435b220a785e547646e9c1e4886.tar.gz
cogl-clip-state: Adapt to experimental cogl2 API.
The current clip state implementation couldn't be used in conjunction with the CoglPath experimental API. http://bugzilla.clutter-project.org/show_bug.cgi?id=2594 Signed-off-by: Neil Roberts <neil@linux.intel.com>
-rw-r--r--clutter/cogl/cogl/Makefile.am9
-rw-r--r--clutter/cogl/cogl/cogl-clip-state-private.h53
-rw-r--r--clutter/cogl/cogl/cogl-clip-state.c20
-rw-r--r--clutter/cogl/cogl/cogl-clip-state.h39
-rw-r--r--clutter/cogl/cogl/cogl-framebuffer-private.h2
-rw-r--r--clutter/cogl/cogl/cogl.h15
-rw-r--r--clutter/cogl/cogl/cogl2-clip-state.c49
-rw-r--r--clutter/cogl/cogl/cogl2-clip-state.h52
8 files changed, 186 insertions, 53 deletions
diff --git a/clutter/cogl/cogl/Makefile.am b/clutter/cogl/cogl/Makefile.am
index e21426d2d..c6a7afa0e 100644
--- a/clutter/cogl/cogl/Makefile.am
+++ b/clutter/cogl/cogl/Makefile.am
@@ -77,11 +77,13 @@ cogl_public_h = \
$(srcdir)/cogl-indices.h \
$(srcdir)/cogl-attribute.h \
$(srcdir)/cogl-primitive.h \
+ $(srcdir)/cogl-clip-state.h \
$(srcdir)/cogl.h \
$(NULL)
cogl_experimental_h = \
$(srcdir)/cogl2-path.h \
+ $(srcdir)/cogl2-clip-state.h \
$(NULL)
# driver sources
@@ -182,8 +184,11 @@ cogl_sources_c = \
$(srcdir)/cogl-bitmap-pixbuf.c \
$(srcdir)/cogl-clip-stack.h \
$(srcdir)/cogl-clip-stack.c \
- $(srcdir)/cogl-clip-state.h \
- $(srcdir)/cogl-clip-state.c \
+ $(srcdir)/cogl-clip-state-private.h \
+ $(srcdir)/cogl-clip-state.h \
+ $(srcdir)/cogl-clip-state.c \
+ $(srcdir)/cogl2-clip-state.h \
+ $(srcdir)/cogl2-clip-state.c \
$(srcdir)/cogl-feature-private.h \
$(srcdir)/cogl-feature-private.c \
$(srcdir)/cogl-fixed.c \
diff --git a/clutter/cogl/cogl/cogl-clip-state-private.h b/clutter/cogl/cogl/cogl-clip-state-private.h
new file mode 100644
index 000000000..f77a1669d
--- /dev/null
+++ b/clutter/cogl/cogl/cogl-clip-state-private.h
@@ -0,0 +1,53 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2007,2008,2009,2010 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+#ifndef __COGL_CLIP_STATE_PRIVATE_H
+#define __COGL_CLIP_STATE_PRIVATE_H
+
+#include "cogl-clip-stack.h"
+
+typedef struct _CoglClipState CoglClipState;
+
+struct _CoglClipState
+{
+ /* Stack of CoglClipStacks */
+ GSList *stacks;
+};
+
+void
+_cogl_clip_state_init (CoglClipState *state);
+
+void
+_cogl_clip_state_destroy (CoglClipState *state);
+
+void
+_cogl_clip_state_flush (CoglClipState *clip_state);
+
+CoglClipStack *
+_cogl_clip_state_get_stack (CoglClipState *clip_state);
+
+void
+_cogl_clip_state_set_stack (CoglClipState *clip_state,
+ CoglClipStack *clip_stack);
+
+#endif /* __COGL_CLIP_STATE_PRIVATE_H */
diff --git a/clutter/cogl/cogl/cogl-clip-state.c b/clutter/cogl/cogl/cogl-clip-state.c
index a4a3b1ab2..475e4e3be 100644
--- a/clutter/cogl/cogl/cogl-clip-state.c
+++ b/clutter/cogl/cogl/cogl-clip-state.c
@@ -32,7 +32,7 @@
#include "cogl.h"
#include "cogl-clip-stack.h"
-#include "cogl-clip-state.h"
+#include "cogl-clip-state-private.h"
#include "cogl-context.h"
#include "cogl-internal.h"
#include "cogl-framebuffer-private.h"
@@ -109,29 +109,17 @@ cogl_clip_push (float x_offset,
void
cogl_clip_push_from_path_preserve (void)
{
- CoglFramebuffer *framebuffer;
- CoglClipState *clip_state;
- CoglMatrix modelview_matrix;
-
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
-
- framebuffer = _cogl_get_draw_buffer ();
- clip_state = _cogl_framebuffer_get_clip_state (framebuffer);
-
- cogl_get_modelview_matrix (&modelview_matrix);
-
- clip_state->stacks->data =
- _cogl_clip_stack_push_from_path (clip_state->stacks->data,
- ctx->current_path,
- &modelview_matrix);
+ cogl2_clip_push_from_path (ctx->current_path);
}
+#undef cogl_clip_push_from_path
void
cogl_clip_push_from_path (void)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
- cogl_clip_push_from_path_preserve ();
+ cogl2_clip_push_from_path (ctx->current_path);
cogl_object_unref (ctx->current_path);
ctx->current_path = cogl2_path_new ();
diff --git a/clutter/cogl/cogl/cogl-clip-state.h b/clutter/cogl/cogl/cogl-clip-state.h
index 23582735c..b51943f49 100644
--- a/clutter/cogl/cogl/cogl-clip-state.h
+++ b/clutter/cogl/cogl/cogl-clip-state.h
@@ -21,33 +21,30 @@
*
*/
+#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
+#error "Only <cogl/cogl.h> can be included directly."
+#endif
+
#ifndef __COGL_CLIP_STATE_H
#define __COGL_CLIP_STATE_H
-#include "cogl-clip-stack.h"
-
-typedef struct _CoglClipState CoglClipState;
-
-struct _CoglClipState
-{
- /* Stack of CoglClipStacks */
- GSList *stacks;
-};
+#include <cogl/cogl-types.h>
-void
-_cogl_clip_state_init (CoglClipState *state);
-
-void
-_cogl_clip_state_destroy (CoglClipState *state);
+G_BEGIN_DECLS
+/**
+ * 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_pop().
+ *
+ * Since: 1.0
+ */
void
-_cogl_clip_state_flush (CoglClipState *clip_state);
+cogl_clip_push_from_path (void);
-CoglClipStack *
-_cogl_clip_state_get_stack (CoglClipState *clip_state);
-
-void
-_cogl_clip_state_set_stack (CoglClipState *clip_state,
- CoglClipStack *clip_stack);
+G_END_DECLS
#endif /* __COGL_CLIP_STATE_H */
diff --git a/clutter/cogl/cogl/cogl-framebuffer-private.h b/clutter/cogl/cogl/cogl-framebuffer-private.h
index 44fc84f37..14a4d049e 100644
--- a/clutter/cogl/cogl/cogl-framebuffer-private.h
+++ b/clutter/cogl/cogl/cogl-framebuffer-private.h
@@ -26,7 +26,7 @@
#include "cogl-handle.h"
#include "cogl-matrix-stack.h"
-#include "cogl-clip-state.h"
+#include "cogl-clip-state-private.h"
#include "cogl-journal-private.h"
typedef enum _CoglFramebufferType {
diff --git a/clutter/cogl/cogl/cogl.h b/clutter/cogl/cogl/cogl.h
index f3a354361..a7f9ea722 100644
--- a/clutter/cogl/cogl/cogl.h
+++ b/clutter/cogl/cogl/cogl.h
@@ -53,8 +53,10 @@
#include <cogl/cogl-primitives.h>
#ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API
#include <cogl/cogl2-path.h>
+#include <cogl/cogl2-clip-state.h>
#else
#include <cogl/cogl-path.h>
+#include <cogl/cogl-clip-state.h>
#endif
#include <cogl/cogl-shader.h>
#include <cogl/cogl-texture.h>
@@ -858,19 +860,6 @@ cogl_clip_push_rectangle (float x0,
float y1);
/**
- * 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_pop().
- *
- * Since: 1.0
- */
-void
-cogl_clip_push_from_path (void);
-
-/**
* cogl_clip_push_from_path_preserve:
*
* Sets a new clipping area using the current path. The current path
diff --git a/clutter/cogl/cogl/cogl2-clip-state.c b/clutter/cogl/cogl/cogl2-clip-state.c
new file mode 100644
index 000000000..9b56ab98b
--- /dev/null
+++ b/clutter/cogl/cogl/cogl2-clip-state.c
@@ -0,0 +1,49 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2007,2008,2009,2010 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cogl.h"
+#include "cogl-clip-state-private.h"
+#include "cogl-framebuffer-private.h"
+#include "cogl-journal-private.h"
+
+void
+cogl2_clip_push_from_path (CoglPath *path)
+{
+ CoglFramebuffer *framebuffer;
+ CoglClipState *clip_state;
+ CoglMatrix modelview_matrix;
+
+ framebuffer = _cogl_get_draw_buffer ();
+ clip_state = _cogl_framebuffer_get_clip_state (framebuffer);
+
+ cogl_get_modelview_matrix (&modelview_matrix);
+
+ clip_state->stacks->data =
+ _cogl_clip_stack_push_from_path (clip_state->stacks->data,
+ path,
+ &modelview_matrix);
+}
diff --git a/clutter/cogl/cogl/cogl2-clip-state.h b/clutter/cogl/cogl/cogl2-clip-state.h
new file mode 100644
index 000000000..9239bb10f
--- /dev/null
+++ b/clutter/cogl/cogl/cogl2-clip-state.h
@@ -0,0 +1,52 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2007,2008,2009,2010 Intel Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ *
+ */
+
+#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
+#error "Only <cogl/cogl.h> can be included directly."
+#endif
+
+#ifndef __COGL2_CLIP_STATE_H
+#define __COGL2_CLIP_STATE_H
+
+#include <cogl/cogl-types.h>
+
+G_BEGIN_DECLS
+
+#define cogl_clip_push_from_path cogl2_clip_push_from_path
+/**
+ * cogl_clip_push_from_path:
+ * @path: The path to clip with.
+ *
+ * Sets a new clipping area using @path. The clipping area is intersected
+ * with the previous clipping area. To restore the previous clipping area,
+ * call cogl_clip_pop().
+ *
+ * Since: 1.8
+ * Stability: Unstable
+ */
+void
+cogl_clip_push_from_path (CoglPath *path);
+
+G_END_DECLS
+
+#endif /* __COGL2_CLIP_STATE_H */