summaryrefslogtreecommitdiff
path: root/graphics/xzgv
diff options
context:
space:
mode:
authorshattered <shattered>2009-01-29 17:57:55 +0000
committershattered <shattered>2009-01-29 17:57:55 +0000
commit612e69106c0eab907ba0fac0aa54ec0f7f7722db (patch)
treede0e0f8b2c1fb03e04a2a3608a5f3352f0b3fe71 /graphics/xzgv
parent8a5a10d52aaf14c4dcc6f374f6218dae1cf2f0ba (diff)
downloadpkgsrc-612e69106c0eab907ba0fac0aa54ec0f7f7722db.tar.gz
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 (limited to 'graphics/xzgv')
-rw-r--r--graphics/xzgv/Makefile3
-rw-r--r--graphics/xzgv/distinfo3
-rw-r--r--graphics/xzgv/patches/patch-ab174
3 files changed, 178 insertions, 2 deletions
diff --git a/graphics/xzgv/Makefile b/graphics/xzgv/Makefile
index 9b45c8e6874..8b1a72df2aa 100644
--- a/graphics/xzgv/Makefile
+++ b/graphics/xzgv/Makefile
@@ -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 --git a/graphics/xzgv/distinfo b/graphics/xzgv/distinfo
index a322ae44ac6..727a035376a 100644
--- a/graphics/xzgv/distinfo
+++ b/graphics/xzgv/distinfo
@@ -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 --git a/graphics/xzgv/patches/patch-ab b/graphics/xzgv/patches/patch-ab
new file mode 100644
index 00000000000..a8b7e9c07cd
--- /dev/null
+++ b/graphics/xzgv/patches/patch-ab
@@ -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);