[cogl/wip/cogl-sharp: 33/51] cogl-sharp: Override DrawTexturedRectangles()



commit 0ac8b8bda0b988b7e42ffeabb0fe5d6fb92a683d
Author: Damien Lespiau <damien lespiau intel com>
Date:   Sun Oct 21 17:16:07 2012 +0100

    cogl-sharp: Override DrawTexturedRectangles()
    
    This is a bit complicated to bind automatically, so just write it
    ourselves.

 cogl-sharp/FrameBuffer.cs  |   17 +++++++++++++++++
 cogl-sharp/_FrameBuffer.cs |    8 --------
 cogl-sharp/parse-gir.py    |   15 +++++++++++++++
 3 files changed, 32 insertions(+), 8 deletions(-)
---
diff --git a/cogl-sharp/FrameBuffer.cs b/cogl-sharp/FrameBuffer.cs
index 6eace5f..f56e51a 100644
--- a/cogl-sharp/FrameBuffer.cs
+++ b/cogl-sharp/FrameBuffer.cs
@@ -32,5 +32,22 @@ namespace Cogl
     {
         public FrameBuffer(IntPtr h) : base(h) {}
         public FrameBuffer() {}
+
+        [DllImport("cogl2.dll")]
+        public static extern void
+        cogl_framebuffer_draw_textured_rectangles(IntPtr o,
+                                                  IntPtr pipeline,
+                                                  [In] float[] coordinates,
+                                                  uint n_rectangles);
+
+        public void DrawTexturedRectangles(Pipeline pipeline,
+                                           float[] coordinates)
+        {
+            cogl_framebuffer_draw_textured_rectangles(handle,
+                                                      pipeline.Handle,
+                                                      coordinates,
+                                                      (uint)coordinates.Length / 8);
+        }
+
     }
 }
diff --git a/cogl-sharp/_FrameBuffer.cs b/cogl-sharp/_FrameBuffer.cs
index 08a263e..55b240b 100644
--- a/cogl-sharp/_FrameBuffer.cs
+++ b/cogl-sharp/_FrameBuffer.cs
@@ -55,14 +55,6 @@ namespace Cogl
         }
 
         [DllImport("cogl2.dll")]
-        public static extern void cogl_framebuffer_draw_textured_rectangles(IntPtr o, IntPtr pipeline, float coordinates, uint n_rectangles);
-
-        public void DrawTexturedRectangles(Pipeline pipeline, float coordinates, uint n_rectangles)
-        {
-            cogl_framebuffer_draw_textured_rectangles(handle, pipeline.Handle, coordinates, n_rectangles);
-        }
-
-        [DllImport("cogl2.dll")]
         public static extern void cogl_framebuffer_finish(IntPtr o);
 
         public void Finish()
diff --git a/cogl-sharp/parse-gir.py b/cogl-sharp/parse-gir.py
index afe0b46..bac4079 100755
--- a/cogl-sharp/parse-gir.py
+++ b/cogl-sharp/parse-gir.py
@@ -45,6 +45,9 @@ name_overrides = {
         'methods': {
             'clear4f': 'clear'
         },
+        'handwritten': (
+            'draw_textured_rectangles',
+        ),
         'blacklist': (
             'vdraw_attributes', 'draw_rectangles'
         )
@@ -214,6 +217,15 @@ def is_blacklisted(gir_name, overrides):
 
     return gir_name in overrides['blacklist']
 
+def is_handwritten(gir_name, overrides):
+    if not overrides:
+        return False
+
+    if not 'handwritten' in overrides:
+        return False
+
+    return gir_name in overrides['handwritten']
+
 def generate_method(node, overrides, fo):
     gir_name = node.getAttribute("name")
 
@@ -227,6 +239,9 @@ def generate_method(node, overrides, fo):
     cs_params = []
     call_params = ['handle']
 
+    if is_handwritten(gir_name, overrides):
+        return
+
     if is_blacklisted(gir_name, overrides):
         print("  Skipping %s, blacklisted" % cs_method_name)
         return



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