[clutter/wip/cogl-winsys-egl: 12/37] Add temporary cogl-clutter.h to aid splitting out Cogl
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/cogl-winsys-egl: 12/37] Add temporary cogl-clutter.h to aid splitting out Cogl
- Date: Mon, 4 Apr 2011 12:07:36 +0000 (UTC)
commit a252df4711d839d166bfcc8f041351868b2c6f60
Author: Robert Bragg <robert linux intel com>
Date: Tue Feb 22 18:25:29 2011 +0000
Add temporary cogl-clutter.h to aid splitting out Cogl
This gives us a way to clearly track the internal Cogl API that Clutter
depends on. The aim is to split Cogl out from Clutter into a standalone
3D graphics API and eventually we want to get rid of any private
interfaces for Clutter so its useful to have a handle on that task.
Actually it's not as bad as I was expecting though.
clutter/clutter-backend.c | 2 +-
clutter/clutter-stage.c | 2 +-
clutter/cogl/cogl/Makefile.am | 6 ++-
clutter/cogl/cogl/cogl-clutter.c | 59 ++++++++++++++++++++++++++
clutter/cogl/cogl/cogl-clutter.h | 47 ++++++++++++++++++++
clutter/cogl/cogl/cogl-framebuffer-private.h | 4 ++
clutter/cogl/cogl/cogl-framebuffer.c | 9 +---
clutter/cogl/cogl/cogl-private.h | 3 +
clutter/cogl/cogl/cogl.h | 3 -
clutter/egl/clutter-backend-egl.c | 4 +-
clutter/wayland/clutter-backend-wayland.c | 8 ++--
clutter/win32/clutter-backend-win32.c | 2 +-
clutter/x11/clutter-stage-x11.c | 2 +-
13 files changed, 130 insertions(+), 21 deletions(-)
---
diff --git a/clutter/clutter-backend.c b/clutter/clutter-backend.c
index e0a79bb..93328be 100644
--- a/clutter/clutter-backend.c
+++ b/clutter/clutter-backend.c
@@ -465,7 +465,7 @@ _clutter_backend_ensure_context (ClutterBackend *backend,
clutter_actor_get_size (CLUTTER_ACTOR (stage), &width, &height);
- _cogl_onscreen_clutter_backend_set_size (width, height);
+ cogl_onscreen_clutter_backend_set_size (width, height);
/* Eventually we will have a separate CoglFramebuffer for
* each stage and each one will track private projection
diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c
index 54717a0..723b3a7 100644
--- a/clutter/clutter-stage.c
+++ b/clutter/clutter-stage.c
@@ -373,7 +373,7 @@ clutter_stage_allocate (ClutterActor *self,
* window has a chance to update the window size based on the
* allocation. */
_clutter_stage_window_get_geometry (priv->impl, &geom);
- _cogl_onscreen_clutter_backend_set_size (geom.width, geom.height);
+ cogl_onscreen_clutter_backend_set_size (geom.width, geom.height);
clutter_actor_get_allocation_geometry (self, &geom);
if (geom.width != prev_geom.width || geom.height != prev_geom.height)
diff --git a/clutter/cogl/cogl/Makefile.am b/clutter/cogl/cogl/Makefile.am
index 9f6a837..a4d67cf 100644
--- a/clutter/cogl/cogl/Makefile.am
+++ b/clutter/cogl/cogl/Makefile.am
@@ -78,6 +78,7 @@ cogl_public_h = \
$(srcdir)/cogl-attribute.h \
$(srcdir)/cogl-primitive.h \
$(srcdir)/cogl-clip-state.h \
+ $(srcdir)/cogl-clutter.h \
$(srcdir)/cogl.h \
$(NULL)
@@ -271,8 +272,9 @@ cogl_sources_c = \
$(srcdir)/cogl-shader-private.h \
$(srcdir)/cogl-shader.c \
$(srcdir)/cogl-gtype-private.h \
- $(srcdir)/cogl-point-in-poly-private.h \
- $(srcdir)/cogl-point-in-poly.c \
+ $(srcdir)/cogl-point-in-poly-private.h \
+ $(srcdir)/cogl-point-in-poly.c \
+ $(srcdir)/cogl-clutter.c \
$(NULL)
if SUPPORT_XLIB
diff --git a/clutter/cogl/cogl/cogl-clutter.c b/clutter/cogl/cogl/cogl-clutter.c
new file mode 100644
index 0000000..07f827a
--- /dev/null
+++ b/clutter/cogl/cogl/cogl-clutter.c
@@ -0,0 +1,59 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Robert Bragg <robert linux intel com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <glib.h>
+
+#include "cogl.h"
+#include "cogl-types.h"
+#include "cogl-private.h"
+#include "cogl-context-private.h"
+#include "cogl-winsys-private.h"
+#include "cogl-framebuffer-private.h"
+
+gboolean
+cogl_clutter_check_extension (const char *name, const char *ext)
+{
+ return _cogl_check_extension (name, ext);
+}
+
+void
+cogl_onscreen_clutter_backend_set_size (int width, int height)
+{
+ CoglFramebuffer *framebuffer;
+
+ _COGL_GET_CONTEXT (ctx, NO_RETVAL);
+
+ if (!ctx->stub_winsys)
+ return;
+
+ framebuffer = COGL_FRAMEBUFFER (ctx->window_buffer);
+
+ _cogl_framebuffer_winsys_update_size (framebuffer, width, height);
+}
diff --git a/clutter/cogl/cogl/cogl-clutter.h b/clutter/cogl/cogl/cogl-clutter.h
new file mode 100644
index 0000000..023d14f
--- /dev/null
+++ b/clutter/cogl/cogl/cogl-clutter.h
@@ -0,0 +1,47 @@
+/*
+ * Cogl
+ *
+ * An object oriented GL/GLES Abstraction/Utility Layer
+ *
+ * Copyright (C) 2011 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
+#error "Only <cogl/cogl.h> can be included directly."
+#endif
+
+#ifndef __COGL_CLUTTER_H__
+#define __COGL_CLUTTER_H__
+
+#ifdef COGL_HAS_XLIB
+#include <X11/Xutil.h>
+#endif
+
+G_BEGIN_DECLS
+
+#define cogl_clutter_check_extension cogl_clutter_check_extension_CLUTTER
+gboolean
+cogl_clutter_check_extension (const char *name, const char *ext);
+
+#define cogl_onscreen_clutter_backend_set_size cogl_onscreen_clutter_backend_set_size_CLUTTER
+void
+cogl_onscreen_clutter_backend_set_size (int width, int height);
+
+G_END_DECLS
+
+#endif /* __COGL_CLUTTER_H__ */
diff --git a/clutter/cogl/cogl/cogl-framebuffer-private.h b/clutter/cogl/cogl/cogl-framebuffer-private.h
index fc95664..afc8fe1 100644
--- a/clutter/cogl/cogl/cogl-framebuffer-private.h
+++ b/clutter/cogl/cogl/cogl-framebuffer-private.h
@@ -114,6 +114,10 @@ void
_cogl_framebuffer_state_init (void);
void
+_cogl_framebuffer_winsys_update_size (CoglFramebuffer *framebuffer,
+ int width, int height);
+
+void
_cogl_clear4f (unsigned long buffers,
float red,
float green,
diff --git a/clutter/cogl/cogl/cogl-framebuffer.c b/clutter/cogl/cogl/cogl-framebuffer.c
index b357609..62cbc15 100644
--- a/clutter/cogl/cogl/cogl-framebuffer.c
+++ b/clutter/cogl/cogl/cogl-framebuffer.c
@@ -984,13 +984,10 @@ _cogl_onscreen_free (CoglOnscreen *onscreen)
}
void
-_cogl_onscreen_clutter_backend_set_size (int width, int height)
+_cogl_framebuffer_winsys_update_size (CoglFramebuffer *framebuffer,
+ int width, int height)
{
- CoglFramebuffer *framebuffer;
-
- _COGL_GET_CONTEXT (ctx, NO_RETVAL);
-
- framebuffer = COGL_FRAMEBUFFER (ctx->window_buffer);
+ CoglContext *ctx = framebuffer->context;
if (framebuffer->width == width && framebuffer->height == height)
return;
diff --git a/clutter/cogl/cogl/cogl-private.h b/clutter/cogl/cogl/cogl-private.h
index afcfe46..4407b42 100644
--- a/clutter/cogl/cogl/cogl-private.h
+++ b/clutter/cogl/cogl/cogl-private.h
@@ -26,6 +26,9 @@
G_BEGIN_DECLS
+gboolean
+_cogl_check_extension (const char *name, const char *ext);
+
void
_cogl_clear (const CoglColor *color, unsigned long buffers);
diff --git a/clutter/cogl/cogl/cogl.h b/clutter/cogl/cogl/cogl.h
index 28f2f3d..fffc12c 100644
--- a/clutter/cogl/cogl/cogl.h
+++ b/clutter/cogl/cogl/cogl.h
@@ -1277,9 +1277,6 @@ _cogl_check_driver_valid (GError **error);
GQuark
_cogl_driver_error_quark (void);
-void
-_cogl_onscreen_clutter_backend_set_size (int width, int height);
-
#ifdef COGL_ENABLE_EXPERIMENTAL_API
#define cogl_get_draw_framebuffer cogl_get_draw_framebuffer_EXP
CoglFramebuffer *
diff --git a/clutter/egl/clutter-backend-egl.c b/clutter/egl/clutter-backend-egl.c
index 649ac59..2af37de 100644
--- a/clutter/egl/clutter-backend-egl.c
+++ b/clutter/egl/clutter-backend-egl.c
@@ -690,7 +690,7 @@ clutter_backend_egl_get_features (ClutterBackend *backend)
egl_extensions = eglQueryString (backend_egl->edpy, EGL_EXTENSIONS);
- if (_cogl_check_extension ("EGL_NOK_swap_region", egl_extensions))
+ if (cogl_clutter_check_extension ("EGL_NOK_swap_region", egl_extensions))
{
CLUTTER_NOTE (BACKEND,
"Using EGL_NOK_swap_region for sub_buffer copies");
@@ -704,7 +704,7 @@ clutter_backend_egl_get_features (ClutterBackend *backend)
#if 0 /* XXX need GL_ARB_draw_buffers */
if (!backend_egl->swap_buffers_region &&
- _cogl_check_extension ("GL_EXT_framebuffer_blit", gl_extensions))
+ cogl_clutter_check_extension ("GL_EXT_framebuffer_blit", gl_extensions))
{
CLUTTER_NOTE (BACKEND,
"Using glBlitFramebuffer fallback for sub_buffer copies");
diff --git a/clutter/wayland/clutter-backend-wayland.c b/clutter/wayland/clutter-backend-wayland.c
index 5d029bd..0f791cd 100644
--- a/clutter/wayland/clutter-backend-wayland.c
+++ b/clutter/wayland/clutter-backend-wayland.c
@@ -228,9 +228,9 @@ try_enable_drm (ClutterBackendWayland *backend_wayland, GError **error)
glexts = glGetString(GL_EXTENSIONS);
exts = eglQueryString (backend_wayland->edpy, EGL_EXTENSIONS);
- if (!_cogl_check_extension ("EGL_KHR_image_base", exts) ||
- !_cogl_check_extension ("EGL_MESA_drm_image", exts) ||
- !_cogl_check_extension ("GL_OES_EGL_image", glexts))
+ if (!cogl_clutter_check_extension ("EGL_KHR_image_base", exts) ||
+ !cogl_clutter_check_extension ("EGL_MESA_drm_image", exts) ||
+ !cogl_clutter_check_extension ("GL_OES_EGL_image", glexts))
{
g_set_error (error, CLUTTER_INIT_ERROR,
CLUTTER_INIT_ERROR_BACKEND,
@@ -456,7 +456,7 @@ clutter_backend_wayland_create_context (ClutterBackend *backend,
#endif
egl_extensions = eglQueryString (backend_wayland->edpy, EGL_EXTENSIONS);
- if (!_cogl_check_extension (_COGL_SURFACELESS_EXTENSION, egl_extensions))
+ if (!cogl_clutter_check_extension (_COGL_SURFACELESS_EXTENSION, egl_extensions))
{
g_debug("Could not find the " _COGL_SURFACELESS_EXTENSION
" extension; falling back to binding a dummy surface");
diff --git a/clutter/win32/clutter-backend-win32.c b/clutter/win32/clutter-backend-win32.c
index c205169..a5c367f 100644
--- a/clutter/win32/clutter-backend-win32.c
+++ b/clutter/win32/clutter-backend-win32.c
@@ -227,7 +227,7 @@ clutter_backend_win32_get_features (ClutterBackend *backend)
for the swap control extension */
if (getenv ("__GL_SYNC_TO_VBLANK") || check_vblank_env ("default"))
CLUTTER_NOTE (BACKEND, "vblank sync: left at default at user request");
- else if (_cogl_check_extension ("WGL_EXT_swap_control", extensions)
+ else if (cogl_clutter_check_extension ("WGL_EXT_swap_control", extensions)
&& (swap_interval = (SwapIntervalProc)
cogl_get_proc_address ("wglSwapIntervalEXT")))
{
diff --git a/clutter/x11/clutter-stage-x11.c b/clutter/x11/clutter-stage-x11.c
index c8cea22..a587c31 100644
--- a/clutter/x11/clutter-stage-x11.c
+++ b/clutter/x11/clutter-stage-x11.c
@@ -915,7 +915,7 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
/* Queue a relayout - we want glViewport to be called
* with the correct values, and this is done in ClutterStage
- * via _cogl_onscreen_clutter_backend_set_size ().
+ * via cogl_onscreen_clutter_backend_set_size ().
*
* We queue a relayout, because if this ConfigureNotify is
* in response to a size we set in the application, the
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]