[GtkGLExt] [PATCH] support GdkDrawable 2.6 interfaces



Hi,

GtkGLExt 1.0.6 doesn't support gdk_draw_layout(),
gdk_draw_trapezoids() and so on.

The attached patch support those functions.

NOTE: The patch use GTK_CHECK_VERSION macro instead of
(GTK_MAJOR_VERSION == X && GTK_MINOR_VERSION == Y).


Thanks,
--
kou
Index: gdk/gdkglpixmap.c
===================================================================
RCS file: /cvsroot/gtkglext/gtkglext/gdk/gdkglpixmap.c,v
retrieving revision 1.38
diff -u -p -r1.38 gdkglpixmap.c
--- gdk/gdkglpixmap.c	20 Feb 2004 09:38:12 -0000	1.38
+++ gdk/gdkglpixmap.c	22 Aug 2005 05:05:26 -0000
@@ -87,6 +87,15 @@ static void   gdk_gl_pixmap_draw_glyphs 
                                             gint              x,
                                             gint              y,
                                             PangoGlyphString *glyphs);
+#if GTK_CHECK_VERSION(2,6,0)
+static void   gdk_gl_pixmap_draw_glyphs_transformed (GdkDrawable      *drawable,
+                                                     GdkGC            *gc,
+                                                     PangoMatrix      *matrix,
+                                                     PangoFont        *font,
+                                                     gint              x,
+                                                     gint              y,
+                                                     PangoGlyphString *glyphs);
+#endif
 static void   gdk_gl_pixmap_draw_image     (GdkDrawable      *drawable,
                                             GdkGC            *gc,
                                             GdkImage         *image,
@@ -96,6 +105,12 @@ static void   gdk_gl_pixmap_draw_image  
                                             gint              ydest,
                                             gint              width,
                                             gint              height);
+#if GTK_CHECK_VERSION(2,6,0)
+static void  gdk_gl_pixmap_draw_trapezoids (GdkDrawable     *drawable,
+                                            GdkGC	          *gc,
+                                            GdkTrapezoid    *trapezoids,
+                                            gint             n_trapezoids);
+#endif
 static gint         gdk_gl_pixmap_get_depth              (GdkDrawable *drawable);
 static void         gdk_gl_pixmap_get_size               (GdkDrawable *drawable,
                                                           gint        *width,
@@ -104,7 +119,7 @@ static void         gdk_gl_pixmap_set_co
                                                           GdkColormap *cmap);
 static GdkColormap *gdk_gl_pixmap_get_colormap           (GdkDrawable *drawable);
 static GdkVisual   *gdk_gl_pixmap_get_visual             (GdkDrawable *drawable);
-#if !(GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION == 0)
+#if GTK_CHECK_VERSION(2,2,0)
 static GdkScreen   *gdk_gl_pixmap_get_screen             (GdkDrawable *drawable);
 #endif
 static GdkImage    *gdk_gl_pixmap_get_image              (GdkDrawable *drawable,
@@ -197,23 +212,29 @@ gdk_gl_pixmap_class_init (GdkGLPixmapCla
   drawable_class->draw_segments          = gdk_gl_pixmap_draw_segments;
   drawable_class->draw_lines             = gdk_gl_pixmap_draw_lines;
   drawable_class->draw_glyphs            = gdk_gl_pixmap_draw_glyphs;
+#if GTK_CHECK_VERSION(2,6,0)
+  drawable_class->draw_glyphs_transformed = gdk_gl_pixmap_draw_glyphs_transformed;
+#endif
   drawable_class->draw_image             = gdk_gl_pixmap_draw_image;
+#if GTK_CHECK_VERSION(2,6,0)
+  drawable_class->draw_trapezoids        = gdk_gl_pixmap_draw_trapezoids;
+#endif
   drawable_class->get_depth              = gdk_gl_pixmap_get_depth;
   drawable_class->get_size               = gdk_gl_pixmap_get_size;
   drawable_class->set_colormap           = gdk_gl_pixmap_set_colormap;
   drawable_class->get_colormap           = gdk_gl_pixmap_get_colormap;
   drawable_class->get_visual             = gdk_gl_pixmap_get_visual;
-#if !(GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION == 0)
+#if GTK_CHECK_VERSION(2,2,0)
   drawable_class->get_screen             = gdk_gl_pixmap_get_screen;
 #endif
   drawable_class->get_image              = gdk_gl_pixmap_get_image;
   drawable_class->get_clip_region        = gdk_gl_pixmap_get_clip_region;
   drawable_class->get_visible_region     = gdk_gl_pixmap_get_visible_region;
   drawable_class->get_composite_drawable = gdk_gl_pixmap_get_composite_drawable;
-#if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION == 0
-  drawable_class->_draw_pixbuf           = gdk_gl_pixmap_draw_pixbuf;
-#else
+#if GTK_CHECK_VERSION(2,2,0)
   drawable_class->draw_pixbuf            = gdk_gl_pixmap_draw_pixbuf;
+#else
+  drawable_class->_draw_pixbuf           = gdk_gl_pixmap_draw_pixbuf;
 #endif
   drawable_class->_copy_to_image         = gdk_gl_pixmap_copy_to_image;
 }
@@ -428,6 +449,28 @@ gdk_gl_pixmap_draw_glyphs (GdkDrawable  
                                                        glyphs);
 }
 
+#if GTK_CHECK_VERSION(2,6,0)
+static void
+gdk_gl_pixmap_draw_glyphs_transformed (GdkDrawable      *drawable,
+                                       GdkGC            *gc,
+                                       PangoMatrix      *matrix,
+                                       PangoFont        *font,
+                                       gint              x,
+                                       gint              y,
+                                       PangoGlyphString *glyphs)
+{
+  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;
+
+  GDK_DRAWABLE_GET_CLASS (real_drawable)->draw_glyphs_transformed (real_drawable,
+                                                                   gc,
+                                                                   matrix,
+                                                                   font,
+                                                                   x,
+                                                                   y,
+                                                                   glyphs);
+}
+#endif
+
 static void
 gdk_gl_pixmap_draw_image (GdkDrawable *drawable,
                           GdkGC	      *gc,
@@ -452,6 +495,22 @@ gdk_gl_pixmap_draw_image (GdkDrawable *d
                                                       height);
 }
 
+#if GTK_CHECK_VERSION(2,6,0)
+static void
+gdk_gl_pixmap_draw_trapezoids (GdkDrawable     *drawable,
+                               GdkGC	         *gc,
+                               GdkTrapezoid    *trapezoids,
+                               gint             n_trapezoids)
+{
+  GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;
+
+  GDK_DRAWABLE_GET_CLASS (real_drawable)->draw_trapezoids (real_drawable,
+                                                           gc,
+                                                           trapezoids,
+                                                           n_trapezoids);
+}
+#endif
+
 static gint
 gdk_gl_pixmap_get_depth (GdkDrawable *drawable)
 {
@@ -498,7 +557,7 @@ gdk_gl_pixmap_get_visual (GdkDrawable *d
   return GDK_DRAWABLE_GET_CLASS (real_drawable)->get_visual (real_drawable);
 }
 
-#if !(GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION == 0)
+#if GTK_CHECK_VERSION(2,2,0)
 
 static GdkScreen *
 gdk_gl_pixmap_get_screen (GdkDrawable *drawable)
@@ -578,20 +637,7 @@ gdk_gl_pixmap_draw_pixbuf (GdkDrawable *
 {
   GdkDrawable *real_drawable = ((GdkGLPixmap *) drawable)->drawable;
 
-#if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION == 0
-  GDK_DRAWABLE_GET_CLASS (real_drawable)->_draw_pixbuf (real_drawable,
-                                                        gc,
-                                                        pixbuf,
-                                                        src_x,
-                                                        src_y,
-                                                        dest_x,
-                                                        dest_y,
-                                                        width,
-                                                        height,
-                                                        dither,
-                                                        x_dither,
-                                                        y_dither);
-#else
+#if GTK_CHECK_VERSION(2,2,0)
   GDK_DRAWABLE_GET_CLASS (real_drawable)->draw_pixbuf (real_drawable,
                                                        gc,
                                                        pixbuf,
@@ -604,6 +650,19 @@ gdk_gl_pixmap_draw_pixbuf (GdkDrawable *
                                                        dither,
                                                        x_dither,
                                                        y_dither);
+#else
+  GDK_DRAWABLE_GET_CLASS (real_drawable)->_draw_pixbuf (real_drawable,
+                                                        gc,
+                                                        pixbuf,
+                                                        src_x,
+                                                        src_y,
+                                                        dest_x,
+                                                        dest_y,
+                                                        width,
+                                                        height,
+                                                        dither,
+                                                        x_dither,
+                                                        y_dither);
 #endif
 }
 
Index: gdk/gdkglwindow.c
===================================================================
RCS file: /cvsroot/gtkglext/gtkglext/gdk/gdkglwindow.c,v
retrieving revision 1.46
diff -u -p -r1.46 gdkglwindow.c
--- gdk/gdkglwindow.c	20 Feb 2004 09:38:12 -0000	1.46
+++ gdk/gdkglwindow.c	22 Aug 2005 05:05:26 -0000
@@ -87,6 +87,15 @@ static void   gdk_gl_window_draw_glyphs 
                                             gint              x,
                                             gint              y,
                                             PangoGlyphString *glyphs);
+#if GTK_CHECK_VERSION(2,6,0)
+static void   gdk_gl_window_draw_glyphs_transformed (GdkDrawable      *drawable,
+                                                     GdkGC            *gc,
+                                                     PangoMatrix      *matrix,
+                                                     PangoFont        *font,
+                                                     gint              x,
+                                                     gint              y,
+                                                     PangoGlyphString *glyphs);
+#endif
 static void   gdk_gl_window_draw_image     (GdkDrawable      *drawable,
                                             GdkGC            *gc,
                                             GdkImage         *image,
@@ -96,6 +105,12 @@ static void   gdk_gl_window_draw_image  
                                             gint              ydest,
                                             gint              width,
                                             gint              height);
+#if GTK_CHECK_VERSION(2,6,0)
+static void   gdk_gl_window_draw_trapezoids (GdkDrawable   *drawable,
+                                             GdkGC	      *gc,
+                                             GdkTrapezoid  *trapezoids,
+                                             gint           n_trapezoids);
+#endif
 static gint         gdk_gl_window_get_depth              (GdkDrawable *drawable);
 static void         gdk_gl_window_get_size               (GdkDrawable *drawable,
                                                           gint        *width,
@@ -197,23 +212,29 @@ gdk_gl_window_class_init (GdkGLWindowCla
   drawable_class->draw_segments          = gdk_gl_window_draw_segments;
   drawable_class->draw_lines             = gdk_gl_window_draw_lines;
   drawable_class->draw_glyphs            = gdk_gl_window_draw_glyphs;
+#if GTK_CHECK_VERSION(2,6,0)
+  drawable_class->draw_glyphs_transformed = gdk_gl_window_draw_glyphs_transformed;
+#endif
   drawable_class->draw_image             = gdk_gl_window_draw_image;
+#if GTK_CHECK_VERSION(2,6,0)
+  drawable_class->draw_trapezoids        = gdk_gl_window_draw_trapezoids;
+#endif
   drawable_class->get_depth              = gdk_gl_window_get_depth;
   drawable_class->get_size               = gdk_gl_window_get_size;
   drawable_class->set_colormap           = gdk_gl_window_set_colormap;
   drawable_class->get_colormap           = gdk_gl_window_get_colormap;
   drawable_class->get_visual             = gdk_gl_window_get_visual;
-#if !(GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION == 0)
+#if GTK_CHECK_VERSION(2,2,0)
   drawable_class->get_screen             = gdk_gl_window_get_screen;
 #endif
   drawable_class->get_image              = gdk_gl_window_get_image;
   drawable_class->get_clip_region        = gdk_gl_window_get_clip_region;
   drawable_class->get_visible_region     = gdk_gl_window_get_visible_region;
   drawable_class->get_composite_drawable = gdk_gl_window_get_composite_drawable;
-#if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION == 0
-  drawable_class->_draw_pixbuf           = gdk_gl_window_draw_pixbuf;
-#else
+#if GTK_CHECK_VERSION(2,2,0)
   drawable_class->draw_pixbuf            = gdk_gl_window_draw_pixbuf;
+#else
+  drawable_class->_draw_pixbuf           = gdk_gl_window_draw_pixbuf;
 #endif
   drawable_class->_copy_to_image         = gdk_gl_window_copy_to_image;
 }
@@ -428,6 +449,28 @@ gdk_gl_window_draw_glyphs (GdkDrawable  
                                                        glyphs);
 }
 
+#if GTK_CHECK_VERSION(2,6,0)
+static void
+gdk_gl_window_draw_glyphs_transformed (GdkDrawable      *drawable,
+                                       GdkGC            *gc,
+                                       PangoMatrix      *matrix,
+                                       PangoFont        *font,
+                                       gint              x,
+                                       gint              y,
+                                       PangoGlyphString *glyphs)
+{
+  GdkDrawable *real_drawable = ((GdkGLWindow *) drawable)->drawable;
+
+  GDK_DRAWABLE_GET_CLASS (real_drawable)->draw_glyphs_transformed (real_drawable,
+                                                                   gc,
+                                                                   matrix,
+                                                                   font,
+                                                                   x,
+                                                                   y,
+                                                                   glyphs);
+}
+#endif
+
 static void
 gdk_gl_window_draw_image (GdkDrawable *drawable,
                           GdkGC	      *gc,
@@ -452,6 +495,22 @@ gdk_gl_window_draw_image (GdkDrawable *d
                                                       height);
 }
 
+#if GTK_CHECK_VERSION(2,6,0)
+static void
+gdk_gl_window_draw_trapezoids (GdkDrawable   *drawable,
+                               GdkGC         *gc,
+                               GdkTrapezoid  *trapezoids,
+                               gint           n_trapezoids)
+{
+  GdkDrawable *real_drawable = ((GdkGLWindow *) drawable)->drawable;
+
+  GDK_DRAWABLE_GET_CLASS (real_drawable)->draw_trapezoids (real_drawable,
+                                                           gc,
+                                                           trapezoids,
+                                                           n_trapezoids);
+}
+#endif
+
 static gint
 gdk_gl_window_get_depth (GdkDrawable *drawable)
 {
@@ -498,7 +557,7 @@ gdk_gl_window_get_visual (GdkDrawable *d
   return GDK_DRAWABLE_GET_CLASS (real_drawable)->get_visual (real_drawable);
 }
 
-#if !(GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION == 0)
+#if GTK_CHECK_VERSION(2,2,0)
 
 static GdkScreen *
 gdk_gl_window_get_screen (GdkDrawable *drawable)
@@ -578,20 +637,7 @@ gdk_gl_window_draw_pixbuf (GdkDrawable *
 {
   GdkDrawable *real_drawable = ((GdkGLWindow *) drawable)->drawable;
 
-#if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION == 0
-  GDK_DRAWABLE_GET_CLASS (real_drawable)->_draw_pixbuf (real_drawable,
-                                                        gc,
-                                                        pixbuf,
-                                                        src_x,
-                                                        src_y,
-                                                        dest_x,
-                                                        dest_y,
-                                                        width,
-                                                        height,
-                                                        dither,
-                                                        x_dither,
-                                                        y_dither);
-#else
+#if GTK_CHECK_VERSION(2,2,0)
   GDK_DRAWABLE_GET_CLASS (real_drawable)->draw_pixbuf (real_drawable,
                                                        gc,
                                                        pixbuf,
@@ -604,6 +650,19 @@ gdk_gl_window_draw_pixbuf (GdkDrawable *
                                                        dither,
                                                        x_dither,
                                                        y_dither);
+#else
+  GDK_DRAWABLE_GET_CLASS (real_drawable)->_draw_pixbuf (real_drawable,
+                                                        gc,
+                                                        pixbuf,
+                                                        src_x,
+                                                        src_y,
+                                                        dest_x,
+                                                        dest_y,
+                                                        width,
+                                                        height,
+                                                        dither,
+                                                        x_dither,
+                                                        y_dither);
 #endif
 }
 


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