From 9f19244971d06b28730697d12ea9f73558d3354c Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Tue, 22 Feb 2011 18:25:29 +0000 Subject: [PATCH] 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. --- cogl/Makefile.am | 6 ++-- cogl/cogl-clutter.c | 59 +++++++++++++++++++++++++++++++++ cogl/cogl-clutter.h | 47 ++++++++++++++++++++++++++ cogl/cogl-framebuffer-private.h | 4 +++ cogl/cogl-framebuffer.c | 9 ++--- cogl/cogl-private.h | 3 ++ cogl/cogl.h | 3 -- 7 files changed, 120 insertions(+), 11 deletions(-) create mode 100644 cogl/cogl-clutter.c create mode 100644 cogl/cogl-clutter.h diff --git a/cogl/Makefile.am b/cogl/Makefile.am index 9f6a837dc..a4d67cfe1 100644 --- a/cogl/Makefile.am +++ b/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/cogl/cogl-clutter.c b/cogl/cogl-clutter.c new file mode 100644 index 000000000..07f827afd --- /dev/null +++ b/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 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#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/cogl/cogl-clutter.h b/cogl/cogl-clutter.h new file mode 100644 index 000000000..023d14fdc --- /dev/null +++ b/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 can be included directly." +#endif + +#ifndef __COGL_CLUTTER_H__ +#define __COGL_CLUTTER_H__ + +#ifdef COGL_HAS_XLIB +#include +#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/cogl/cogl-framebuffer-private.h b/cogl/cogl-framebuffer-private.h index fc9566470..afc8fe195 100644 --- a/cogl/cogl-framebuffer-private.h +++ b/cogl/cogl-framebuffer-private.h @@ -113,6 +113,10 @@ typedef struct _CoglOnscreen 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, diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c index 8a9feff5c..a14599423 100644 --- a/cogl/cogl-framebuffer.c +++ b/cogl/cogl-framebuffer.c @@ -989,13 +989,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/cogl/cogl-private.h b/cogl/cogl-private.h index afcfe4693..4407b421f 100644 --- a/cogl/cogl-private.h +++ b/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/cogl/cogl.h b/cogl/cogl.h index 28f2f3d54..fffc12c68 100644 --- a/cogl/cogl.h +++ b/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 *