mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
6436cd073d
This declares the interface types CoglFramebuffer, CoglBuffer, CoglTexture, CoglMetaTexture and CoglPrimitiveTexture as void when including the public cogl.h header so that users don't have to use lots of C type casts between instance types and interface types. This also removes all of the COGL_XYZ() type cast macros since they do nothing more than compile time type casting but it's less readable if you haven't seen that coding pattern before. Unlike with gobject based apis that use per-type macros for casting and performing runtime type checking we instead prefer to do our runtime type checking internally within the front-end public apis when objects are passed into Cogl. This greatly reduces the verbosity for users of the api and may help reduce the chance of excessive runtime type checking that can sometimes be a problem. (cherry picked from commit 248a76f5eac7e5ae4fb45208577f9a55360812a7) Since we can't break the 1.x api this version of the patch actually defines compatible NOP macros within deprecated/cogl-type-casts.h
48 lines
1.6 KiB
C
48 lines
1.6 KiB
C
/*
|
|
* Cogl
|
|
*
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
|
*
|
|
* Copyright (C) 2013 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(COGL_COMPILATION)
|
|
#error "Only <cogl/cogl.h> can be included directly."
|
|
#endif
|
|
|
|
#ifndef __COGL_TYPE_CASTS_H__
|
|
#define __COGL_TYPE_CASTS_H__
|
|
|
|
/* The various interface types in Cogl used to be more strongly typed
|
|
* which required lots type casting by developers. We provided
|
|
* macros for performing these casts following a widely used Gnome
|
|
* coding style. Since we now consistently typedef these interfaces
|
|
* as void for the public C api and use runtime type checking to
|
|
* catch programming errors the casts have become redundant and
|
|
* so these macros are only kept for compatibility...
|
|
*/
|
|
|
|
#define COGL_FRAMEBUFFER(X) (X)
|
|
#define COGL_BUFFER(X) (X)
|
|
#define COGL_TEXTURE(X) (X)
|
|
#define COGL_META_TEXTURE(X) (X)
|
|
#define COGL_PRIMITIVE_TEXTURE(X) (X)
|
|
|
|
#endif /* __COGL_TYPE_CASTS_H__ */
|