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.
This commit is contained in:
Robert Bragg 2011-02-22 18:25:29 +00:00
parent 0b45110302
commit 9f19244971
7 changed files with 120 additions and 11 deletions

View File

@ -78,6 +78,7 @@ cogl_public_h = \
$(srcdir)/cogl-attribute.h \ $(srcdir)/cogl-attribute.h \
$(srcdir)/cogl-primitive.h \ $(srcdir)/cogl-primitive.h \
$(srcdir)/cogl-clip-state.h \ $(srcdir)/cogl-clip-state.h \
$(srcdir)/cogl-clutter.h \
$(srcdir)/cogl.h \ $(srcdir)/cogl.h \
$(NULL) $(NULL)
@ -271,8 +272,9 @@ cogl_sources_c = \
$(srcdir)/cogl-shader-private.h \ $(srcdir)/cogl-shader-private.h \
$(srcdir)/cogl-shader.c \ $(srcdir)/cogl-shader.c \
$(srcdir)/cogl-gtype-private.h \ $(srcdir)/cogl-gtype-private.h \
$(srcdir)/cogl-point-in-poly-private.h \ $(srcdir)/cogl-point-in-poly-private.h \
$(srcdir)/cogl-point-in-poly.c \ $(srcdir)/cogl-point-in-poly.c \
$(srcdir)/cogl-clutter.c \
$(NULL) $(NULL)
if SUPPORT_XLIB if SUPPORT_XLIB

59
cogl/cogl-clutter.c Normal file
View File

@ -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);
}

47
cogl/cogl-clutter.h Normal file
View File

@ -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__ */

View File

@ -113,6 +113,10 @@ typedef struct _CoglOnscreen
void void
_cogl_framebuffer_state_init (void); _cogl_framebuffer_state_init (void);
void
_cogl_framebuffer_winsys_update_size (CoglFramebuffer *framebuffer,
int width, int height);
void void
_cogl_clear4f (unsigned long buffers, _cogl_clear4f (unsigned long buffers,
float red, float red,

View File

@ -989,13 +989,10 @@ _cogl_onscreen_free (CoglOnscreen *onscreen)
} }
void void
_cogl_onscreen_clutter_backend_set_size (int width, int height) _cogl_framebuffer_winsys_update_size (CoglFramebuffer *framebuffer,
int width, int height)
{ {
CoglFramebuffer *framebuffer; CoglContext *ctx = framebuffer->context;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
framebuffer = COGL_FRAMEBUFFER (ctx->window_buffer);
if (framebuffer->width == width && framebuffer->height == height) if (framebuffer->width == width && framebuffer->height == height)
return; return;

View File

@ -26,6 +26,9 @@
G_BEGIN_DECLS G_BEGIN_DECLS
gboolean
_cogl_check_extension (const char *name, const char *ext);
void void
_cogl_clear (const CoglColor *color, unsigned long buffers); _cogl_clear (const CoglColor *color, unsigned long buffers);

View File

@ -1277,9 +1277,6 @@ _cogl_check_driver_valid (GError **error);
GQuark GQuark
_cogl_driver_error_quark (void); _cogl_driver_error_quark (void);
void
_cogl_onscreen_clutter_backend_set_size (int width, int height);
#ifdef COGL_ENABLE_EXPERIMENTAL_API #ifdef COGL_ENABLE_EXPERIMENTAL_API
#define cogl_get_draw_framebuffer cogl_get_draw_framebuffer_EXP #define cogl_get_draw_framebuffer cogl_get_draw_framebuffer_EXP
CoglFramebuffer * CoglFramebuffer *