[cogl/cogl-1.18] Declare interface types as void and remove cast macros



commit 6436cd073d256e54f82e7607874006862b2f0ad6
Author: Robert Bragg <robert linux intel com>
Date:   Wed Oct 9 13:31:12 2013 +0100

    Declare interface types as void and remove cast macros
    
    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

 cogl-gst/cogl-gst-video-sink.c                     |   19 +++++---
 cogl-gst/cogl-gst-video-sink.h                     |   10 ++++
 cogl-pango/cogl-pango-display-list.c               |    1 -
 cogl-pango/cogl-pango-display-list.h               |    1 -
 cogl-pango/cogl-pango-glyph-cache.h                |    3 +-
 cogl-pango/cogl-pango-pipeline-cache.c             |    1 -
 cogl-pango/cogl-pango-pipeline-cache.h             |    3 +-
 cogl-pango/cogl-pango.h                            |   13 +++++
 cogl-path/cogl-path-types.h                        |    2 -
 cogl-path/cogl-path.c                              |    2 -
 cogl-path/cogl2-path-functions.h                   |    4 ++
 cogl/Makefile.am                                   |    1 +
 cogl/cogl-buffer.h                                 |   10 +++-
 cogl/cogl-framebuffer.h                            |   10 +++-
 cogl/cogl-gles2.h                                  |    9 ++++
 cogl/cogl-meta-texture.h                           |    7 +++
 cogl/cogl-primitive-texture.h                      |    7 +++
 cogl/cogl-texture.h                                |   10 +++-
 cogl/cogl-wayland-client.h                         |    9 ++++
 cogl/cogl-wayland-server.h                         |    9 ++++
 cogl/cogl-xlib-renderer.h                          |    8 +++
 cogl/cogl-xlib.h                                   |    8 +++
 cogl/cogl.h                                        |    9 ++++
 cogl/deprecated/cogl-type-casts.h                  |   47 ++++++++++++++++++++
 cogl/deprecated/cogl-vertex-buffer.c               |    1 +
 cogl/winsys/cogl-texture-pixmap-x11.h              |    8 +++
 examples/cogl-basic-video-player.c                 |    2 +-
 examples/cogl-crate.c                              |    6 +-
 examples/cogl-gles2-context.c                      |    6 +-
 examples/cogl-gles2-gears.c                        |    2 +-
 examples/cogl-hello.c                              |    8 ++--
 examples/cogl-msaa.c                               |   10 ++--
 examples/cogl-point-sprites.c                      |   10 ++--
 examples/cogl-sdl2-hello.c                         |    6 +-
 examples/cogl-x11-foreign.c                        |    2 +-
 examples/cogl-x11-tfp.c                            |   10 +++--
 examples/cogland.c                                 |   22 +++++-----
 test-fixtures/test-utils.h                         |   11 +++++
 tests/conform/Makefile.am                          |    3 +-
 tests/conform/test-alpha-test.c                    |    2 +-
 tests/conform/test-alpha-textures.c                |    4 +-
 tests/conform/test-backface-culling.c              |    2 +-
 tests/conform/test-color-hsl.c                     |   16 +++---
 tests/conform/test-color-mask.c                    |    3 +-
 tests/conform/test-copy-replace-texture.c          |    2 +-
 tests/conform/test-fence.c                         |    1 -
 tests/conform/test-framebuffer-get-bits.c          |    8 ++--
 tests/conform/test-gles2-context.c                 |   40 ++++++++--------
 tests/conform/test-map-buffer-range.c              |    6 +-
 tests/conform/test-offscreen.c                     |   10 ++--
 tests/conform/test-pipeline-cache-unrefs-texture.c |    2 +-
 tests/conform/test-pipeline-shader-state.c         |    8 ++--
 tests/conform/test-pixel-buffer.c                  |   12 +++---
 tests/conform/test-point-sprite.c                  |    2 +-
 tests/conform/test-premult.c                       |    4 +-
 tests/conform/test-read-texture-formats.c          |   10 ++--
 tests/conform/test-sub-texture.c                   |   28 ++++++------
 tests/conform/test-texture-3d.c                    |    6 +-
 tests/conform/test-texture-no-allocate.c           |    8 ++--
 tests/conform/test-version.c                       |    8 +++
 tests/conform/test-wrap-rectangle-textures.c       |    2 +-
 tests/micro-perf/test-journal.c                    |    2 +-
 62 files changed, 340 insertions(+), 156 deletions(-)
---
diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
index 4feb724..d7e8b61 100644
--- a/cogl-gst/cogl-gst-video-sink.c
+++ b/cogl-gst/cogl-gst-video-sink.c
@@ -31,17 +31,20 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <gst/gst.h>
 #include <gst/gstvalue.h>
 #include <gst/video/video.h>
 #include <gst/riff/riff-ids.h>
-#include <cogl/cogl.h>
 #include <string.h>
 
+/* We just need the public Cogl api for cogl-gst but we first need to
+ * undef COGL_COMPILATION to avoid getting an error that normally
+ * checks cogl.h isn't used internally. */
+#undef COGL_COMPILATION
+#include <cogl/cogl.h>
+
 #include "cogl-gst-video-sink.h"
 
 #define COGL_GST_DEFAULT_PRIORITY G_PRIORITY_HIGH_IDLE
@@ -198,7 +201,7 @@ cogl_gst_video_sink_attach_frame (CoglGstVideoSink *sink,
   for (i = 0; i < G_N_ELEMENTS (priv->frame); i++)
     if (priv->frame[i] != NULL)
       cogl_pipeline_set_layer_texture (pln, i + priv->custom_start,
-                                       COGL_TEXTURE (priv->frame[i]));
+                                       priv->frame[i]);
 }
 
 static CoglBool
@@ -486,9 +489,9 @@ video_texture_new_from_data (CoglContext *ctx,
        is_pot (cogl_bitmap_get_height (bitmap))) ||
       cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC))
     {
-      tex = COGL_TEXTURE (cogl_texture_2d_new_from_bitmap (bitmap,
-                                                           internal_format,
-                                                           &internal_error));
+      tex = cogl_texture_2d_new_from_bitmap (bitmap,
+                                             internal_format,
+                                             &internal_error);
       if (!tex)
         {
           cogl_error_free (internal_error);
@@ -506,7 +509,7 @@ video_texture_new_from_data (CoglContext *ctx,
                                                 -1, /* no maximum waste */
                                                 internal_format,
                                                 error);
-      tex = COGL_TEXTURE (tex_2ds);
+      tex = tex_2ds;
     }
 
   cogl_object_unref (bitmap);
diff --git a/cogl-gst/cogl-gst-video-sink.h b/cogl-gst/cogl-gst-video-sink.h
index 39cca52..317e1c7 100644
--- a/cogl-gst/cogl-gst-video-sink.h
+++ b/cogl-gst/cogl-gst-video-sink.h
@@ -35,6 +35,16 @@
 #define __COGL_GST_VIDEO_SINK_H__
 #include <glib-object.h>
 #include <gst/base/gstbasesink.h>
+
+/* We just need the public Cogl api for cogl-gst but we first need to
+ * undef COGL_COMPILATION to avoid getting an error that normally
+ * checks cogl.h isn't used internally. */
+#ifdef COGL_COMPILATION
+#undef COGL_COMPILATION
+#endif
+
+#include <cogl/cogl.h>
+
 #include <cogl/cogl.h>
 
 /**
diff --git a/cogl-pango/cogl-pango-display-list.c b/cogl-pango/cogl-pango-display-list.c
index 2b8c6ab..e31b7a1 100644
--- a/cogl-pango/cogl-pango-display-list.c
+++ b/cogl-pango/cogl-pango-display-list.c
@@ -26,7 +26,6 @@
 #endif
 
 #include <glib.h>
-#include <cogl/cogl.h>
 #include <string.h>
 
 #include "cogl-pango-display-list.h"
diff --git a/cogl-pango/cogl-pango-display-list.h b/cogl-pango/cogl-pango-display-list.h
index 28ac4fd..27b591a 100644
--- a/cogl-pango/cogl-pango-display-list.h
+++ b/cogl-pango/cogl-pango-display-list.h
@@ -25,7 +25,6 @@
 #define __COGL_PANGO_DISPLAY_LIST_H__
 
 #include <glib.h>
-#include <cogl/cogl.h>
 #include "cogl-pango-pipeline-cache.h"
 
 COGL_BEGIN_DECLS
diff --git a/cogl-pango/cogl-pango-glyph-cache.h b/cogl-pango/cogl-pango-glyph-cache.h
index fc25a71..d0aba6c 100644
--- a/cogl-pango/cogl-pango-glyph-cache.h
+++ b/cogl-pango/cogl-pango-glyph-cache.h
@@ -25,9 +25,10 @@
 #define __COGL_PANGO_GLYPH_CACHE_H__
 
 #include <glib.h>
-#include <cogl/cogl.h>
 #include <pango/pango-font.h>
 
+#include "cogl/cogl-texture.h"
+
 COGL_BEGIN_DECLS
 
 typedef struct _CoglPangoGlyphCache      CoglPangoGlyphCache;
diff --git a/cogl-pango/cogl-pango-pipeline-cache.c b/cogl-pango/cogl-pango-pipeline-cache.c
index 9aa32ad..1dba447 100644
--- a/cogl-pango/cogl-pango-pipeline-cache.c
+++ b/cogl-pango/cogl-pango-pipeline-cache.c
@@ -30,7 +30,6 @@
 #endif
 
 #include <glib.h>
-#include <cogl/cogl.h>
 #include "cogl-pango-pipeline-cache.h"
 
 #include "cogl/cogl-context-private.h"
diff --git a/cogl-pango/cogl-pango-pipeline-cache.h b/cogl-pango/cogl-pango-pipeline-cache.h
index 411650b..d97edb4 100644
--- a/cogl-pango/cogl-pango-pipeline-cache.h
+++ b/cogl-pango/cogl-pango-pipeline-cache.h
@@ -29,7 +29,8 @@
 #define __COGL_PANGO_PIPELINE_CACHE_H__
 
 #include <glib.h>
-#include <cogl/cogl.h>
+
+#include "cogl/cogl-context-private.h"
 
 COGL_BEGIN_DECLS
 
diff --git a/cogl-pango/cogl-pango.h b/cogl-pango/cogl-pango.h
index 9e3e7cc..716e024 100644
--- a/cogl-pango/cogl-pango.h
+++ b/cogl-pango/cogl-pango.h
@@ -32,7 +32,20 @@
 #include <glib-object.h>
 #include <pango/pango.h>
 #include <pango/pangocairo.h>
+
+/* XXX: Currently this header may be included both as an internal
+ * header (within the cogl-pango implementation) and as a public
+ * header.
+ *
+ * Since <cogl/cogl.h> should not be included for internal use we
+ * determine the current context and switch between including cogl.h
+ * or specific internal cogl headers here...
+ */
+#ifndef COGL_COMPILATION
 #include <cogl/cogl.h>
+#else
+#include "cogl/cogl-context.h"
+#endif
 
 COGL_BEGIN_DECLS
 
diff --git a/cogl-path/cogl-path-types.h b/cogl-path/cogl-path-types.h
index 697f687..89bcaf3 100644
--- a/cogl-path/cogl-path-types.h
+++ b/cogl-path/cogl-path-types.h
@@ -35,8 +35,6 @@ COGL_BEGIN_DECLS
 
 typedef struct _CoglPath CoglPath;
 
-#define COGL_PATH(obj) ((CoglPath *)(obj))
-
 /**
  * CoglPathFillRule:
  * @COGL_PATH_FILL_RULE_NON_ZERO: Each time the line crosses an edge of
diff --git a/cogl-path/cogl-path.c b/cogl-path/cogl-path.c
index 5a97531..cde6196 100644
--- a/cogl-path/cogl-path.c
+++ b/cogl-path/cogl-path.c
@@ -26,9 +26,7 @@
  *  Robert Bragg  <robert linux intel com>
  */
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "cogl-util.h"
 #include "cogl-object.h"
diff --git a/cogl-path/cogl2-path-functions.h b/cogl-path/cogl2-path-functions.h
index e2b01c8..dae0809 100644
--- a/cogl-path/cogl2-path-functions.h
+++ b/cogl-path/cogl2-path-functions.h
@@ -30,7 +30,11 @@
 #define __COGL2_PATH_FUNCTIONS_H__
 
 #include <cogl/cogl-types.h>
+#ifdef COGL_COMPILATION
+#include "cogl-context.h"
+#else
 #include <cogl/cogl.h>
+#endif
 
 COGL_BEGIN_DECLS
 
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index bd6aa0c..9e84836 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -74,6 +74,7 @@ cogl_deprecated_h = \
        $(srcdir)/deprecated/cogl-vertex-buffer.h       \
        $(srcdir)/deprecated/cogl-shader.h              \
        $(srcdir)/deprecated/cogl-clutter.h             \
+       $(srcdir)/deprecated/cogl-type-casts.h          \
        $(NULL)
 
 # public 1.x api headers
diff --git a/cogl/cogl-buffer.h b/cogl/cogl-buffer.h
index 5139b32..f4389ef 100644
--- a/cogl/cogl-buffer.h
+++ b/cogl/cogl-buffer.h
@@ -59,9 +59,15 @@ COGL_BEGIN_DECLS
  * without blocking other Cogl operations.
  */
 
-#define COGL_BUFFER(buffer)     ((CoglBuffer *)(buffer))
-
+#ifdef __COGL_H_INSIDE__
+/* For the public C api we typedef interface types as void to avoid needing
+ * lots of casting in code and instead we will rely on runtime type checking
+ * for these objects. */
+typedef void CoglBuffer;
+#else
 typedef struct _CoglBuffer CoglBuffer;
+#define COGL_BUFFER(buffer) ((CoglBuffer *)(buffer))
+#endif
 
 #define COGL_BUFFER_ERROR (_cogl_buffer_error_domain ())
 
diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h
index 45f0157..e802ba5 100644
--- a/cogl/cogl-framebuffer.h
+++ b/cogl/cogl-framebuffer.h
@@ -35,7 +35,15 @@
 /* We forward declare the CoglFramebuffer type here to avoid some circular
  * dependency issues with the following headers.
  */
+#ifdef __COGL_H_INSIDE__
+/* For the public C api we typedef interface types as void to avoid needing
+ * lots of casting in code and instead we will rely on runtime type checking
+ * for these objects. */
+typedef void CoglFramebuffer;
+#else
 typedef struct _CoglFramebuffer CoglFramebuffer;
+#define COGL_FRAMEBUFFER(X) ((CoglFramebuffer *)(X))
+#endif
 
 #include <cogl/cogl-pipeline.h>
 #include <cogl/cogl-indices.h>
@@ -88,8 +96,6 @@ COGL_BEGIN_DECLS
 
 #ifdef COGL_ENABLE_EXPERIMENTAL_API
 
-#define COGL_FRAMEBUFFER(X) ((CoglFramebuffer *)(X))
-
 /**
  * cogl_framebuffer_allocate:
  * @framebuffer: A #CoglFramebuffer
diff --git a/cogl/cogl-gles2.h b/cogl/cogl-gles2.h
index c654a5c..1fc4bc4 100644
--- a/cogl/cogl-gles2.h
+++ b/cogl/cogl-gles2.h
@@ -29,7 +29,16 @@
 #ifndef __COGL_GLES2_H__
 #define __COGL_GLES2_H__
 
+/* NB: cogl-gles2.h is a top-level header that can be included directly
+ * but we want to be careful not to define __COGL_H_INSIDE__ when this
+ * is included internally while building Cogl itself since
+ * __COGL_H_INSIDE__ is used in headers to guard public vs private
+ * api definitions
+ */
+#ifndef COGL_COMPILATION
 #define __COGL_H_INSIDE__
+#endif
+
 #include <cogl/cogl-defines.h>
 #include <cogl/cogl-context.h>
 #include <cogl/cogl-framebuffer.h>
diff --git a/cogl/cogl-meta-texture.h b/cogl/cogl-meta-texture.h
index 30d94e4..65e549b 100644
--- a/cogl/cogl-meta-texture.h
+++ b/cogl/cogl-meta-texture.h
@@ -86,8 +86,15 @@ COGL_BEGIN_DECLS
  * meta-textures.</note>
  */
 
+#ifdef __COGL_H_INSIDE__
+/* For the public C api we typedef interface types as void to avoid needing
+ * lots of casting in code and instead we will rely on runtime type checking
+ * for these objects. */
+typedef void CoglMetaTexture;
+#else
 typedef struct _CoglMetaTexture CoglMetaTexture;
 #define COGL_META_TEXTURE(X) ((CoglMetaTexture *)X)
+#endif
 
 /**
  * CoglMetaTextureCallback:
diff --git a/cogl/cogl-primitive-texture.h b/cogl/cogl-primitive-texture.h
index a7e6a0f..4ceec24 100644
--- a/cogl/cogl-primitive-texture.h
+++ b/cogl/cogl-primitive-texture.h
@@ -57,8 +57,15 @@ COGL_BEGIN_DECLS
  * primitive textures.</note>
  */
 
+#ifdef __COGL_H_INSIDE__
+/* For the public C api we typedef interface types as void to avoid needing
+ * lots of casting in code and instead we will rely on runtime type checking
+ * for these objects. */
+typedef void CoglPrimitiveTexture;
+#else
 typedef struct _CoglPrimitiveTexture CoglPrimitiveTexture;
 #define COGL_PRIMITIVE_TEXTURE(X) ((CoglPrimitiveTexture *)X)
+#endif
 
 /**
  * cogl_is_primitive_texture:
diff --git a/cogl/cogl-texture.h b/cogl/cogl-texture.h
index b69ba0c..a371f5b 100644
--- a/cogl/cogl-texture.h
+++ b/cogl/cogl-texture.h
@@ -31,7 +31,15 @@
 /* We forward declare the CoglTexture type here to avoid some circular
  * dependency issues with the following headers.
  */
+#ifdef __COGL_H_INSIDE__
+/* For the public C api we typedef interface types as void to avoid needing
+ * lots of casting in code and instead we will rely on runtime type checking
+ * for these objects. */
+typedef void CoglTexture;
+#else
 typedef struct _CoglTexture CoglTexture;
+#define COGL_TEXTURE(X) ((CoglTexture *)X)
+#endif
 
 #include <cogl/cogl-types.h>
 #include <cogl/cogl-macros.h>
@@ -52,8 +60,6 @@ COGL_BEGIN_DECLS
  * loading and manipulating textures.
  */
 
-#define COGL_TEXTURE(X) ((CoglTexture *)X)
-
 #define COGL_TEXTURE_MAX_WASTE  127
 
 /**
diff --git a/cogl/cogl-wayland-client.h b/cogl/cogl-wayland-client.h
index 610f558..a211a1f 100644
--- a/cogl/cogl-wayland-client.h
+++ b/cogl/cogl-wayland-client.h
@@ -24,7 +24,16 @@
 #ifndef __COGL_WAYLAND_CLIENT_H
 #define __COGL_WAYLAND_CLIENT_H
 
+/* NB: this is a top-level header that can be included directly but we
+ * want to be careful not to define __COGL_H_INSIDE__ when this is
+ * included internally while building Cogl itself since
+ * __COGL_H_INSIDE__ is used in headers to guard public vs private api
+ * definitions
+ */
+#ifndef COGL_COMPILATION
 #define __COGL_H_INSIDE__
+#endif
+
 #include <cogl/cogl-wayland-renderer.h>
 
 #endif /* __COGL_WAYLAND_CLIENT_H */
diff --git a/cogl/cogl-wayland-server.h b/cogl/cogl-wayland-server.h
index bf0bc4c..a8897b2 100644
--- a/cogl/cogl-wayland-server.h
+++ b/cogl/cogl-wayland-server.h
@@ -26,7 +26,16 @@
 
 #include <wayland-server.h>
 
+/* NB: this is a top-level header that can be included directly but we
+ * want to be careful not to define __COGL_H_INSIDE__ when this is
+ * included internally while building Cogl itself since
+ * __COGL_H_INSIDE__ is used in headers to guard public vs private api
+ * definitions
+ */
+#ifndef COGL_COMPILATION
 #define __COGL_H_INSIDE__
+#endif
+
 #include <cogl/cogl-context.h>
 #include <cogl/cogl-texture-2d.h>
 
diff --git a/cogl/cogl-xlib-renderer.h b/cogl/cogl-xlib-renderer.h
index db25b4e..569beaa 100644
--- a/cogl/cogl-xlib-renderer.h
+++ b/cogl/cogl-xlib-renderer.h
@@ -30,7 +30,15 @@
 
 #include <X11/Xlib.h>
 
+/* NB: this is a top-level header that can be included directly but we
+ * want to be careful not to define __COGL_H_INSIDE__ when this is
+ * included internally while building Cogl itself since
+ * __COGL_H_INSIDE__ is used in headers to guard public vs private api
+ * definitions
+ */
+#ifndef COGL_COMPILATION
 #define __COGL_H_INSIDE__
+#endif
 #include <cogl/cogl-renderer.h>
 
 COGL_BEGIN_DECLS
diff --git a/cogl/cogl-xlib.h b/cogl/cogl-xlib.h
index c137158..53f4b5f 100644
--- a/cogl/cogl-xlib.h
+++ b/cogl/cogl-xlib.h
@@ -26,8 +26,16 @@
 
 #include <X11/Xlib.h>
 
+/* NB: this is a top-level header that can be included directly but we
+ * want to be careful not to define __COGL_H_INSIDE__ when this is
+ * included internally while building Cogl itself since
+ * __COGL_H_INSIDE__ is used in headers to guard public vs private api
+ * definitions
+ */
+#ifndef COGL_COMPILATION
 #define __COGL_XLIB_H_INSIDE__
 #define __COGL_H_INSIDE__
+#endif
 
 #include <cogl/cogl-types.h>
 #include <cogl/deprecated/cogl-clutter-xlib.h>
diff --git a/cogl/cogl.h b/cogl/cogl.h
index 7504ff7..bb9b7ec 100644
--- a/cogl/cogl.h
+++ b/cogl/cogl.h
@@ -25,6 +25,10 @@
 #ifndef __COGL_H__
 #define __COGL_H__
 
+#ifdef COGL_COMPILATION
+#error "<cogl/cogl.h> shouldn't be included internally"
+#endif
+
 #define __COGL_H_INSIDE__
 
 #ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API
@@ -72,6 +76,11 @@
 #include <cogl/deprecated/cogl-shader.h>
 #endif
 
+/* It would be good to move these casts up into 1.x only api if we can
+ * update Clutter, Mutter and GnomeShell to avoid redundant casts when
+ * they enable the experimental api... */
+#include <cogl/deprecated/cogl-type-casts.h>
+
 /*
  * 2.0 api that's compatible with the 1.x api...
  */
diff --git a/cogl/deprecated/cogl-type-casts.h b/cogl/deprecated/cogl-type-casts.h
new file mode 100644
index 0000000..2080206
--- /dev/null
+++ b/cogl/deprecated/cogl-type-casts.h
@@ -0,0 +1,47 @@
+/*
+ * 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__ */
diff --git a/cogl/deprecated/cogl-vertex-buffer.c b/cogl/deprecated/cogl-vertex-buffer.c
index 20f327f..d151b84 100644
--- a/cogl/deprecated/cogl-vertex-buffer.c
+++ b/cogl/deprecated/cogl-vertex-buffer.c
@@ -108,6 +108,7 @@
 #include "cogl-primitive-private.h"
 #include "cogl-journal-private.h"
 #include "cogl1-context.h"
+#include "cogl-vertex-buffer.h"
 
 #define PAD_FOR_ALIGNMENT(VAR, TYPE_SIZE) \
   (VAR = TYPE_SIZE + ((VAR - 1) & ~(TYPE_SIZE - 1)))
diff --git a/cogl/winsys/cogl-texture-pixmap-x11.h b/cogl/winsys/cogl-texture-pixmap-x11.h
index 5d78af3..6f0daf5 100644
--- a/cogl/winsys/cogl-texture-pixmap-x11.h
+++ b/cogl/winsys/cogl-texture-pixmap-x11.h
@@ -24,7 +24,15 @@
 #ifndef __COGL_TEXTURE_PIXMAP_X11_H
 #define __COGL_TEXTURE_PIXMAP_X11_H
 
+/* NB: this is a top-level header that can be included directly but we
+ * want to be careful not to define __COGL_H_INSIDE__ when this is
+ * included internally while building Cogl itself since
+ * __COGL_H_INSIDE__ is used in headers to guard public vs private api
+ * definitions
+ */
+#ifndef COGL_COMPILATION
 #define __COGL_H_INSIDE__
+#endif
 
 #include <cogl/cogl-context.h>
 
diff --git a/examples/cogl-basic-video-player.c b/examples/cogl-basic-video-player.c
index ba1e6c6..cc1ace2 100644
--- a/examples/cogl-basic-video-player.c
+++ b/examples/cogl-basic-video-player.c
@@ -257,7 +257,7 @@ main (int argc,
   cogl_onscreen_add_resize_callback (onscreen, _resize_callback, &data, NULL);
   cogl_onscreen_show (onscreen);
 
-  data.fb = COGL_FRAMEBUFFER (onscreen);
+  data.fb = onscreen;
   cogl_framebuffer_orthographic (data.fb, 0, 0, 640, 480, -1, 100);
 
   data.border_pipeline = cogl_pipeline_new (ctx);
diff --git a/examples/cogl-crate.c b/examples/cogl-crate.c
index acba1e5..be2ae59 100644
--- a/examples/cogl-crate.c
+++ b/examples/cogl-crate.c
@@ -160,7 +160,7 @@ main (int argc, char **argv)
   }
 
   onscreen = cogl_onscreen_new (ctx, 640, 480);
-  fb = COGL_FRAMEBUFFER (onscreen);
+  fb = onscreen;
   data.fb = fb;
   data.framebuffer_width = cogl_framebuffer_get_width (fb);
   data.framebuffer_height = cogl_framebuffer_get_height (fb);
@@ -220,11 +220,11 @@ main (int argc, char **argv)
 
   /* Load a jpeg crate texture from a file */
   printf ("crate.jpg (CC by-nc-nd http://bit.ly/9kP45T) ShadowRunner27 http://bit.ly/m1YXLh\n";);
-  data.texture = COGL_TEXTURE (
+  data.texture =
     cogl_texture_2d_new_from_file (ctx,
                                    COGL_EXAMPLES_DATA "crate.jpg",
                                    COGL_PIXEL_FORMAT_ANY,
-                                   &error));
+                                   &error);
   if (!data.texture)
     g_error ("Failed to load texture: %s", error->message);
 
diff --git a/examples/cogl-gles2-context.c b/examples/cogl-gles2-context.c
index 4f4fbfa..2b383a8 100644
--- a/examples/cogl-gles2-context.c
+++ b/examples/cogl-gles2-context.c
@@ -87,7 +87,7 @@ main (int argc, char **argv)
 
     onscreen = cogl_onscreen_new (data.ctx, 640, 480);
     cogl_onscreen_show (onscreen);
-    data.fb = COGL_FRAMEBUFFER (onscreen);
+    data.fb = onscreen;
 
     /* Prepare onscreen primitive */
     data.triangle = cogl_primitive_new_p2c4 (data.ctx,
@@ -95,11 +95,11 @@ main (int argc, char **argv)
                                              3, triangle_vertices);
     data.pipeline = cogl_pipeline_new (data.ctx);
 
-    data.offscreen_texture = COGL_TEXTURE (
+    data.offscreen_texture =
       cogl_texture_2d_new_with_size (data.ctx,
                                      OFFSCREEN_WIDTH,
                                      OFFSCREEN_HEIGHT,
-                                     COGL_PIXEL_FORMAT_ANY));
+                                     COGL_PIXEL_FORMAT_ANY);
     data.offscreen = cogl_offscreen_new_with_texture (data.offscreen_texture);
 
     data.gles2_ctx = cogl_gles2_context_new (data.ctx, &error);
diff --git a/examples/cogl-gles2-gears.c b/examples/cogl-gles2-gears.c
index c7185b6..048cd27 100644
--- a/examples/cogl-gles2-gears.c
+++ b/examples/cogl-gles2-gears.c
@@ -779,7 +779,7 @@ main (int argc, char **argv)
 
     onscreen = cogl_onscreen_new (data.ctx, 300, 300);
     cogl_onscreen_show (onscreen);
-    data.fb = COGL_FRAMEBUFFER (onscreen);
+    data.fb = onscreen;
 
     data.gles2_ctx = cogl_gles2_context_new (data.ctx, &error);
     if (!data.gles2_ctx)
diff --git a/examples/cogl-hello.c b/examples/cogl-hello.c
index 602ac49..1387ab8 100644
--- a/examples/cogl-hello.c
+++ b/examples/cogl-hello.c
@@ -27,7 +27,7 @@ paint_cb (void *user_data)
     cogl_primitive_draw (data->triangle,
                          data->fb,
                          data->pipeline);
-    cogl_onscreen_swap_buffers (COGL_ONSCREEN (data->fb));
+    cogl_onscreen_swap_buffers (data->fb);
 
     return G_SOURCE_REMOVE;
 }
@@ -94,7 +94,7 @@ main (int argc, char **argv)
 
     onscreen = cogl_onscreen_new (data.ctx, 640, 480);
     cogl_onscreen_show (onscreen);
-    data.fb = COGL_FRAMEBUFFER (onscreen);
+    data.fb = onscreen;
 
     cogl_onscreen_set_resizable (onscreen, TRUE);
 
@@ -107,11 +107,11 @@ main (int argc, char **argv)
 
     g_source_attach (cogl_source, NULL);
 
-    cogl_onscreen_add_frame_callback (COGL_ONSCREEN (data.fb),
+    cogl_onscreen_add_frame_callback (data.fb,
                                       frame_event_cb,
                                       &data,
                                       NULL); /* destroy notify */
-    cogl_onscreen_add_dirty_callback (COGL_ONSCREEN (data.fb),
+    cogl_onscreen_add_dirty_callback (data.fb,
                                       dirty_cb,
                                       &data,
                                       NULL); /* destroy notify */
diff --git a/examples/cogl-msaa.c b/examples/cogl-msaa.c
index 70b1a3d..d12143b 100644
--- a/examples/cogl-msaa.c
+++ b/examples/cogl-msaa.c
@@ -41,7 +41,7 @@ main (int argc, char **argv)
       }
 
     onscreen = cogl_onscreen_new (ctx, 640, 480);
-    fb = COGL_FRAMEBUFFER (onscreen);
+    fb = onscreen;
 
     cogl_framebuffer_set_samples_per_pixel (fb, 4);
 
@@ -62,11 +62,11 @@ main (int argc, char **argv)
 
     cogl_onscreen_show (onscreen);
 
-    tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,
-                                                       320, 480,
-                                                       COGL_PIXEL_FORMAT_ANY));
+    tex = cogl_texture_2d_new_with_size (ctx,
+                                         320, 480,
+                                         COGL_PIXEL_FORMAT_ANY);
     offscreen = cogl_offscreen_new_with_texture (tex);
-    offscreen_fb = COGL_FRAMEBUFFER (offscreen);
+    offscreen_fb = offscreen;
     cogl_framebuffer_set_samples_per_pixel (offscreen_fb, 4);
     if (!cogl_framebuffer_allocate (offscreen_fb, &error))
       {
diff --git a/examples/cogl-point-sprites.c b/examples/cogl-point-sprites.c
index 2208cfa..65bcac6 100644
--- a/examples/cogl-point-sprites.c
+++ b/examples/cogl-point-sprites.c
@@ -89,7 +89,7 @@ generate_round_texture (CoglContext *context)
 
   g_free (data);
 
-  return COGL_TEXTURE (tex);
+  return tex;
 }
 
 static void
@@ -183,7 +183,7 @@ paint (Data *data)
       g_timer_reset (data->last_spark_time);
     }
 
-  cogl_buffer_set_data (COGL_BUFFER (data->attribute_buffer),
+  cogl_buffer_set_data (data->attribute_buffer,
                         0, /* offset */
                         data->sparks,
                         sizeof (data->sparks));
@@ -194,7 +194,7 @@ paint (Data *data)
                        data->fb,
                        data->pipeline);
 
-  cogl_onscreen_swap_buffers (COGL_ONSCREEN (data->fb));
+  cogl_onscreen_swap_buffers (data->fb);
 }
 
 static void
@@ -206,7 +206,7 @@ create_primitive (Data *data)
   data->attribute_buffer =
     cogl_attribute_buffer_new_with_size (data->context,
                                          sizeof (data->sparks));
-  cogl_buffer_set_update_hint (COGL_BUFFER (data->attribute_buffer),
+  cogl_buffer_set_update_hint (data->attribute_buffer,
                                COGL_BUFFER_UPDATE_HINT_DYNAMIC);
 
   attributes[0] = cogl_attribute_new (data->attribute_buffer,
@@ -288,7 +288,7 @@ main (int argc, char *argv[])
 
   onscreen = cogl_onscreen_new (data.context, 800, 600);
   cogl_onscreen_show (onscreen);
-  data.fb = COGL_FRAMEBUFFER (onscreen);
+  data.fb = onscreen;
 
   cogl_source = cogl_glib_source_new (data.context, G_PRIORITY_DEFAULT);
 
diff --git a/examples/cogl-sdl2-hello.c b/examples/cogl-sdl2-hello.c
index 7dfabdd..f84c40e 100644
--- a/examples/cogl-sdl2-hello.c
+++ b/examples/cogl-sdl2-hello.c
@@ -59,9 +59,9 @@ handle_event (Data *data, SDL_Event *event)
     case SDL_MOUSEMOTION:
       {
         int width =
-          cogl_framebuffer_get_width (COGL_FRAMEBUFFER (data->fb));
+          cogl_framebuffer_get_width (data->fb);
         int height =
-          cogl_framebuffer_get_height (COGL_FRAMEBUFFER (data->fb));
+          cogl_framebuffer_get_height (data->fb);
 
         data->center_x = event->motion.x * 2.0f / width - 1.0f;
         data->center_y = event->motion.y * 2.0f / height - 1.0f;
@@ -110,7 +110,7 @@ main (int argc, char **argv)
     }
 
   onscreen = cogl_onscreen_new (ctx, 800, 600);
-  data.fb = COGL_FRAMEBUFFER (onscreen);
+  data.fb = onscreen;
 
   cogl_onscreen_add_frame_callback (onscreen,
                                     frame_cb,
diff --git a/examples/cogl-x11-foreign.c b/examples/cogl-x11-foreign.c
index 01a47e3..04d586f 100644
--- a/examples/cogl-x11-foreign.c
+++ b/examples/cogl-x11-foreign.c
@@ -157,7 +157,7 @@ main (int argc, char **argv)
 
   XMapWindow (xdpy, xwin);
 
-  fb = COGL_FRAMEBUFFER (onscreen);
+  fb = onscreen;
 
   cogl_onscreen_set_resizable (onscreen, TRUE);
   cogl_onscreen_add_resize_callback (onscreen, resize_handler, onscreen, NULL);
diff --git a/examples/cogl-x11-tfp.c b/examples/cogl-x11-tfp.c
index dd19366..91979a6 100644
--- a/examples/cogl-x11-tfp.c
+++ b/examples/cogl-x11-tfp.c
@@ -189,12 +189,12 @@ main (int argc, char **argv)
       return 1;
     }
 
-  fb = COGL_FRAMEBUFFER (onscreen);
-  cogl_push_framebuffer (fb);
+  fb = onscreen;
 
   for (;;)
     {
       unsigned long pixel;
+      CoglPipeline *pipeline;
 
       while (XPending (xdpy))
         {
@@ -221,8 +221,10 @@ main (int argc, char **argv)
       XFlush (xdpy);
 
       cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
-      cogl_set_source_texture (COGL_TEXTURE (tfp));
-      cogl_rectangle (-0.8, 0.8, 0.8, -0.8);
+      pipeline = cogl_pipeline_new (ctx);
+      cogl_pipeline_set_layer_texture (pipeline, 0, tfp);
+      cogl_framebuffer_draw_rectangle (fb, pipeline, -0.8, 0.8, 0.8, -0.8);
+      cogl_object_unref (pipeline);
       cogl_onscreen_swap_buffers (onscreen);
     }
 
diff --git a/examples/cogland.c b/examples/cogland.c
index 3d7c553..eb4a92b 100644
--- a/examples/cogland.c
+++ b/examples/cogland.c
@@ -385,11 +385,9 @@ paint_cb (void *user_data)
   for (l = compositor->outputs; l; l = l->next)
     {
       CoglandOutput *output = l->data;
-      CoglFramebuffer *fb = COGL_FRAMEBUFFER (output->onscreen);
+      CoglFramebuffer *fb = output->onscreen;
       GList *l2;
 
-      cogl_push_framebuffer (fb);
-
       cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
 
       cogl_primitive_draw (compositor->triangle,
@@ -402,13 +400,14 @@ paint_cb (void *user_data)
           if (surface->texture)
             {
               CoglTexture2D *texture = surface->texture;
-              cogl_set_source_texture (COGL_TEXTURE (texture));
-              cogl_rectangle (-1, 1, 1, -1);
+              CoglPipeline *pipeline =
+                cogl_pipeline_new (compositor->cogl_context);
+              cogl_pipeline_set_layer_texture (pipeline, 0, texture);
+              cogl_framebuffer_draw_rectangle (fb, pipeline, -1, 1, 1, -1);
+              cogl_object_unref (pipeline);
             }
         }
       cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb));
-
-      cogl_pop_framebuffer ();
     }
 
   while (!wl_list_empty (&compositor->frame_callbacks))
@@ -473,7 +472,7 @@ surface_damaged (CoglandSurface *surface,
               format = COGL_PIXEL_FORMAT_ARGB_8888;
             }
 
-          cogl_texture_set_region (COGL_TEXTURE (surface->texture),
+          cogl_texture_set_region (surface->texture,
                                    x, y, /* src_x/y */
                                    x, y, /* dst_x/y */
                                    width, height, /* dst_width/height */
@@ -634,7 +633,7 @@ cogland_surface_commit (struct wl_client *client,
       !region_is_empty (&surface->pending.damage))
     {
       CoglandRegion *region = &surface->pending.damage;
-      CoglTexture *texture = COGL_TEXTURE (surface->texture);
+      CoglTexture *texture = surface->texture;
 
       if (region->x2 > cogl_texture_get_width (texture))
         region->x2 = cogl_texture_get_width (texture);
@@ -885,7 +884,7 @@ cogland_compositor_create_output (CoglandCompositor *compositor,
                                         width_mm, height_mm);
   /* Eventually there will be an implicit allocate on first use so this
    * will become optional... */
-  fb = COGL_FRAMEBUFFER (output->onscreen);
+  fb = output->onscreen;
   if (!cogl_framebuffer_allocate (fb, &error))
     g_error ("Failed to allocate framebuffer: %s\n", error->message);
 
@@ -895,7 +894,8 @@ cogland_compositor_create_output (CoglandCompositor *compositor,
                                     NULL /* destroy */);
 
   cogl_onscreen_show (output->onscreen);
-  cogl_framebuffer_set_viewport (fb, -x, -y,
+  cogl_framebuffer_set_viewport (fb,
+                                 -x, -y,
                                  compositor->virtual_width,
                                  compositor->virtual_height);
 
diff --git a/test-fixtures/test-utils.h b/test-fixtures/test-utils.h
index 8449df2..9093fa8 100644
--- a/test-fixtures/test-utils.h
+++ b/test-fixtures/test-utils.h
@@ -1,6 +1,13 @@
 #ifndef _TEST_UTILS_H_
 #define _TEST_UTILS_H_
 
+/* NB: This header is for private and public api testing and so
+ * we need consider that if we are testing the public api we should
+ * just include <cogl/cogl.h> but since that will only provide
+ * opaque typedefs we need to include the specific internal headers
+ * for testing private apis...
+ */
+#ifdef COGL_COMPILATION
 #include <cogl/cogl-context.h>
 #include <cogl/cogl-onscreen.h>
 #include <cogl/cogl-offscreen.h>
@@ -9,6 +16,10 @@
 #include <cogl/cogl-texture-2d-sliced.h>
 #include <cogl/cogl-meta-texture.h>
 #include <cogl/cogl-atlas-texture.h>
+#else
+#include <cogl/cogl.h>
+#endif
+
 #include <glib.h>
 
 /* We don't really care about functions that are defined without a
diff --git a/tests/conform/Makefile.am b/tests/conform/Makefile.am
index 633507a..6c6f368 100644
--- a/tests/conform/Makefile.am
+++ b/tests/conform/Makefile.am
@@ -137,8 +137,7 @@ endif
 AM_CPPFLAGS += \
        -DCOGL_ENABLE_EXPERIMENTAL_API \
        -DCOGL_DISABLE_DEPRECATED \
-       -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" \
-       -DCOGL_COMPILATION
+       -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\"
 
 test_conformance_CFLAGS = -g3 -O0 $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS)
 test_conformance_LDADD = \
diff --git a/tests/conform/test-alpha-test.c b/tests/conform/test-alpha-test.c
index 285118b..f164ede 100644
--- a/tests/conform/test-alpha-test.c
+++ b/tests/conform/test-alpha-test.c
@@ -24,7 +24,7 @@ create_texture (CoglContext *context)
 void
 test_alpha_test (void)
 {
-  CoglTexture *tex = COGL_TEXTURE (create_texture (test_ctx));
+  CoglTexture *tex = create_texture (test_ctx);
   CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
   int fb_width = cogl_framebuffer_get_width (test_fb);
   int fb_height = cogl_framebuffer_get_height (test_fb);
diff --git a/tests/conform/test-alpha-textures.c b/tests/conform/test-alpha-textures.c
index 9063b80..28915cf 100644
--- a/tests/conform/test-alpha-textures.c
+++ b/tests/conform/test-alpha-textures.c
@@ -39,10 +39,10 @@ create_pipeline (CoglTexture **tex_out,
 
   cogl_pipeline_set_layer_texture (pipeline,
                                    0, /* layer */
-                                   COGL_TEXTURE (tex));
+                                   tex);
 
   *pipeline_out = pipeline;
-  *tex_out = COGL_TEXTURE (tex);
+  *tex_out = tex;
 }
 
 void
diff --git a/tests/conform/test-backface-culling.c b/tests/conform/test-backface-culling.c
index e530e40..0a0e521 100644
--- a/tests/conform/test-backface-culling.c
+++ b/tests/conform/test-backface-culling.c
@@ -298,7 +298,7 @@ test_backface_culling (void)
                                           TEST_UTILS_TEXTURE_NO_SLICING,
                                           COGL_PIXEL_FORMAT_ANY); /* internal
                                                                      format */
-  state.offscreen = COGL_FRAMEBUFFER (cogl_offscreen_new_with_texture (tex));
+  state.offscreen = cogl_offscreen_new_with_texture (tex);
   state.offscreen_tex = tex;
 
   paint (&state);
diff --git a/tests/conform/test-color-hsl.c b/tests/conform/test-color-hsl.c
index 909d875..651ce52 100644
--- a/tests/conform/test-color-hsl.c
+++ b/tests/conform/test-color-hsl.c
@@ -27,18 +27,18 @@ test_color_hsl (void)
   memset(&color, 0, sizeof (CoglColor));
   cogl_color_init_from_hsl(&color, hue, saturation, luminance);
 
-  g_assert_cmpint (color.red, ==, 108);
-  g_assert_cmpint (color.green, ==, 198);
-  g_assert_cmpint (color.blue, ==, 78);
-  g_assert_cmpint (color.alpha, ==, 255);
+  g_assert_cmpint (cogl_color_get_red_byte (&color), ==, 108);
+  g_assert_cmpint (cogl_color_get_green_byte (&color), ==, 198);
+  g_assert_cmpint (cogl_color_get_blue_byte (&color), ==, 78);
+  g_assert_cmpint (cogl_color_get_alpha_byte (&color), ==, 255);
 
   memset(&color, 0, sizeof (CoglColor));
   cogl_color_init_from_hsl(&color, hue, 0, luminance);
 
-  cogl_assert_float(color.red / 255.0f, luminance);
-  cogl_assert_float(color.green / 255.0f, luminance);
-  cogl_assert_float(color.blue / 255.0f, luminance);
-  cogl_assert_float(color.alpha / 255.0f, 1.0f);
+  cogl_assert_float (cogl_color_get_red_float (&color), luminance);
+  cogl_assert_float (cogl_color_get_green_float (&color), luminance);
+  cogl_assert_float (cogl_color_get_blue_float (&color), luminance);
+  cogl_assert_float (cogl_color_get_alpha_float (&color), 1.0f);
 
   if (cogl_test_verbose ())
     g_print ("OK\n");
diff --git a/tests/conform/test-color-mask.c b/tests/conform/test-color-mask.c
index 5df6527..de8f1c8 100644
--- a/tests/conform/test-color-mask.c
+++ b/tests/conform/test-color-mask.c
@@ -86,8 +86,7 @@ test_color_mask (void)
                                                  COGL_PIXEL_FORMAT_RGB_888);
 
 
-      state.fbo[i] = COGL_FRAMEBUFFER (
-        cogl_offscreen_new_with_texture (state.tex[i]));
+      state.fbo[i] = cogl_offscreen_new_with_texture (state.tex[i]);
 
       /* Clear the texture color bits */
       cogl_framebuffer_clear4f (state.fbo[i],
diff --git a/tests/conform/test-copy-replace-texture.c b/tests/conform/test-copy-replace-texture.c
index 7d5ab48..47b0ae8 100644
--- a/tests/conform/test-copy-replace-texture.c
+++ b/tests/conform/test-copy-replace-texture.c
@@ -51,7 +51,7 @@ create_texture (void)
 
   texture_num++;
 
-  return COGL_TEXTURE (tex_2d);
+  return tex_2d;
 }
 
 void
diff --git a/tests/conform/test-fence.c b/tests/conform/test-fence.c
index 2390b71..d5e3586 100644
--- a/tests/conform/test-fence.c
+++ b/tests/conform/test-fence.c
@@ -6,7 +6,6 @@
 
 #include "test-utils.h"
 #include "config.h"
-#include <cogl/cogl-util.h>
 
 /* I'm writing this on the train after having dinner at a churrascuria. */
 #define MAGIC_CHUNK_O_DATA ((void *) 0xdeadbeef)
diff --git a/tests/conform/test-framebuffer-get-bits.c b/tests/conform/test-framebuffer-get-bits.c
index f1a85b2..c4a1dc4 100644
--- a/tests/conform/test-framebuffer-get-bits.c
+++ b/tests/conform/test-framebuffer-get-bits.c
@@ -10,15 +10,15 @@ test_framebuffer_get_bits (void)
                                    16, 16, /* width/height */
                                    COGL_PIXEL_FORMAT_A_8);
   CoglOffscreen *offscreen_a =
-    cogl_offscreen_new_with_texture (COGL_TEXTURE (tex_a));
-  CoglFramebuffer *fb_a = COGL_FRAMEBUFFER (offscreen_a);
+    cogl_offscreen_new_with_texture (tex_a);
+  CoglFramebuffer *fb_a = offscreen_a;
   CoglTexture2D *tex_rgba =
     cogl_texture_2d_new_with_size (test_ctx,
                                    16, 16, /* width/height */
                                    COGL_PIXEL_FORMAT_RGBA_8888);
   CoglOffscreen *offscreen_rgba =
-    cogl_offscreen_new_with_texture (COGL_TEXTURE (tex_rgba));
-  CoglFramebuffer *fb_rgba = COGL_FRAMEBUFFER (offscreen_rgba);
+    cogl_offscreen_new_with_texture (tex_rgba);
+  CoglFramebuffer *fb_rgba = offscreen_rgba;
 
   cogl_framebuffer_allocate (fb_a, NULL);
   cogl_framebuffer_allocate (fb_rgba, NULL);
diff --git a/tests/conform/test-gles2-context.c b/tests/conform/test-gles2-context.c
index 6b171c0..59db99f 100644
--- a/tests/conform/test-gles2-context.c
+++ b/tests/conform/test-gles2-context.c
@@ -23,11 +23,11 @@ test_push_pop_single_context (void)
   const CoglGLES2Vtable *gles2;
   CoglError *error = NULL;
 
-  offscreen_texture = COGL_TEXTURE (
+  offscreen_texture =
     cogl_texture_2d_new_with_size (test_ctx,
                                    cogl_framebuffer_get_width (test_fb),
                                    cogl_framebuffer_get_height (test_fb),
-                                   COGL_PIXEL_FORMAT_ANY));
+                                   COGL_PIXEL_FORMAT_ANY);
   offscreen = cogl_offscreen_new_with_texture (offscreen_texture);
 
   pipeline = cogl_pipeline_new (test_ctx);
@@ -67,8 +67,8 @@ test_push_pop_single_context (void)
 
   if (!cogl_push_gles2_context (test_ctx,
                                 gles2_ctx,
-                                COGL_FRAMEBUFFER (offscreen),
-                                COGL_FRAMEBUFFER (offscreen),
+                                offscreen,
+                                offscreen,
                                 &error))
     {
       g_error ("Failed to push gles2 context: %s\n", error->message);
@@ -94,8 +94,8 @@ test_push_pop_single_context (void)
    */
   if (!cogl_push_gles2_context (test_ctx,
                                 gles2_ctx,
-                                COGL_FRAMEBUFFER (offscreen),
-                                COGL_FRAMEBUFFER (offscreen),
+                                offscreen,
+                                offscreen,
                                 &error))
     {
       g_error ("Failed to push gles2 context: %s\n", error->message);
@@ -147,11 +147,11 @@ create_gles2_context (CoglTexture **offscreen_texture,
 {
   CoglError *error = NULL;
 
-  *offscreen_texture = COGL_TEXTURE (
+  *offscreen_texture =
     cogl_texture_2d_new_with_size (test_ctx,
                                    cogl_framebuffer_get_width (test_fb),
                                    cogl_framebuffer_get_height (test_fb),
-                                   COGL_PIXEL_FORMAT_ANY));
+                                   COGL_PIXEL_FORMAT_ANY);
   *offscreen = cogl_offscreen_new_with_texture (*offscreen_texture);
 
   *pipeline = cogl_pipeline_new (test_ctx);
@@ -195,8 +195,8 @@ test_push_pop_multi_context (void)
 
   if (!cogl_push_gles2_context (test_ctx,
                                 gles2_ctx0,
-                                COGL_FRAMEBUFFER (offscreen0),
-                                COGL_FRAMEBUFFER (offscreen0),
+                                offscreen0,
+                                offscreen0,
                                 &error))
     {
       g_error ("Failed to push gles2 context 0: %s\n", error->message);
@@ -207,8 +207,8 @@ test_push_pop_multi_context (void)
 
   if (!cogl_push_gles2_context (test_ctx,
                                 gles2_ctx1,
-                                COGL_FRAMEBUFFER (offscreen1),
-                                COGL_FRAMEBUFFER (offscreen1),
+                                offscreen1,
+                                offscreen1,
                                 &error))
     {
       g_error ("Failed to push gles2 context 1: %s\n", error->message);
@@ -290,8 +290,8 @@ test_gles2_read_pixels (void)
 
   if (!cogl_push_gles2_context (test_ctx,
                                 gles2_ctx,
-                                COGL_FRAMEBUFFER (offscreen),
-                                COGL_FRAMEBUFFER (offscreen),
+                                offscreen,
+                                offscreen,
                                 &error))
     {
       g_error ("Failed to push gles2 context: %s\n", error->message);
@@ -328,7 +328,7 @@ test_gles2_read_pixels (void)
   /* Bind different read and write buffers */
   if (!cogl_push_gles2_context (test_ctx,
                                 gles2_ctx,
-                                COGL_FRAMEBUFFER (offscreen),
+                                offscreen,
                                 test_fb,
                                 &error))
     {
@@ -349,7 +349,7 @@ test_gles2_read_pixels (void)
   if (!cogl_push_gles2_context (test_ctx,
                                 gles2_ctx,
                                 test_fb,
-                                COGL_FRAMEBUFFER (offscreen),
+                                offscreen,
                                 &error))
     {
       g_error ("Failed to push gles2 context: %s\n", error->message);
@@ -682,8 +682,8 @@ test_gles2_context_fbo (void)
 
       if (!cogl_push_gles2_context (test_ctx,
                                     gles2_ctx,
-                                    COGL_FRAMEBUFFER (offscreen),
-                                    COGL_FRAMEBUFFER (offscreen),
+                                    offscreen,
+                                    offscreen,
                                     &error))
         g_error ("Failed to push gles2 context: %s\n", error->message);
 
@@ -817,8 +817,8 @@ test_gles2_context_copy_tex_image (void)
 
   if (!cogl_push_gles2_context (test_ctx,
                                 gles2_ctx,
-                                COGL_FRAMEBUFFER (offscreen),
-                                COGL_FRAMEBUFFER (offscreen),
+                                offscreen,
+                                offscreen,
                                 &error))
     g_error ("Failed to push gles2 context: %s\n", error->message);
 
diff --git a/tests/conform/test-map-buffer-range.c b/tests/conform/test-map-buffer-range.c
index a9c136b..e3f7b39 100644
--- a/tests/conform/test-map-buffer-range.c
+++ b/tests/conform/test-map-buffer-range.c
@@ -44,7 +44,7 @@ test_map_buffer_range (void)
 
   pipeline = cogl_pipeline_new (test_ctx);
 
-  cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (tex));
+  cogl_pipeline_set_layer_texture (pipeline, 0, tex);
   cogl_pipeline_set_layer_filters (pipeline,
                                    0, /* layer */
                                    COGL_PIPELINE_FILTER_NEAREST,
@@ -62,7 +62,7 @@ test_map_buffer_range (void)
 
   /* Replace the texture coordinates of the third vertex with the
    * coordinates for a green texel */
-  data = cogl_buffer_map_range (COGL_BUFFER (buffer),
+  data = cogl_buffer_map_range (buffer,
                                 sizeof (vertex_data[0]) * 2,
                                 sizeof (vertex_data[0]),
                                 COGL_BUFFER_ACCESS_WRITE,
@@ -75,7 +75,7 @@ test_map_buffer_range (void)
   data->s = 1.0f;
   data->t = 0.0f;
 
-  cogl_buffer_unmap (COGL_BUFFER (buffer));
+  cogl_buffer_unmap (buffer);
 
   pos_attribute =
     cogl_attribute_new (buffer,
diff --git a/tests/conform/test-offscreen.c b/tests/conform/test-offscreen.c
index cd1ae4a..fd7e68f 100644
--- a/tests/conform/test-offscreen.c
+++ b/tests/conform/test-offscreen.c
@@ -48,7 +48,7 @@ test_paint (TestState *state)
                                           state->fb_width,
                                           state->fb_height,
                                           COGL_PIXEL_FORMAT_RGBA_8888_PRE);
-  tex = COGL_TEXTURE (tex_2d);
+  tex = tex_2d;
 
   offscreen = cogl_offscreen_new_with_texture (tex);
 
@@ -66,7 +66,7 @@ test_paint (TestState *state)
   cogl_translate (0.5, 0.5, 0);
   cogl_scale (-0.5, 0.5, 1);
 
-  cogl_push_framebuffer (COGL_FRAMEBUFFER (offscreen));
+  cogl_push_framebuffer (offscreen);
 
   /* Cogl should release the last reference when we call cogl_pop_framebuffer()
    */
@@ -129,11 +129,11 @@ test_flush (TestState *state)
       tex_2d = cogl_texture_2d_new_with_size (test_ctx,
                                               16, 16, /* width/height */
                                               COGL_PIXEL_FORMAT_RGBA_8888_PRE);
-      tex = COGL_TEXTURE (tex_2d);
+      tex = tex_2d;
 
       offscreen = cogl_offscreen_new_with_texture (tex);
 
-      cogl_push_framebuffer (COGL_FRAMEBUFFER (offscreen));
+      cogl_push_framebuffer (offscreen);
 
       cogl_color_init_from_4ub (&clear_color, 0, 0, 0, 255);
       cogl_clear (&clear_color, COGL_BUFFER_BIT_COLOR);
@@ -143,7 +143,7 @@ test_flush (TestState *state)
 
       if (i == 0)
         /* First time check using read pixels on the offscreen */
-        test_utils_check_region (COGL_FRAMEBUFFER (offscreen),
+        test_utils_check_region (offscreen,
                                  1, 1, 15, 15, 0xff0000ff);
       else if (i == 1)
         {
diff --git a/tests/conform/test-pipeline-cache-unrefs-texture.c 
b/tests/conform/test-pipeline-cache-unrefs-texture.c
index ccd02e7..f00a4cb 100644
--- a/tests/conform/test-pipeline-cache-unrefs-texture.c
+++ b/tests/conform/test-pipeline-cache-unrefs-texture.c
@@ -37,7 +37,7 @@ create_texture (void)
                              GINT_TO_POINTER (1),
                              free_texture_cb);
 
-  return COGL_TEXTURE (tex_2d);
+  return tex_2d;
 }
 
 void
diff --git a/tests/conform/test-pipeline-shader-state.c b/tests/conform/test-pipeline-shader-state.c
index 790b43a..5ac7b09 100644
--- a/tests/conform/test-pipeline-shader-state.c
+++ b/tests/conform/test-pipeline-shader-state.c
@@ -24,8 +24,8 @@ test_pipeline_shader_state (void)
 
   tex = cogl_texture_2d_new_with_size (test_ctx,
                                        128, 128, COGL_PIXEL_FORMAT_ANY);
-  offscreen = cogl_offscreen_new_with_texture (COGL_TEXTURE (tex));
-  fb = COGL_FRAMEBUFFER (offscreen);
+  offscreen = cogl_offscreen_new_with_texture (tex);
+  fb = offscreen;
   cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
   cogl_object_unref (offscreen);
 
@@ -35,7 +35,7 @@ test_pipeline_shader_state (void)
   /* Setup a template pipeline... */
 
   base_pipeline = cogl_pipeline_new (test_ctx);
-  cogl_pipeline_set_layer_texture (base_pipeline, 1, COGL_TEXTURE (tex));
+  cogl_pipeline_set_layer_texture (base_pipeline, 1, tex);
   cogl_pipeline_set_color4f (base_pipeline, 1, 0, 0, 1);
 
 
@@ -69,7 +69,7 @@ test_pipeline_shader_state (void)
    * cached vertex shader gets invalidated.
    */
 
-  cogl_pipeline_set_layer_texture (base_pipeline, 0, COGL_TEXTURE (tex));
+  cogl_pipeline_set_layer_texture (base_pipeline, 0, tex);
 
 
   /* Now we derive another pipeline from base_pipeline to verify that
diff --git a/tests/conform/test-pixel-buffer.c b/tests/conform/test-pixel-buffer.c
index 24de2e4..9323806 100644
--- a/tests/conform/test-pixel-buffer.c
+++ b/tests/conform/test-pixel-buffer.c
@@ -39,7 +39,7 @@ create_bitmap (void)
                                       BITMAP_SIZE,
                                       BITMAP_SIZE,
                                       COGL_PIXEL_FORMAT_RGBA_8888);
-  buffer = COGL_BUFFER (cogl_bitmap_get_buffer (bitmap));
+  buffer = cogl_bitmap_get_buffer (bitmap);
 
   g_assert (cogl_is_pixel_buffer (buffer));
   g_assert (cogl_is_buffer (buffer));
@@ -56,7 +56,7 @@ static CoglBitmap *
 create_and_fill_bitmap (void)
 {
   CoglBitmap *bitmap = create_bitmap ();
-  CoglBuffer *buffer = COGL_BUFFER (cogl_bitmap_get_buffer (bitmap));
+  CoglBuffer *buffer = cogl_bitmap_get_buffer (bitmap);
   uint8_t *map;
   unsigned int stride;
 
@@ -69,7 +69,7 @@ create_and_fill_bitmap (void)
 
   generate_bitmap_data (map, stride);
 
-  cogl_buffer_unmap (COGL_BUFFER (buffer));
+  cogl_buffer_unmap (buffer);
 
   return bitmap;
 }
@@ -85,7 +85,7 @@ create_texture_from_bitmap (CoglBitmap *bitmap)
 
   g_assert (texture != NULL);
 
-  return COGL_TEXTURE (texture);
+  return texture;
 }
 
 static CoglPipeline *
@@ -168,7 +168,7 @@ void
 test_pixel_buffer_set_data (void)
 {
   CoglBitmap *bitmap = create_bitmap ();
-  CoglBuffer *buffer = COGL_BUFFER (cogl_bitmap_get_buffer (bitmap));
+  CoglBuffer *buffer = cogl_bitmap_get_buffer (bitmap);
   CoglPipeline *pipeline;
   CoglTexture *texture;
   uint8_t *data;
@@ -228,7 +228,7 @@ create_white_texture (void)
 
   g_free (data);
 
-  return COGL_TEXTURE (texture);
+  return texture;
 }
 
 void
diff --git a/tests/conform/test-point-sprite.c b/tests/conform/test-point-sprite.c
index c49dca1..d538281 100644
--- a/tests/conform/test-point-sprite.c
+++ b/tests/conform/test-point-sprite.c
@@ -59,7 +59,7 @@ do_test (CoglBool check_orientation,
   g_assert (error == NULL);
 
   pipeline = cogl_pipeline_new (test_ctx);
-  cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (tex_2d));
+  cogl_pipeline_set_layer_texture (pipeline, 0, tex_2d);
 
   cogl_pipeline_set_layer_filters (pipeline,
                                    0, /* layer_index */
diff --git a/tests/conform/test-premult.c b/tests/conform/test-premult.c
index 38761e2..8c29111 100644
--- a/tests/conform/test-premult.c
+++ b/tests/conform/test-premult.c
@@ -57,7 +57,7 @@ make_texture (uint32_t color,
 
   g_free (tex_data);
 
-  return COGL_TEXTURE (tex_2d);
+  return tex_2d;
 }
 
 static void
@@ -97,7 +97,7 @@ check_texture (CoglPipeline *pipeline,
   cogl_pop_framebuffer ();
 
   /* New API */
-  cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (tex));
+  cogl_pipeline_set_layer_texture (pipeline, 0, tex);
   cogl_framebuffer_draw_rectangle (test_fb, pipeline,
                                   x * QUAD_WIDTH,
                                   y * QUAD_WIDTH,
diff --git a/tests/conform/test-read-texture-formats.c b/tests/conform/test-read-texture-formats.c
index 9f6c410..31c70f9 100644
--- a/tests/conform/test-read-texture-formats.c
+++ b/tests/conform/test-read-texture-formats.c
@@ -17,7 +17,7 @@ test_read_byte (CoglTexture2D *tex_2d,
 {
   uint8_t received_byte;
 
-  cogl_texture_get_data (COGL_TEXTURE (tex_2d),
+  cogl_texture_get_data (tex_2d,
                          format,
                          1, /* rowstride */
                          &received_byte);
@@ -38,7 +38,7 @@ test_read_short (CoglTexture2D *tex_2d,
   char *expected_value_str;
   int bits_sum = 0;
 
-  cogl_texture_get_data (COGL_TEXTURE (tex_2d),
+  cogl_texture_get_data (tex_2d,
                          format,
                          2, /* rowstride */
                          (uint8_t *) &received_value);
@@ -71,7 +71,7 @@ test_read_888 (CoglTexture2D *tex_2d,
 {
   uint8_t pixel[4];
 
-  cogl_texture_get_data (COGL_TEXTURE (tex_2d),
+  cogl_texture_get_data (tex_2d,
                          format,
                          4, /* rowstride */
                          pixel);
@@ -88,7 +88,7 @@ test_read_8888 (CoglTexture2D *tex_2d,
   char *received_value_str;
   char *expected_value_str;
 
-  cogl_texture_get_data (COGL_TEXTURE (tex_2d),
+  cogl_texture_get_data (tex_2d,
                          format,
                          4, /* rowstride */
                          (uint8_t *) &received_pixel);
@@ -115,7 +115,7 @@ test_read_int (CoglTexture2D *tex_2d,
   char *expected_value_str;
   int bits_sum = 0;
 
-  cogl_texture_get_data (COGL_TEXTURE (tex_2d),
+  cogl_texture_get_data (tex_2d,
                          format,
                          4, /* rowstride */
                          (uint8_t *) &received_value);
diff --git a/tests/conform/test-sub-texture.c b/tests/conform/test-sub-texture.c
index 592690a..fc97b0f 100644
--- a/tests/conform/test-sub-texture.c
+++ b/tests/conform/test-sub-texture.c
@@ -105,14 +105,14 @@ paint (TestState *state)
 
   /* Create a sub texture of the bottom right quarter of the texture */
   sub_texture = cogl_sub_texture_new (test_ctx,
-                                      COGL_TEXTURE (state->tex),
+                                      state->tex,
                                       DIVISION_WIDTH,
                                       DIVISION_HEIGHT,
                                       DIVISION_WIDTH,
                                       DIVISION_HEIGHT);
 
   /* Paint it */
-  cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (sub_texture));
+  cogl_pipeline_set_layer_texture (pipeline, 0, sub_texture);
   cogl_object_unref (sub_texture);
   cogl_framebuffer_draw_rectangle (test_fb, pipeline,
                                    0.0f, 0.0f, DIVISION_WIDTH, DIVISION_HEIGHT);
@@ -122,11 +122,11 @@ paint (TestState *state)
      documented to be undefined so it doesn't technically have to work
      but it will with the current implementation */
   sub_texture = cogl_sub_texture_new (test_ctx,
-                                      COGL_TEXTURE (state->tex),
+                                      state->tex,
                                       0, 0,
                                       SOURCE_SIZE,
                                       DIVISION_HEIGHT);
-  cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (sub_texture));
+  cogl_pipeline_set_layer_texture (pipeline, 0, sub_texture);
   cogl_object_unref (sub_texture);
   cogl_framebuffer_draw_textured_rectangle (test_fb, pipeline,
                                             0.0f,
@@ -139,14 +139,14 @@ paint (TestState *state)
   /* Create a sub texture of a sub texture */
   full_texture = create_test_texture (state);
   sub_texture = cogl_sub_texture_new (test_ctx,
-                                      COGL_TEXTURE (full_texture),
+                                      full_texture,
                                       20, 10, 30, 20);
   cogl_object_unref (full_texture);
   sub_sub_texture = cogl_sub_texture_new (test_ctx,
-                                          COGL_TEXTURE (sub_texture),
+                                          sub_texture,
                                           20, 10, 10, 10);
   cogl_object_unref (sub_texture);
-  cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (sub_sub_texture));
+  cogl_pipeline_set_layer_texture (pipeline, 0, sub_sub_texture);
   cogl_object_unref (sub_sub_texture);
   cogl_framebuffer_draw_rectangle (test_fb, pipeline,
                                    0.0f, SOURCE_SIZE * 2.0f,
@@ -231,15 +231,15 @@ validate_result (TestState *state)
 
   /* Try reading back the texture data */
   sub_texture = cogl_sub_texture_new (test_ctx,
-                                      COGL_TEXTURE (state->tex),
+                                      state->tex,
                                       SOURCE_SIZE / 4,
                                       SOURCE_SIZE / 4,
                                       SOURCE_SIZE / 2,
                                       SOURCE_SIZE / 2);
-  tex_width = cogl_texture_get_width (COGL_TEXTURE (sub_texture));
-  tex_height = cogl_texture_get_height (COGL_TEXTURE (sub_texture));
+  tex_width = cogl_texture_get_width (sub_texture);
+  tex_height = cogl_texture_get_height (sub_texture);
   p = texture_data = g_malloc (tex_width * tex_height * 4);
-  cogl_texture_get_data (COGL_TEXTURE (sub_texture),
+  cogl_texture_get_data (sub_texture,
                          COGL_PIXEL_FORMAT_RGBA_8888,
                          tex_width * 4,
                          texture_data);
@@ -262,11 +262,11 @@ validate_result (TestState *state)
   test_tex = create_test_texture (state);
   /* Create a sub texture the views the center half of the texture */
   sub_texture = cogl_sub_texture_new (test_ctx,
-                                      COGL_TEXTURE (test_tex),
+                                      test_tex,
                                       64, 64, 128, 128);
   /* Update the center half of the sub texture */
   texture_data = create_update_data ();
-  cogl_texture_set_region (COGL_TEXTURE (sub_texture),
+  cogl_texture_set_region (sub_texture,
                            0, 0, 32, 32, 64, 64, 256, 256,
                            COGL_PIXEL_FORMAT_RGBA_8888_PRE, 256 * 4,
                            texture_data);
@@ -274,7 +274,7 @@ validate_result (TestState *state)
   cogl_object_unref (sub_texture);
   /* Get the texture data */
   p = texture_data = g_malloc (256 * 256 * 4);
-  cogl_texture_get_data (COGL_TEXTURE (test_tex),
+  cogl_texture_get_data (test_tex,
                          COGL_PIXEL_FORMAT_RGBA_8888_PRE,
                          256 * 4, texture_data);
 
diff --git a/tests/conform/test-texture-3d.c b/tests/conform/test-texture-3d.c
index 894477f..ca66439 100644
--- a/tests/conform/test-texture-3d.c
+++ b/tests/conform/test-texture-3d.c
@@ -73,7 +73,7 @@ create_texture_3d (CoglContext *context)
 static void
 draw_frame (TestState *state)
 {
-  CoglTexture *tex = COGL_TEXTURE (create_texture_3d (test_ctx));
+  CoglTexture *tex = create_texture_3d (test_ctx);
   CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
   typedef struct { float x, y, s, t, r; } Vert;
   CoglPrimitive *primitive;
@@ -221,7 +221,7 @@ test_multi_texture (TestState *state)
                                           4, /* rowstride */
                                           tex_data,
                                           NULL);
-  cogl_pipeline_set_layer_texture (pipeline, 0, COGL_TEXTURE (tex_2d));
+  cogl_pipeline_set_layer_texture (pipeline, 0, tex_2d);
 
   tex_data[0] = 0x00;
   tex_data[1] = 0xff;
@@ -235,7 +235,7 @@ test_multi_texture (TestState *state)
                                           4, /* image_stride */
                                           tex_data,
                                           NULL);
-  cogl_pipeline_set_layer_texture (pipeline, 1, COGL_TEXTURE (tex_3d));
+  cogl_pipeline_set_layer_texture (pipeline, 1, tex_3d);
 
   cogl_pipeline_set_layer_combine (pipeline, 0,
                                    "RGBA = REPLACE(PREVIOUS)",
diff --git a/tests/conform/test-texture-no-allocate.c b/tests/conform/test-texture-no-allocate.c
index ad30e77..9a0a756 100644
--- a/tests/conform/test-texture-no-allocate.c
+++ b/tests/conform/test-texture-no-allocate.c
@@ -26,7 +26,7 @@ test_texture_no_allocate (void)
 
   /* Try to create an atlas texture that is too big so it will
    * internally be freed without allocating */
-  texture = COGL_TEXTURE (
+  texture =
     cogl_atlas_texture_new_from_data (test_ctx,
                                       BIG_TEX_WIDTH,
                                       BIG_TEX_HEIGHT,
@@ -37,7 +37,7 @@ test_texture_no_allocate (void)
                                       /* rowstride */
                                       BIG_TEX_WIDTH * 4,
                                       tex_data,
-                                      &error));
+                                      &error);
 
   g_free (tex_data);
 
@@ -50,12 +50,12 @@ test_texture_no_allocate (void)
     cogl_object_unref (texture);
 
   /* Try to create a sliced texture without allocating it */
-  texture = COGL_TEXTURE (
+  texture =
     cogl_texture_2d_sliced_new_with_size (test_ctx,
                                           BIG_TEX_WIDTH,
                                           BIG_TEX_HEIGHT,
                                           COGL_TEXTURE_MAX_WASTE,
-                                          COGL_PIXEL_FORMAT_RGBA_8888_PRE));
+                                          COGL_PIXEL_FORMAT_RGBA_8888_PRE);
   cogl_object_unref (texture);
 
   /* 2D texture */
diff --git a/tests/conform/test-version.c b/tests/conform/test-version.c
index f1d9de9..b651165 100644
--- a/tests/conform/test-version.c
+++ b/tests/conform/test-version.c
@@ -6,7 +6,15 @@
 
 #include "test-utils.h"
 #include "config.h"
+
+/* So we can use _COGL_STATIC_ASSERT we include the internal
+ * cogl-util.h header. Since internal headers explicitly guard against
+ * applications including them directly instead of including
+ * <cogl/cogl.h> we define __COGL_H_INSIDE__ here to subvert those
+ * guards in this case... */
+#define __COGL_H_INSIDE__
 #include <cogl/cogl-util.h>
+#undef __COGL_H_INSIDE__
 
 _COGL_STATIC_ASSERT (COGL_VERSION_ENCODE (COGL_VERSION_MAJOR,
                                           COGL_VERSION_MINOR,
diff --git a/tests/conform/test-wrap-rectangle-textures.c b/tests/conform/test-wrap-rectangle-textures.c
index bb8bf69..4274c98 100644
--- a/tests/conform/test-wrap-rectangle-textures.c
+++ b/tests/conform/test-wrap-rectangle-textures.c
@@ -40,7 +40,7 @@ create_base_pipeline (void)
 
   cogl_pipeline_set_layer_texture (pipeline,
                                    0, /* layer */
-                                   COGL_TEXTURE (tex));
+                                   tex);
 
   cogl_object_unref (tex);
 
diff --git a/tests/micro-perf/test-journal.c b/tests/micro-perf/test-journal.c
index a96fa3e..35e3cd5 100644
--- a/tests/micro-perf/test-journal.c
+++ b/tests/micro-perf/test-journal.c
@@ -153,7 +153,7 @@ main (int argc, char **argv)
   cogl_onscreen_set_swap_throttled (onscreen, FALSE);
   cogl_onscreen_show (onscreen);
 
-  data.fb = COGL_FRAMEBUFFER (onscreen);
+  data.fb = onscreen;
   cogl_framebuffer_orthographic (data.fb,
                                  0, 0,
                                  FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]