[cogl/wip/cogl-sharp: 23/51] cogl-sharp: Expose TextureType



commit 4b99779e616bbc1b78e891649ca9a259a7b74a79
Author: Damien Lespiau <damien lespiau intel com>
Date:   Wed Oct 3 10:55:22 2012 +0100

    cogl-sharp: Expose TextureType
    
    TextureType has a tiny problem: it tries to define 2D and 3D as enum
    values. Let's hand write the enum for now to Texture2D and Texture3D.
    
    This allows to expose Framebuffer.SetLayerNullTexture()

 cogl-sharp/Makefile.am    |    1 +
 cogl-sharp/TextureType.cs |   12 ++++++++++++
 cogl-sharp/_Pipeline.cs   |    8 ++++++++
 cogl-sharp/parse-gir.py   |   10 +++++++++-
 4 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/cogl-sharp/Makefile.am b/cogl-sharp/Makefile.am
index 9eaeec6..0a686c3 100644
--- a/cogl-sharp/Makefile.am
+++ b/cogl-sharp/Makefile.am
@@ -27,6 +27,7 @@ sources =			\
 	PixelFormat.cs		\
 	Texture.cs		\
 	_Texture.cs		\
+	TextureType.cs		\
 	VerticesMode.cs		\
 	Winding.cs		\
 	AssemblyInfo.cs		\
diff --git a/cogl-sharp/TextureType.cs b/cogl-sharp/TextureType.cs
new file mode 100644
index 0000000..d2fa39b
--- /dev/null
+++ b/cogl-sharp/TextureType.cs
@@ -0,0 +1,12 @@
+/* This file has been generated by parse-gir.py, do not hand edit */
+using System;
+
+namespace Cogl
+{
+    public enum TextureType
+    {
+        Texture2D = 0,
+        Texture3D = 1,
+        TextureRectangle = 2
+    }
+}
diff --git a/cogl-sharp/_Pipeline.cs b/cogl-sharp/_Pipeline.cs
index 70dd7cb..027b671 100644
--- a/cogl-sharp/_Pipeline.cs
+++ b/cogl-sharp/_Pipeline.cs
@@ -225,6 +225,14 @@ namespace Cogl
         }
 
         [DllImport("cogl2.dll")]
+        public static extern void cogl_pipeline_set_layer_null_texture(IntPtr o, int layer_index, TextureType texure_type);
+
+        public void SetLayerNullTexture(int layer_index, TextureType texure_type)
+        {
+            cogl_pipeline_set_layer_null_texture(handle, layer_index, texure_type);
+        }
+
+        [DllImport("cogl2.dll")]
         public static extern void cogl_pipeline_set_layer_texture(IntPtr o, int layer_index, IntPtr texture);
 
         public void SetLayerTexture(int layer_index, Texture texture)
diff --git a/cogl-sharp/parse-gir.py b/cogl-sharp/parse-gir.py
index 3153e40..e046c6a 100755
--- a/cogl-sharp/parse-gir.py
+++ b/cogl-sharp/parse-gir.py
@@ -31,6 +31,10 @@ struct_types = (
     'Matrix'
 )
 
+hand_written_types = (
+    'TextureType'
+)
+
 # maps from .gir names to cogl-sharp types/methods
 name_overrides = {
     'Framebuffer': {
@@ -146,7 +150,8 @@ def known_type(gir_name):
     return (gir_name in enum_types or
             gir_name in object_types or
             gir_name in basic_types_map or
-            gir_name in struct_types)
+            gir_name in struct_types or
+            gir_name in hand_written_types)
 
 def is_pointer_type(c_type):
     return c_type.endswith("*")
@@ -164,6 +169,9 @@ def derive_native_type(gir_type, c_type):
     if gir_type in enum_types:
         return gir_type
 
+    if gir_type in hand_written_types:
+        return gir_type
+
     if gir_type in basic_types_map:
         return basic_types_map[gir_type]
 



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