[cogl/cogl-1.16] Add _primitive_draw to replace _framebuffer_draw_primitive



commit e9f721216e4f7974912b58480e8ca001c82a270a
Author: Robert Bragg <robert linux intel com>
Date:   Tue Jul 9 23:47:29 2013 +0100

    Add _primitive_draw to replace _framebuffer_draw_primitive
    
    When splitting out the CoglPath api we saw that we would be left with
    inconsistent drawing apis if the drawing apis in core Cogl were lumped
    into the cogl_framebuffer_ api considering other Cogl sub-libraries or
    that others will want to create higher level drawing apis outside of
    Cogl but can't use the same namespace.
    
    So that we can aim for a more consistent style this adds a
    cogl_primitive_draw() api, comparable to cogl_path_fill() or
    cogl_pango_show_layout() that's intended to replace
    cogl_framebuffer_draw_primitive()
    
    Note: the attribute and rectangle drawing apis are still in the
    cogl_framebuffer_ namespace and this might potentially change but in
    these cases there is no single object representing the thing being drawn
    so it seems a more reasonable they they live in the framebuffer
    namespace for now.
    
    Note: the cogl_framebuffer_draw_primitive() api isn't removed by this
    patch so it can more conveniently be cherry picked to the 1.16 branch so
    we can mark it deprecated for a short while. Even though it's marked as
    experimental api we know that there are people using the api so we'd
    like to give them a chance to switch to the new api.
    
    Reviewed-by: Neil Roberts <neil linux intel com>
    
    (cherry picked from commit 418912b93ff81a47f9b38114d05335ab76277c48)
    
    Conflicts:
        cogl-pango/cogl-pango-display-list.c
        cogl/Makefile.am
        cogl/cogl-framebuffer.c
        cogl/cogl-pipeline-layer-state.h
        cogl/cogl2-path.c
        cogl/driver/gl/cogl-clip-stack-gl.c

 cogl-pango/cogl-pango-display-list.c               |    6 ++--
 cogl/cogl-bitmap.h                                 |    6 ++-
 cogl/cogl-enum-types.c.in                          |    6 +++
 cogl/cogl-framebuffer-private.h                    |    6 ---
 cogl/cogl-framebuffer.c                            |   31 +----------------
 cogl/cogl-framebuffer.h                            |   24 ++++++------
 cogl/cogl-pixel-buffer.h                           |    6 ++-
 cogl/cogl-primitive-private.h                      |    3 ++
 cogl/cogl-primitive.c                              |   36 ++++++++++++++++++++
 cogl/cogl-primitive.h                              |   25 ++++++++++++++
 cogl/cogl-vertex-buffer.c                          |    9 +++--
 cogl/cogl.symbols                                  |    2 +-
 cogl/driver/gl/cogl-clip-stack-gl.c                |   15 ++++----
 .../cogl-2.0-experimental-sections.txt             |    2 +-
 examples/cogl-crate.c                              |    2 +-
 examples/cogl-emscripten-hello.c                   |    2 +-
 examples/cogl-gles2-context.c                      |    2 +-
 examples/cogl-hello.c                              |    6 ++--
 examples/cogl-msaa.c                               |    4 +-
 examples/cogl-sdl-hello.c                          |    2 +-
 examples/cogl-sdl2-hello.c                         |    2 +-
 examples/cogl-x11-foreign.c                        |    2 +-
 examples/cogland.c                                 |    4 +-
 tests/conform/test-blend.c                         |    4 +-
 tests/conform/test-point-size-attribute.c          |    2 +-
 tests/conform/test-point-size.c                    |    4 +--
 tests/conform/test-point-sprite.c                  |    8 +---
 tests/conform/test-primitive-and-journal.c         |    8 +---
 tests/conform/test-primitive.c                     |    2 +-
 tests/conform/test-texture-3d.c                    |    2 +-
 30 files changed, 133 insertions(+), 100 deletions(-)
---
diff --git a/cogl-pango/cogl-pango-display-list.c b/cogl-pango/cogl-pango-display-list.c
index 6a88bef..e9bb684 100644
--- a/cogl-pango/cogl-pango-display-list.c
+++ b/cogl-pango/cogl-pango-display-list.c
@@ -373,9 +373,9 @@ emit_vertex_buffer_geometry (CoglFramebuffer *fb,
       cogl_object_unref (attributes[1]);
     }
 
-  cogl_framebuffer_draw_primitive (fb,
-                                   pipeline,
-                                   node->d.texture.primitive);
+  cogl_primitive_draw (node->d.texture.primitive,
+                       fb,
+                       pipeline);
 }
 
 static void
diff --git a/cogl/cogl-bitmap.h b/cogl/cogl-bitmap.h
index 4d3eec3..3efe612 100644
--- a/cogl/cogl-bitmap.h
+++ b/cogl/cogl-bitmap.h
@@ -28,6 +28,10 @@
 #ifndef __COGL_BITMAP_H__
 #define __COGL_BITMAP_H__
 
+/* XXX: We forward declare CoglBitmap here to allow for circular
+ * dependencies between some headers */
+typedef struct _CoglBitmap CoglBitmap;
+
 #include <cogl/cogl-types.h>
 #include <cogl/cogl-buffer.h>
 #include <cogl/cogl-context.h>
@@ -39,8 +43,6 @@
 
 COGL_BEGIN_DECLS
 
-typedef struct _CoglBitmap CoglBitmap;
-
 /**
  * SECTION:cogl-bitmap
  * @short_description: Functions for loading images
diff --git a/cogl/cogl-enum-types.c.in b/cogl/cogl-enum-types.c.in
index a77911b..a08711b 100644
--- a/cogl/cogl-enum-types.c.in
+++ b/cogl/cogl-enum-types.c.in
@@ -3,6 +3,12 @@
 #include "config.h"
 #endif
 
+/* We need to undefine this so that we will be sure to include
+ * cogl-path.h instead of cogl2-path.h when we include the framebuffer
+ * header. Otherwise it will include both headers and it won't
+ * compile. */
+#undef COGL_ENABLE_EXPERIMENTAL_2_0_API
+
 #include "cogl-enum-types.h"
 /*** END file-header ***/
 
diff --git a/cogl/cogl-framebuffer-private.h b/cogl/cogl-framebuffer-private.h
index 94310c5..a220de9 100644
--- a/cogl/cogl-framebuffer-private.h
+++ b/cogl/cogl-framebuffer-private.h
@@ -406,12 +406,6 @@ _cogl_framebuffer_restore_clip_stack (CoglFramebuffer *framebuffer);
 void
 _cogl_framebuffer_unref (CoglFramebuffer *framebuffer);
 
-void
-_cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
-                                  CoglPipeline *pipeline,
-                                  CoglPrimitive *primitive,
-                                  CoglDrawFlags flags);
-
 /* This can be called directly by the CoglJournal to draw attributes
  * skipping the implicit journal flush, the framebuffer flush and
  * pipeline validation. */
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index d9ec88d..bbf837b 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -2555,39 +2555,12 @@ cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer,
 }
 
 void
-_cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
-                                  CoglPipeline *pipeline,
-                                  CoglPrimitive *primitive,
-                                  CoglDrawFlags flags)
-{
-  if (primitive->indices)
-    _cogl_framebuffer_draw_indexed_attributes (framebuffer,
-                                               pipeline,
-                                               primitive->mode,
-                                               primitive->first_vertex,
-                                               primitive->n_vertices,
-                                               primitive->indices,
-                                               primitive->attributes,
-                                               primitive->n_attributes,
-                                               flags);
-  else
-    _cogl_framebuffer_draw_attributes (framebuffer,
-                                       pipeline,
-                                       primitive->mode,
-                                       primitive->first_vertex,
-                                       primitive->n_vertices,
-                                       primitive->attributes,
-                                       primitive->n_attributes,
-                                       flags);
-}
-
-void
 cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
                                  CoglPipeline *pipeline,
                                  CoglPrimitive *primitive)
 {
-  _cogl_framebuffer_draw_primitive (framebuffer, pipeline, primitive,
-                                    COGL_DRAW_SKIP_LEGACY_STATE);
+  _cogl_primitive_draw (primitive, framebuffer, pipeline,
+                        COGL_DRAW_SKIP_LEGACY_STATE);
 }
 
 void
diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h
index e3fdb12..760770c 100644
--- a/cogl/cogl-framebuffer.h
+++ b/cogl/cogl-framebuffer.h
@@ -32,6 +32,11 @@
 #include <windows.h>
 #endif /* COGL_HAS_WIN32_SUPPORT */
 
+/* We forward declare the CoglFramebuffer type here to avoid some circular
+ * dependency issues with the following headers.
+ */
+typedef struct _CoglFramebuffer CoglFramebuffer;
+
 #ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API
 #include <cogl/cogl2-path.h>
 #else
@@ -87,8 +92,6 @@ COGL_BEGIN_DECLS
  * configuration.
  */
 
-typedef struct _CoglFramebuffer CoglFramebuffer;
-
 #ifdef COGL_ENABLE_EXPERIMENTAL_API
 
 #define COGL_FRAMEBUFFER(X) ((CoglFramebuffer *)(X))
@@ -1387,9 +1390,8 @@ cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer,
  * This is a high level drawing api that can handle any kind of
  * #CoglMetaTexture texture such as #CoglTexture2DSliced textures
  * which may internally be comprised of multiple low-level textures.
- * This is unlike low-level drawing apis such as
- * cogl_framebuffer_draw_primitive() or
- * cogl_framebuffer_draw_attributes() which only support low level
+ * This is unlike low-level drawing apis such as cogl_primitive_draw()
+ * or cogl_framebuffer_draw_attributes() which only support low level
  * texture types that are directly supported by GPUs such as
  * #CoglTexture2D.
  *
@@ -1454,10 +1456,9 @@ cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer,
  * #CoglMetaTexture texture for the first layer such as
  * #CoglTexture2DSliced textures which may internally be comprised of
  * multiple low-level textures.  This is unlike low-level drawing apis
- * such as cogl_framebuffer_draw_primitive() or
- * cogl_framebuffer_draw_attributes() which only support low level
- * texture types that are directly supported by GPUs such as
- * #CoglTexture2D.
+ * such as cogl_primitive_draw() or cogl_framebuffer_draw_attributes()
+ * which only support low level texture types that are directly
+ * supported by GPUs such as #CoglTexture2D.
  *
  * <note>This api can not currently handle multiple high-level meta
  * texture layers. The first layer may be a high level meta texture
@@ -1562,9 +1563,8 @@ cogl_framebuffer_draw_rectangles (CoglFramebuffer *framebuffer,
  * This is a high level drawing api that can handle any kind of
  * #CoglMetaTexture texture such as #CoglTexture2DSliced textures
  * which may internally be comprised of multiple low-level textures.
- * This is unlike low-level drawing apis such as
- * cogl_framebuffer_draw_primitive() or
- * cogl_framebuffer_draw_attributes() which only support low level
+ * This is unlike low-level drawing apis such as cogl_primitive_draw()
+ * or cogl_framebuffer_draw_attributes() which only support low level
  * texture types that are directly supported by GPUs such as
  * #CoglTexture2D.
  *
diff --git a/cogl/cogl-pixel-buffer.h b/cogl/cogl-pixel-buffer.h
index 09ee5e9..de52ad1 100644
--- a/cogl/cogl-pixel-buffer.h
+++ b/cogl/cogl-pixel-buffer.h
@@ -32,6 +32,10 @@
 #ifndef __COGL_PIXEL_BUFFER_H__
 #define __COGL_PIXEL_BUFFER_H__
 
+/* XXX: We forward declare CoglPixelBuffer here to allow for circular
+ * dependencies between some headers */
+typedef struct _CoglPixelBuffer CoglPixelBuffer;
+
 #include <cogl/cogl-types.h>
 #include <cogl/cogl-context.h>
 
@@ -39,8 +43,6 @@ COGL_BEGIN_DECLS
 
 #define COGL_PIXEL_BUFFER(buffer) ((CoglPixelBuffer *)(buffer))
 
-typedef struct _CoglPixelBuffer CoglPixelBuffer;
-
 /**
  * cogl_pixel_buffer_new:
  * @context: A #CoglContext
diff --git a/cogl/cogl-primitive-private.h b/cogl/cogl-primitive-private.h
index 9d03a6b..d9103c2 100644
--- a/cogl/cogl-primitive-private.h
+++ b/cogl/cogl-primitive-private.h
@@ -31,6 +31,7 @@
 #include "cogl-object-private.h"
 #include "cogl-attribute-buffer-private.h"
 #include "cogl-attribute-private.h"
+#include "cogl-framebuffer.h"
 
 struct _CoglPrimitive
 {
@@ -58,6 +59,8 @@ _cogl_primitive_immutable_unref (CoglPrimitive *primitive);
 
 void
 _cogl_primitive_draw (CoglPrimitive *primitive,
+                      CoglFramebuffer *framebuffer,
+                      CoglPipeline *pipeline,
                       CoglDrawFlags flags);
 
 #endif /* __COGL_PRIMITIVE_PRIVATE_H */
diff --git a/cogl/cogl-primitive.c b/cogl/cogl-primitive.c
index 6f3a40e..580f4b8 100644
--- a/cogl/cogl-primitive.c
+++ b/cogl/cogl-primitive.c
@@ -34,6 +34,7 @@
 #include "cogl-primitive.h"
 #include "cogl-primitive-private.h"
 #include "cogl-attribute-private.h"
+#include "cogl-framebuffer-private.h"
 
 #include <stdarg.h>
 #include <string.h>
@@ -599,3 +600,38 @@ cogl_primitive_foreach_attribute (CoglPrimitive *primitive,
     if (!callback (primitive, primitive->attributes[i], user_data))
       break;
 }
+
+void
+_cogl_primitive_draw (CoglPrimitive *primitive,
+                      CoglFramebuffer *framebuffer,
+                      CoglPipeline *pipeline,
+                      CoglDrawFlags flags)
+{
+  if (primitive->indices)
+    _cogl_framebuffer_draw_indexed_attributes (framebuffer,
+                                               pipeline,
+                                               primitive->mode,
+                                               primitive->first_vertex,
+                                               primitive->n_vertices,
+                                               primitive->indices,
+                                               primitive->attributes,
+                                               primitive->n_attributes,
+                                               flags);
+  else
+    _cogl_framebuffer_draw_attributes (framebuffer,
+                                       pipeline,
+                                       primitive->mode,
+                                       primitive->first_vertex,
+                                       primitive->n_vertices,
+                                       primitive->attributes,
+                                       primitive->n_attributes,
+                                       flags);
+}
+
+void
+cogl_primitive_draw (CoglPrimitive *primitive,
+                     CoglFramebuffer *framebuffer,
+                     CoglPipeline *pipeline)
+{
+  _cogl_primitive_draw (primitive, framebuffer, pipeline, 0 /* flags */);
+}
diff --git a/cogl/cogl-primitive.h b/cogl/cogl-primitive.h
index f1f4498..3aa3f12 100644
--- a/cogl/cogl-primitive.h
+++ b/cogl/cogl-primitive.h
@@ -38,6 +38,7 @@ typedef struct _CoglPrimitive CoglPrimitive;
 
 #include <cogl/cogl-vertex-buffer.h> /* for CoglVerticesMode */
 #include <cogl/cogl-attribute.h>
+#include <cogl/cogl-framebuffer.h>
 
 COGL_BEGIN_DECLS
 
@@ -860,6 +861,30 @@ cogl_primitive_foreach_attribute (CoglPrimitive *primitive,
                                   CoglPrimitiveAttributeCallback callback,
                                   void *user_data);
 
+/**
+ * cogl_primitive_draw:
+ * @primitive: A #CoglPrimitive geometry object
+ * @framebuffer: A destination #CoglFramebuffer
+ * @pipeline: A #CoglPipeline state object
+ *
+ * Draws the given @primitive geometry to the specified destination
+ * @framebuffer using the graphics processing state described by @pipeline.
+ *
+ * This drawing api doesn't support high-level meta texture types such
+ * as #CoglTexture2DSliced so it is the user's responsibility to
+ * ensure that only low-level textures that can be directly sampled by
+ * a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D
+ * are associated with layers of the given @pipeline.
+ *
+ * Stability: unstable
+ * Since: 1.16
+ */
+void
+cogl_primitive_draw (CoglPrimitive *primitive,
+                     CoglFramebuffer *framebuffer,
+                     CoglPipeline *pipeline);
+
+
 COGL_END_DECLS
 
 #endif /* __COGL_PRIMITIVE_H__ */
diff --git a/cogl/cogl-vertex-buffer.c b/cogl/cogl-vertex-buffer.c
index 74b3133..20f327f 100644
--- a/cogl/cogl-vertex-buffer.c
+++ b/cogl/cogl-vertex-buffer.c
@@ -105,6 +105,7 @@
 #include "cogl-pipeline-private.h"
 #include "cogl-primitives.h"
 #include "cogl-framebuffer-private.h"
+#include "cogl-primitive-private.h"
 #include "cogl-journal-private.h"
 #include "cogl1-context.h"
 
@@ -1627,10 +1628,10 @@ update_primitive_and_draw (CoglVertexBuffer *buffer,
    *  to enable it) */
   cogl_push_source (pipeline_priv->real_source);
 
-  _cogl_framebuffer_draw_primitive (cogl_get_draw_framebuffer (),
-                                    pipeline_priv->real_source,
-                                    buffer->primitive,
-                                    0 /* no draw flags */);
+  _cogl_primitive_draw (buffer->primitive,
+                        cogl_get_draw_framebuffer (),
+                        pipeline_priv->real_source,
+                        0 /* no draw flags */);
 
   cogl_pop_source ();
 }
diff --git a/cogl/cogl.symbols b/cogl/cogl.symbols
index c74f667..100fa6d 100644
--- a/cogl/cogl.symbols
+++ b/cogl/cogl.symbols
@@ -228,7 +228,6 @@ cogl_framebuffer_clear
 cogl_framebuffer_discard_buffers
 cogl_framebuffer_draw_attributes
 cogl_framebuffer_draw_indexed_attributes
-cogl_framebuffer_draw_primitive
 cogl_framebuffer_draw_rectangle
 cogl_framebuffer_draw_rectangles
 cogl_framebuffer_draw_textured_rectangle
@@ -684,6 +683,7 @@ cogl_primitive_set_first_vertex
 cogl_primitive_set_indices
 cogl_primitive_set_mode
 cogl_primitive_set_n_vertices
+cogl_primitive_draw
 
 cogl_primitive_texture_set_auto_mipmap
 
diff --git a/cogl/driver/gl/cogl-clip-stack-gl.c b/cogl/driver/gl/cogl-clip-stack-gl.c
index e440256..6bdcb07 100644
--- a/cogl/driver/gl/cogl-clip-stack-gl.c
+++ b/cogl/driver/gl/cogl-clip-stack-gl.c
@@ -35,6 +35,7 @@
 #include "cogl-pipeline-opengl-private.h"
 #include "cogl-path-private.h"
 #include "cogl-clip-stack-gl-private.h"
+#include "cogl-primitive-private.h"
 
 #ifndef GL_CLIP_PLANE0
 #define GL_CLIP_PLANE0 0x3000
@@ -400,13 +401,13 @@ paint_primitive_silhouette (CoglFramebuffer *framebuffer,
                             CoglPipeline *pipeline,
                             void *user_data)
 {
-  _cogl_framebuffer_draw_primitive (framebuffer,
-                                    pipeline,
-                                    user_data,
-                                    COGL_DRAW_SKIP_JOURNAL_FLUSH |
-                                    COGL_DRAW_SKIP_PIPELINE_VALIDATION |
-                                    COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
-                                    COGL_DRAW_SKIP_LEGACY_STATE);
+  _cogl_primitive_draw (user_data,
+                        framebuffer,
+                        pipeline,
+                        COGL_DRAW_SKIP_JOURNAL_FLUSH |
+                        COGL_DRAW_SKIP_PIPELINE_VALIDATION |
+                        COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
+                        COGL_DRAW_SKIP_LEGACY_STATE);
 }
 
 static void
diff --git a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt 
b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt
index 5b5c6ef..c27a81e 100644
--- a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt
+++ b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt
@@ -298,6 +298,7 @@ cogl_primitive_set_indices
 cogl_primitive_copy
 CoglPrimitiveAttributeCallback
 cogl_primitive_foreach_attribute
+cogl_primitive_draw
 </SECTION>
 
 <SECTION>
@@ -541,7 +542,6 @@ cogl_framebuffer_set_dither_enabled
 cogl_framebuffer_get_dither_enabled
 
 <SUBSECTION>
-cogl_framebuffer_draw_primitive
 cogl_framebuffer_draw_attributes
 cogl_framebuffer_vdraw_attributes
 cogl_framebuffer_draw_indexed_attributes
diff --git a/examples/cogl-crate.c b/examples/cogl-crate.c
index f3a412f..acba1e5 100644
--- a/examples/cogl-crate.c
+++ b/examples/cogl-crate.c
@@ -115,7 +115,7 @@ paint (Data *data)
   cogl_framebuffer_rotate (fb, rotation, 0, 1, 0);
   cogl_framebuffer_rotate (fb, rotation, 1, 0, 0);
 
-  cogl_framebuffer_draw_primitive (fb, data->crate_pipeline, data->prim);
+  cogl_primitive_draw (data->prim, fb, data->crate_pipeline);
 
   cogl_framebuffer_pop_matrix (fb);
 
diff --git a/examples/cogl-emscripten-hello.c b/examples/cogl-emscripten-hello.c
index c5d083d..e969e95 100644
--- a/examples/cogl-emscripten-hello.c
+++ b/examples/cogl-emscripten-hello.c
@@ -30,7 +30,7 @@ redraw (Data *data)
   cogl_framebuffer_push_matrix (fb);
   cogl_framebuffer_translate (fb, data->center_x, -data->center_y, 0.0f);
 
-  cogl_framebuffer_draw_primitive (fb, data->pipeline, data->triangle);
+  cogl_primitive_draw (data->triangle, fb, data->pipeline);
   cogl_framebuffer_pop_matrix (fb);
 
   cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb));
diff --git a/examples/cogl-gles2-context.c b/examples/cogl-gles2-context.c
index 8093851..f696dca 100644
--- a/examples/cogl-gles2-context.c
+++ b/examples/cogl-gles2-context.c
@@ -46,7 +46,7 @@ paint_cb (void *user_data)
     cogl_pop_gles2_context (data->ctx);
 
     /* Draw scene with Cogl */
-    cogl_framebuffer_draw_primitive (data->fb, data->pipeline, data->triangle);
+    cogl_primitive_draw (data->triangle, data->fb, data->pipeline);
 
     cogl_onscreen_swap_buffers (COGL_ONSCREEN (data->fb));
 
diff --git a/examples/cogl-hello.c b/examples/cogl-hello.c
index 49f9336..602ac49 100644
--- a/examples/cogl-hello.c
+++ b/examples/cogl-hello.c
@@ -24,9 +24,9 @@ paint_cb (void *user_data)
     data->draw_ready = FALSE;
 
     cogl_framebuffer_clear4f (data->fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
-    cogl_framebuffer_draw_primitive (data->fb,
-                                     data->pipeline,
-                                     data->triangle);
+    cogl_primitive_draw (data->triangle,
+                         data->fb,
+                         data->pipeline);
     cogl_onscreen_swap_buffers (COGL_ONSCREEN (data->fb));
 
     return G_SOURCE_REMOVE;
diff --git a/examples/cogl-msaa.c b/examples/cogl-msaa.c
index ea5ce8f..b498c42 100644
--- a/examples/cogl-msaa.c
+++ b/examples/cogl-msaa.c
@@ -92,10 +92,10 @@ main (int argc, char **argv)
         cogl_framebuffer_push_matrix (fb);
         cogl_framebuffer_scale (fb, 0.5, 1, 1);
         cogl_framebuffer_translate (fb, -1, 0, 0);
-        cogl_framebuffer_draw_primitive (fb, pipeline, triangle);
+        cogl_primitive_draw (triangle, fb, pipeline);
         cogl_framebuffer_pop_matrix (fb);
 
-        cogl_framebuffer_draw_primitive (fb, pipeline, triangle);
+        cogl_primitive_draw (triangle, fb, pipeline);
         cogl_framebuffer_resolve_samples (offscreen_fb);
 
         texture_pipeline = cogl_pipeline_new (ctx);
diff --git a/examples/cogl-sdl-hello.c b/examples/cogl-sdl-hello.c
index ef0d08d..3d656e3 100644
--- a/examples/cogl-sdl-hello.c
+++ b/examples/cogl-sdl-hello.c
@@ -26,7 +26,7 @@ redraw (Data *data)
   cogl_framebuffer_push_matrix (fb);
   cogl_framebuffer_translate (fb, data->center_x, -data->center_y, 0.0f);
 
-  cogl_framebuffer_draw_primitive (fb, data->pipeline, data->triangle);
+  cogl_primitive_draw (data->triangle, fb, data->pipeline);
   cogl_framebuffer_pop_matrix (fb);
 
   cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb));
diff --git a/examples/cogl-sdl2-hello.c b/examples/cogl-sdl2-hello.c
index fb51c7f..7dfabdd 100644
--- a/examples/cogl-sdl2-hello.c
+++ b/examples/cogl-sdl2-hello.c
@@ -26,7 +26,7 @@ redraw (Data *data)
   cogl_framebuffer_push_matrix (fb);
   cogl_framebuffer_translate (fb, data->center_x, -data->center_y, 0.0f);
 
-  cogl_framebuffer_draw_primitive (fb, data->pipeline, data->triangle);
+  cogl_primitive_draw (data->triangle, fb, data->pipeline);
   cogl_framebuffer_pop_matrix (fb);
 
   cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb));
diff --git a/examples/cogl-x11-foreign.c b/examples/cogl-x11-foreign.c
index 1622266..01a47e3 100644
--- a/examples/cogl-x11-foreign.c
+++ b/examples/cogl-x11-foreign.c
@@ -195,7 +195,7 @@ main (int argc, char **argv)
                                    poll_fds, n_poll_fds);
 
       cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
-      cogl_framebuffer_draw_primitive (fb, pipeline, triangle);
+      cogl_primitive_draw (triangle, fb, pipeline);
       cogl_onscreen_swap_buffers (onscreen);
     }
 
diff --git a/examples/cogland.c b/examples/cogland.c
index 4c0c27f..3d7c553 100644
--- a/examples/cogland.c
+++ b/examples/cogland.c
@@ -392,8 +392,8 @@ paint_cb (void *user_data)
 
       cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
 
-      cogl_framebuffer_draw_primitive (fb, compositor->triangle_pipeline,
-                                       compositor->triangle);
+      cogl_primitive_draw (compositor->triangle,
+                           fb, compositor->triangle_pipeline);
 
       for (l2 = compositor->surfaces; l2; l2 = l2->next)
         {
diff --git a/tests/conform/test-blend.c b/tests/conform/test-blend.c
index e67f11b..3c6235b 100644
--- a/tests/conform/test-blend.c
+++ b/tests/conform/test-blend.c
@@ -41,8 +41,8 @@ paint (void)
    * primitive will be drawn with blending still disabled.
    */
 
-  cogl_framebuffer_draw_primitive (test_fb, pipeline, tri0);
-  cogl_framebuffer_draw_primitive (test_fb, pipeline, tri1);
+  cogl_primitive_draw (tri0, test_fb, pipeline);
+  cogl_primitive_draw (tri1, test_fb, pipeline);
 
   test_utils_check_pixel_and_alpha (test_fb,
                                     half_width + 5,
diff --git a/tests/conform/test-point-size-attribute.c b/tests/conform/test-point-size-attribute.c
index 81cae95..a08d1da 100644
--- a/tests/conform/test-point-size-attribute.c
+++ b/tests/conform/test-point-size-attribute.c
@@ -122,7 +122,7 @@ do_test (const char *attribute_name,
   cogl_pipeline_set_per_vertex_point_size (pipeline, TRUE, NULL);
   if (pipeline_setup_func)
     pipeline_setup_func (pipeline);
-  cogl_framebuffer_draw_primitive (test_fb, pipeline, primitive);
+  cogl_primitive_draw (primitive, test_fb, pipeline);
   cogl_object_unref (pipeline);
   cogl_object_unref (primitive);
 
diff --git a/tests/conform/test-point-size.c b/tests/conform/test-point-size.c
index 2ab5150..3c3af0f 100644
--- a/tests/conform/test-point-size.c
+++ b/tests/conform/test-point-size.c
@@ -79,9 +79,7 @@ test_point_size (void)
 
       cogl_pipeline_set_point_size (pipeline, point_size);
       cogl_pipeline_set_color4ub (pipeline, 0, 255, 0, 255);
-      cogl_framebuffer_draw_primitive (test_fb,
-                                       pipeline,
-                                       prim);
+      cogl_primitive_draw (prim, test_fb, pipeline);
 
       cogl_object_unref (prim);
       cogl_object_unref (pipeline);
diff --git a/tests/conform/test-point-sprite.c b/tests/conform/test-point-sprite.c
index 99372fb..ac9075c 100644
--- a/tests/conform/test-point-sprite.c
+++ b/tests/conform/test-point-sprite.c
@@ -81,9 +81,7 @@ do_test (CoglBool check_orientation)
                                   1, /* n_vertices */
                                   &point);
 
-  cogl_framebuffer_draw_primitive (test_fb,
-                                   pipeline,
-                                   prim);
+  cogl_primitive_draw (prim, test_fb, pipeline);
 
   /* Render the primitive again without point sprites to make sure
      disabling it works */
@@ -99,9 +97,7 @@ do_test (CoglBool check_orientation)
                               POINT_SIZE * 2, /* x */
                               0.0f, /* y */
                               0.0f /* z */);
-  cogl_framebuffer_draw_primitive (test_fb,
-                                   solid_pipeline,
-                                   prim);
+  cogl_primitive_draw (prim, test_fb, solid_pipeline);
   cogl_framebuffer_pop_matrix (test_fb);
 
   cogl_object_unref (prim);
diff --git a/tests/conform/test-primitive-and-journal.c b/tests/conform/test-primitive-and-journal.c
index a69afe2..f978cd5 100644
--- a/tests/conform/test-primitive-and-journal.c
+++ b/tests/conform/test-primitive-and-journal.c
@@ -81,9 +81,7 @@ test_primitive_and_journal (void)
   cogl_framebuffer_push_rectangle_clip (test_fb,
                                         0, 50, 300, 100);
 
-  cogl_framebuffer_draw_primitive (test_fb,
-                                   pipeline,
-                                   primitives[0]);
+  cogl_primitive_draw (primitives[0], test_fb, pipeline);
 
   /* Draw a rectangle using the journal in-between the two primitives.
    * This should test that the journal gets flushed correctly and that
@@ -94,9 +92,7 @@ test_primitive_and_journal (void)
                                    100, 0, /* x1/y1 */
                                    300, 100 /* x2/y2 */);
 
-  cogl_framebuffer_draw_primitive (test_fb,
-                                   pipeline,
-                                   primitives[1]);
+  cogl_primitive_draw (primitives[1], test_fb, pipeline);
 
   /* Check the three rectangles */
   test_utils_check_region (test_fb,
diff --git a/tests/conform/test-primitive.c b/tests/conform/test-primitive.c
index 0d4d353..57747e8 100644
--- a/tests/conform/test-primitive.c
+++ b/tests/conform/test-primitive.c
@@ -195,7 +195,7 @@ test_paint (TestState *state)
 
       cogl_framebuffer_push_matrix (test_fb);
       cogl_framebuffer_translate (test_fb, i * 10, 0, 0);
-      cogl_framebuffer_draw_primitive (test_fb, pipeline, prim);
+      cogl_primitive_draw (prim, test_fb, pipeline);
       cogl_framebuffer_pop_matrix (test_fb);
 
       test_utils_check_pixel (test_fb, i * 10 + 2, 2, expected_color);
diff --git a/tests/conform/test-texture-3d.c b/tests/conform/test-texture-3d.c
index 97c47cf..894477f 100644
--- a/tests/conform/test-texture-3d.c
+++ b/tests/conform/test-texture-3d.c
@@ -156,7 +156,7 @@ draw_frame (TestState *state)
                                                           TEX_DEPTH),
                               6 * TEX_DEPTH);
 
-  cogl_framebuffer_draw_primitive (test_fb, pipeline, primitive);
+  cogl_primitive_draw (primitive, test_fb, pipeline);
 
   g_free (verts);
 


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