[gtkglarea/jjardon/gtk3: 4/12] Remove GdkPixmap related API



commit 5d8e1f294ae98d3615f9d87eecd41fa21a8ed640
Author: Javier Jardón <jjardon gnome org>
Date:   Wed Mar 19 22:51:32 2014 +0000

    Remove GdkPixmap related API

 docs/HOWTO.txt       |   11 +--
 docs/gdkgl.txt       |   96 ----------------------
 examples/Makefile.am |    3 +-
 examples/README      |    7 --
 examples/glpixmap.c  |  109 -------------------------
 gtkgl/gdkgl.c        |  213 --------------------------------------------------
 gtkgl/gdkgl.h        |   17 ----
 7 files changed, 3 insertions(+), 453 deletions(-)
---
diff --git a/docs/HOWTO.txt b/docs/HOWTO.txt
index 011cf42..858fd6c 100644
--- a/docs/HOWTO.txt
+++ b/docs/HOWTO.txt
@@ -47,21 +47,14 @@
 
 
 
-4. How do I render to an off-screen pixmap?
-
-    See examples/glpixmap.c, remember that pixmaps can not be rendered to with
-    direct context.
-
-
-
-5. Can I use gdk_gl functions and GtkGLArea widget in the same program?
+6. Can I use gdk_gl functions and GtkGLArea widget in the same program?
 
     Yes, just remember that gtk_gl_area_make_current() makes the GtkGLArea
     widget's internal context the current context and leaves it so.
 
 
 
-6. How do I capture keypress events for GtkGLArea widget?
+7. How do I capture keypress events for GtkGLArea widget?
 
     This is not a GtkGLArea specific question, but here is a solution:
 
diff --git a/docs/gdkgl.txt b/docs/gdkgl.txt
index ea23439..d3f492f 100644
--- a/docs/gdkgl.txt
+++ b/docs/gdkgl.txt
@@ -3,11 +3,6 @@ gdk_gl_* functions
        Quite straightforward wrapper around few necessary GLX calls and
        should be easy to understand if you already know GLX.
 
-gdk_gl_pixmap_* functions
-       Latest addition, not very well tested yet, enables rendering
-       to off-screen pixmaps. See examples/glpixmap.c.
-
-
 
 ---------------------------------------------------------------
 
@@ -249,94 +244,3 @@ DESCRIPTION
 SEE ALSO
        glXWaitGL
        gdk_gl_wait_gdk
-
-
----------------------------------------------------------------
-
-NAME
-       gdk_gl_pixmap_new - create an off screen rendering area
-
-C SPECIFICATION
-
-       GdkGLPixmap *gdk_gl_pixmap_new( GdkVisual *visual,
-                                       GdkPixmap *pixmap )
-
-DESCRIPTION
-       gdk_gl_pixmap_new returns pointer to new GdkGLPixmap with
-       reference count of 1. pixmap will become front left buffer
-       of GdkGLPixmap.
-
-SEE ALSO
-       glXCreateGLXPixmap
-       gdk_gl_pixmap_ref
-       gdk_gl_pixmap_unref
-
----------------------------------------------------------------
-
-NAME
-       gdk_gl_pixmap_ref - increase glpixmap reference count
-
-C SPECIFICATION
-       GdkGLPixmap *gdk_gl_pixmap_ref( GdkGLPixmap *glpixmap )
-
-PARAMETERS
-
-glpixmap
-       a pointer to GdkGLPixmap
-
-DESCRIPTION
-
-SEE ALSO
-       gdk_gl_pixmap_new
-       gdk_gl_pixmap_unref
-
-
----------------------------------------------------------------
-
-NAME
-       gdk_gl_pixmap_unref - decrease glpixmap reference count
-
-C SPECIFICATION
-       void gdk_gl_pixmap_unref( GdkGLPixmap *glpixmap )
-
-PARAMETERS
-
-glpixmap
-       a pointer to GdkGLPixmap
-
-DESCRIPTION
-       gdk_gl_pixmap_unref decreases reference count of
-       GdkGLPixmap by 1 and deletes pixmap if reference count
-       reaches 0.
-
-SEE ALSO
-       glXDestroyGLXPixmap
-       gdk_gl_pixmap_new
-       gdk_gl_pixmap_ref
-
-
----------------------------------------------------------------
-
-NAME
-       gdk_gl_pixmap_make_current - attach context to glpixmap
-
-C SPECIFICATION
-       gint gdk_gl_pixmap_make_current( GdkGLPixmap *glpixmap,
-                                        GdkGLContext *context )
-
-PARAMETERS
-
-glpixmap
-       a pointer to GdkGLPixmap
-
-context
-       a pointer to GdkGLContext
-
-DESCRIPTION
-       gdk_gl_pixmap_make_current make context current OpenGL
-       rendering context, and it attaches context to glpixmap.
-       gdk_gl_pixmap_make_current returns TRUE of successful.
-
-SEE ALSO
-       glXMakeCurrent
-       gdk_gl_make_current
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 18b4a2f..e66064c 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -6,7 +6,7 @@ if HAVE_SHADERS
 shader_programs = shaders
 endif
 
-noinst_PROGRAMS = simple zktor viewlw glpixmap $(shader_programs) gtkglarea_demo
+noinst_PROGRAMS = simple zktor viewlw $(shader_programs) gtkglarea_demo
 
 AM_CPPFLAGS = -I$(top_srcdir)
 AM_CFLAGS = $(GTK_CFLAGS) $(GL_CFLAGS)
@@ -14,7 +14,6 @@ LDADD = $(top_builddir)/gtkgl/libgtkgl-2.0.la $(GTK_LIBS) $(GL_LIBS) $(LIBM)
 
 simple_SOURCES   = simple.c
 zktor_SOURCES    = zktor.c
-glpixmap_SOURCES = glpixmap.c
 viewlw_SOURCES   = viewlw.c lw.h lw.c trackball.h trackball.c
 shaders_SOURCES  = shaders.c
 gtkglarea_demo_SOURCES = gtkglarea_demo.c
diff --git a/examples/README b/examples/README
index f6585e8..0352084 100644
--- a/examples/README
+++ b/examples/README
@@ -12,13 +12,6 @@ Even better example than simple.
 
 
 
-glpixmap
---------
-
-GL rendering to pixmaps test.
-
-
-
 viewlw
 ------
 
diff --git a/gtkgl/gdkgl.c b/gtkgl/gdkgl.c
index 0ad15ea..48f5e29 100644
--- a/gtkgl/gdkgl.c
+++ b/gtkgl/gdkgl.c
@@ -66,31 +66,6 @@ static GObjectClass *glcontext_parent_class;
 static void gdk_gl_context_class_init (GdkGLContextClass *class);
 
 /*
- *  The GdkGLPixmap class
- */
-struct _GdkGLPixmap {
-  GObject   parent;
-#if defined GDK_WINDOWING_WIN32
-  gboolean  initialised;
-  HDC       hdc;
-  HBITMAP   hbitmap;
-  GdkPixmap *pixmap;
-#elif defined GDK_WINDOWING_X11
-  Display   *xdisplay;
-  GLXPixmap glxpixmap;
-  GdkPixmap *front_left;
-#endif
-};
-
-struct _GdkGLPixmapClass {
-  GObjectClass parent_class;
-};
-typedef struct _GdkGLPixmapClass GdkGLPixmapClass;
-
-static GObjectClass *glpixmap_parent_class;
-static void gdk_gl_pixmap_class_init (GdkGLPixmapClass *class);
-
-/*
  *  Local helper functions
  */
 #if defined GDK_WINDOWING_WIN32
@@ -482,194 +457,6 @@ void gdk_gl_wait_gl (void)
 #endif
 }
 
-
-/*
- *  Pixmap support
- */
-
-GType
-gdk_gl_pixmap_get_type (void)
-{
-  static GType object_type = 0;
-
-  if (!object_type)
-    {
-      static const GTypeInfo object_info =
-      {
-        sizeof (GdkGLPixmapClass),
-        (GBaseInitFunc) NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc) gdk_gl_pixmap_class_init,
-        NULL,           /* class_finalize */
-        NULL,           /* class_data */
-        sizeof (GdkGLPixmap),
-        0,              /* n_preallocs */
-        (GInstanceInitFunc) NULL,
-      };
-
-      object_type = g_type_register_static (G_TYPE_OBJECT,
-                                            "GdkGLPixmap",
-                                            &object_info, 0);
-    }
-  return object_type;
-}
-
-static void
-gdk_gl_pixmap_finalize(GObject *object)
-{
-  GdkGLPixmap *pixmap;
-
-  pixmap = GDK_GL_PIXMAP(object);
-
-#if defined GDK_WINDOWING_WIN32
-  glFinish ();
-  SelectObject (pixmap->hdc, pixmap->hbitmap);
-  gdk_pixmap_unref (pixmap->pixmap);
-#elif defined GDK_WINDOWING_X11
-  if (pixmap->glxpixmap != None) {
-    glXDestroyGLXPixmap(pixmap->xdisplay, pixmap->glxpixmap);
-    glXWaitGL();
-  }
-  pixmap->glxpixmap = None;
-  if (pixmap->front_left) {
-    gdk_pixmap_unref(pixmap->front_left);
-    glXWaitX();
-  }
-  pixmap->front_left = NULL;
-#endif
-
-  (* glcontext_parent_class->finalize)(object);
-}
-
-static void
-gdk_gl_pixmap_class_init(GdkGLPixmapClass *class)
-{
-  GObjectClass *gobject_class;
-
-  gobject_class = G_OBJECT_CLASS(class);
-  glpixmap_parent_class = g_type_class_peek_parent(class);
-
-  gobject_class->finalize = gdk_gl_pixmap_finalize;
-}
-
-GdkGLPixmap *
-gdk_gl_pixmap_new(GdkVisual *visual, GdkPixmap *pixmap)
-{
-  GdkGLPixmap *glpixmap;
-#ifndef GDK_WINDOWING_WIN32
-  Display *dpy;
-  XVisualInfo *vi;
-  Pixmap xpixmap;
-  GLXPixmap glxpixmap;
-  Window root_return;
-  unsigned int w_ret, h_ret, bw_ret, depth_ret;
-  int x_ret, y_ret;
-#elif defined GDK_WINDOWING_X11
-#else
-  g_warning ("gdk_gl_pixmap_new not implemented on " PLATFORM);
-  return NULL;
-#endif
-
-  g_return_val_if_fail(GDK_IS_VISUAL(visual), NULL);
-  g_return_val_if_fail(GDK_IS_PIXMAP(pixmap), NULL);
-
-  glpixmap = g_object_new(GDK_TYPE_GL_PIXMAP, NULL);
-  if (!glpixmap)
-    return NULL;
-
-#if defined GDK_WINDOWING_WIN32
-  glpixmap->initialised = FALSE;
-  glpixmap->hdc = NULL;
-  glpixmap->hbitmap = NULL;
-  glpixmap->pixmap = gdk_pixmap_ref (pixmap);
-#elif defined GDK_WINDOWING_X11
-  dpy = gdk_x11_get_default_xdisplay();
-  xpixmap = (Pixmap)GDK_DRAWABLE_XID(pixmap);
-
-  g_return_val_if_fail(XGetGeometry(dpy, xpixmap, &root_return,
-                                   &x_ret, &y_ret, &w_ret, &h_ret,
-                                    &bw_ret, &depth_ret), NULL);
-
-  g_return_val_if_fail((gdk_gl_get_config(visual, GDK_GL_RED_SIZE) +
-                       gdk_gl_get_config(visual, GDK_GL_GREEN_SIZE) +
-                       gdk_gl_get_config(visual, GDK_GL_BLUE_SIZE)) == depth_ret, NULL);
-
-  vi = get_xvisualinfo(visual);
-  glxpixmap = glXCreateGLXPixmap(dpy, vi, xpixmap);
-  XFree(vi);
-
-  g_return_val_if_fail(glxpixmap != None, NULL);
-
-  glpixmap->xdisplay   = dpy;
-  glpixmap->glxpixmap  = glxpixmap;
-  glpixmap->front_left = gdk_pixmap_ref(pixmap);
-#endif
-
-  return glpixmap;
-}
-
-
-gint gdk_gl_pixmap_make_current(GdkGLPixmap *glpixmap, GdkGLContext *context)
-{
-#ifndef GDK_WINDOWING_WIN32
-  Display  *dpy;
-  GLXPixmap glxpixmap;
-  GLXContext glxcontext;
-#elif defined GDK_WINDOWING_X11
-#else
-  g_warning ("gdk_gl_pixmap_make_current not implemented on " PLATFORM);
-  return 0;
-#endif
-
-  g_return_val_if_fail (GDK_IS_GL_PIXMAP(glpixmap), FALSE);
-  g_return_val_if_fail (GDK_IS_GL_CONTEXT(context), FALSE);
-
-#if defined GDK_WINDOWING_WIN32
-  if (!context->initialised)
-  {
-    int pf;
-
-    context->hdc = CreateCompatibleDC (NULL);
-    glpixmap->hdc = context->hdc;
-    glpixmap->hbitmap = SelectObject (context->hdc, (HBITMAP) gdk_win32_drawable_get_handle 
(glpixmap->pixmap));
-
-    pf = ChoosePixelFormat (context->hdc, &context->pfd);
-
-    if (pf != 0)
-      {
-        SetPixelFormat (context->hdc, pf, &context->pfd);
-        context->hglrc = wglCreateContext (context->hdc);
-      }
-
-    if (context->share)
-      {
-        if (context->share->hglrc)
-          {
-            if (wglShareLists (context->share->hglrc, context->hglrc) != TRUE)
-                g_warning ("failed sharing context");
-          }
-        gdk_gl_context_unref ((GdkGLContext*)context->share);
-      }
-
-    context->initialised = TRUE;
-  }
-
-  g_return_val_if_fail (context->hdc    != NULL, FALSE);
-  g_return_val_if_fail (context->hglrc  != NULL, FALSE);
-
-  wglMakeCurrent (context->hdc, context->hglrc);
-
-  return TRUE;
-#elif defined GDK_WINDOWING_X11
-  dpy        = context->xdisplay;
-  glxpixmap  = glpixmap->glxpixmap;
-  glxcontext = context->glxcontext;
-
-  return (glXMakeCurrent(dpy, glxpixmap, glxcontext) == True) ? TRUE : FALSE;
-#endif
-}
-
-
 /*
  *  Helper functions
  */
diff --git a/gtkgl/gdkgl.h b/gtkgl/gdkgl.h
index ad20bb8..4766bb3 100644
--- a/gtkgl/gdkgl.h
+++ b/gtkgl/gdkgl.h
@@ -98,23 +98,6 @@ void          gdk_gl_wait_gdk(void);
 void          gdk_gl_wait_gl(void);
 
 
-/* glpixmap stuff */
-
-#define GDK_TYPE_GL_PIXMAP            (gdk_gl_pixmap_get_type())
-#define GDK_GL_PIXMAP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_GL_PIXMAP, GdkGLPixmap))
-#define GDK_GL_PIXMAP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST (klass, GDK_TYPE_GL_PIXMAP, GdkGLPixmapClass))
-#define GDK_IS_GL_PIXMAP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_GL_PIXMAP))
-#define GDK_IS_GL_PIXMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GL_PIXMAP))
-#define GDK_GL_PIXMAP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GL_PIXMAP, GdkGLPixmap))
-
-typedef struct _GdkGLPixmap GdkGLPixmap;
-
-GType        gdk_gl_pixmap_get_type(void);
-GdkGLPixmap *gdk_gl_pixmap_new(GdkVisual *visual, GdkPixmap *pixmap);
-
-gint         gdk_gl_pixmap_make_current(GdkGLPixmap *glpixmap, GdkGLContext *context);
-
-
 #ifndef GTKGL_DISABLE_DEPRECATED
 #  define gdk_gl_context_ref(context)   g_object_ref(context)
 #  define gdk_gl_context_unref(context) g_object_unref(context)


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