pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/graphics/xzgv xzgv crashes when it tries to render 32-...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3760bec6166a
branches:  trunk
changeset: 553773:3760bec6166a
user:      shattered <shattered%pkgsrc.org@localhost>
date:      Thu Jan 29 17:57:55 2009 +0000

description:
xzgv crashes when it tries to render 32-bit pixels (alpha+rgb, 8 bit
each) to 24-bit visuals (happens with modular-xorg-server 1.4 and newer).
Add patch from http://bugs.debian.org/457252.

OK by wiz@.

diffstat:

 graphics/xzgv/Makefile         |    3 +-
 graphics/xzgv/distinfo         |    3 +-
 graphics/xzgv/patches/patch-ab |  174 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 178 insertions(+), 2 deletions(-)

diffs (204 lines):

diff -r 0d048ec17e67 -r 3760bec6166a graphics/xzgv/Makefile
--- a/graphics/xzgv/Makefile    Thu Jan 29 17:53:49 2009 +0000
+++ b/graphics/xzgv/Makefile    Thu Jan 29 17:57:55 2009 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.37 2009/01/05 16:08:20 shattered Exp $
+# $NetBSD: Makefile,v 1.38 2009/01/29 17:57:55 shattered Exp $
 #
 
 DISTNAME=      xzgv-0.9
+PKGREVISION=   1
 CATEGORIES=    graphics
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=xzgv/}
 
diff -r 0d048ec17e67 -r 3760bec6166a graphics/xzgv/distinfo
--- a/graphics/xzgv/distinfo    Thu Jan 29 17:53:49 2009 +0000
+++ b/graphics/xzgv/distinfo    Thu Jan 29 17:57:55 2009 +0000
@@ -1,7 +1,8 @@
-$NetBSD: distinfo,v 1.10 2009/01/05 16:08:20 shattered Exp $
+$NetBSD: distinfo,v 1.11 2009/01/29 17:57:55 shattered Exp $
 
 SHA1 (xzgv-0.9.tar.gz) = 5d8115c87be3836d9ed35dba777cd1dc48541715
 RMD160 (xzgv-0.9.tar.gz) = 7c3284eac5a0a368db1be2ed87f882e26d39fab7
 Size (xzgv-0.9.tar.gz) = 235367 bytes
 SHA1 (patch-aa) = fa502e0fc4fc94cfc88c4aa41505ac7563d982a6
+SHA1 (patch-ab) = 740aadcc35d81fcc57a9e364144e259fd4a2a591
 SHA1 (patch-ad) = 378e0c2e19064c2c276c6e0a3e89bdcbcc2c96c5
diff -r 0d048ec17e67 -r 3760bec6166a graphics/xzgv/patches/patch-ab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/graphics/xzgv/patches/patch-ab    Thu Jan 29 17:57:55 2009 +0000
@@ -0,0 +1,174 @@
+$NetBSD: patch-ab,v 1.6 2009/01/29 17:57:55 shattered Exp $
+
+Avoid using ARGB visuals.  From http://bugs.debian.org/457252.
+
+--- src/main.c.orig    2007-12-18 13:55:59.000000000 +0100
++++ src/main.c 2008-05-20 15:23:15.000000000 +0200
+@@ -38,6 +38,7 @@
+ #include <gtk/gtk.h>
+ #include <gdk/gdkkeysyms.h>
+ #include <gdk/gdkx.h>         /* needed for iconify stuff */
++#include <gdk/gdkrgb.h>     /* http://bugs.debian.org/457252 */
+ #include <X11/Xlib.h>         /* ditto */
+ 
+ #include "backend.h"
+@@ -105,7 +106,7 @@
+ 
+ GtkWidget *mainwin;
+ 
+-gint xvpic_pal[256];          /* palette for thumbnails */
++guint8 xvpic_pal[256][3];             /* palette for thumbnails */
+ 
+ /* image & rendered pixmap for currently-loaded image */
+ xzgv_image *theimage=NULL;
+@@ -2514,77 +2515,92 @@
+  */
+ void find_xvpic_cols(void)
+ {
+-GdkColor col;
+-int r,g,b;
+-int n;
+-
+-for(n=0,r=0;r<8;r++)
+-  for(g=0;g<8;g++)    /* colours are 3:3:2 */
+-    for(b=0;b<4;b++,n++)
+-      {
+-      col.red=r*0xffff/7; col.green=g*0xffff/7; col.blue=b*0xffff/3;
+-      backend_get_closest_colour(&col);
+-      xvpic_pal[n]=col.pixel;
+-      }
++    int r,g,b;
++    int n;
++
++    for(n=0,r=0;r<8;r++) {
++        for(g=0;g<8;g++) {/* colours are 3:3:2 */
++            for(b=0;b<4;b++,n++) {
++                xvpic_pal[n][0]=r*0xff/7; 
++                xvpic_pal[n][1]=g*0xff/7;
++                xvpic_pal[n][2]=b*0xff/3;
++            }
++        }
++    }
+ }
+ 
+ 
+ GdkPixmap *xvpic2pixmap(unsigned char *xvpic,int w,int h,GdkPixmap **smallp)
+ {
+ GdkPixmap *pixmap,*small_pixmap;
+-GdkImage *image;
++guint8 *buffer;
+ unsigned char *ptr=xvpic;
+ int x,y;
+ int small_w,small_h;
+ 
+ if(w==0 || h==0) return(NULL);
+ 
+-/* we allocate pixmap and image, draw into image, copy to pixmap,
+- * and ditch the image.
+- */
+-
+-if((image=gdk_image_new(GDK_IMAGE_FASTEST,backend_get_visual(),w,h))==NULL)
+-  return(NULL);
+-
+-if((pixmap=gdk_pixmap_new(mainwin->window,w,h,
+-                          gdk_visual_get_best_depth()))==NULL)
+-  {
+-  gdk_image_destroy(image);
+-  return(NULL);
+-  }
+ 
+-for(y=0;y<h;y++)
+-  for(x=0;x<w;x++)
+-    gdk_image_put_pixel(image,x,y,xvpic_pal[*ptr++]);
+-
+-gdk_draw_image(pixmap,clist->style->white_gc,image,0,0,0,0,w,h);
+-gdk_flush();
++if (NULL == (pixmap=gdk_pixmap_new(mainwin->window,w,h, -1))) { 
++    return(NULL);
++}
+ 
+-/* reuse image to draw scaled-down version for thin rows */
+ small_w=w/ROW_HEIGHT_DIV;
+ small_h=h/ROW_HEIGHT_DIV;
+ if(small_w==0) small_w=1;
+ if(small_h==0) small_h=1;
+ 
+-if((small_pixmap=gdk_pixmap_new(mainwin->window,small_w,small_h,
+-                                gdk_visual_get_best_depth()))==NULL)
+-  {
+-  gdk_pixmap_unref(pixmap);
+-  gdk_image_destroy(image);
+-  return(NULL);
++if((small_pixmap=gdk_pixmap_new(mainwin->window,small_w,small_h,-1))==NULL)
++{
++    gdk_pixmap_unref(pixmap);
++    return(NULL);
++}
++
++buffer = malloc (w * h * sizeof (guint8) * 3);
++
++if (NULL == buffer) {
++    /* malloc failed */
++    gdk_pixmap_unref(pixmap);
++    gdk_pixmap_unref(small_pixmap);
++    return NULL;
++}
++
++
++for(y=0;y<h;y++) {
++  for(x=0;x<w;x++) {
++      buffer[3*(y*w + x)+0] = xvpic_pal[*ptr][0]; /* red */
++      buffer[3*(y*w + x)+1] = xvpic_pal[*ptr][1]; /* green */
++      buffer[3*(y*w + x)+2] = xvpic_pal[*ptr][2]; /* blue */
++      ptr++;
+   }
++}
++
++gdk_draw_rgb_image(pixmap,clist->style->white_gc,0,0,w,h,
++        GDK_RGB_DITHER_NORMAL,
++        (guchar*)buffer, w * 3);
++gdk_flush();
++
++/* reuse image to draw scaled-down version for thin rows */
+ 
+-for(y=0;y<small_h;y++)
+-  for(x=0;x<small_w;x++)
+-    gdk_image_put_pixel(image,x,y,
+-                        xvpic_pal[xvpic[(y*w+x)*ROW_HEIGHT_DIV]]);
+ 
+-gdk_draw_image(small_pixmap,clist->style->white_gc,image,
+-               0,0,0,0,small_w,small_h);
++for(y=0;y<small_h;y++) {
++  for(x=0;x<small_w;x++) {
++      buffer[3*(y*w + x)+0] = xvpic_pal[xvpic[(y*w+x)*ROW_HEIGHT_DIV]][0];
++      buffer[3*(y*w + x)+1] = xvpic_pal[xvpic[(y*w+x)*ROW_HEIGHT_DIV]][1];
++      buffer[3*(y*w + x)+2] = xvpic_pal[xvpic[(y*w+x)*ROW_HEIGHT_DIV]][2];
++  }
++}
+ 
+-gdk_image_destroy(image);
++gdk_draw_rgb_image(small_pixmap,clist->style->white_gc,0,0,small_w, small_h,
++        GDK_RGB_DITHER_NORMAL,
++        (guchar*)buffer, small_w * 3);
+ 
+ *smallp=small_pixmap;
++
++if (NULL != buffer) {
++    free (buffer);
++}
++
+ return(pixmap);
+ }
+ 
+@@ -3649,7 +3665,11 @@
+   };
+ 
+ 
++gtk_widget_push_visual(gdk_rgb_get_visual());
++gtk_widget_push_colormap(gdk_rgb_get_cmap());
+ mainwin=gtk_window_new(GTK_WINDOW_TOPLEVEL);
++gtk_widget_pop_visual();
++gtk_widget_pop_colormap();
+ GTK_WIDGET_UNSET_FLAGS(mainwin,GTK_CAN_FOCUS);
+ gtk_signal_connect(GTK_OBJECT(mainwin),"destroy",
+                    GTK_SIGNAL_FUNC(cb_quit),NULL);



Home | Main Index | Thread Index | Old Index