ports/55345: [patch] Update graphics/libart_lgpl2: Track CVS update

Volker Stolz stolz at i2.informatik.rwth-aachen.de
Thu Aug 7 15:10:21 UTC 2003


>Number:         55345
>Category:       ports
>Synopsis:       [patch] Update graphics/libart_lgpl2: Track CVS update
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 07 08:10:18 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Volker Stolz
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
Lehrstuhl für Informatik II
>Environment:
System: FreeBSD menelaos.informatik.rwth-aachen.de 4.8-STABLE FreeBSD 4.8-STABLE #7: Tue Aug 5 15:53:30 CEST 2003 root at menelaos.informatik.rwth-aachen.de:/usr/obj/usr/src/sys/MENELAOS i386


>Description:
This patch was submitted by the GDM author to the libart CVS repository and
is not in the current tarball of 2.3.13
>How-To-Repeat:
>Fix:
- Add new patchfile: files/patch-art_render_gradient.c
- Bump PORTREVISION

--- libart begins here ---
diff -urN /usr/ports/graphics/libart_lgpl2/Makefile libart_lgpl2/Makefile
--- /usr/ports/graphics/libart_lgpl2/Makefile	Tue Jul 15 16:10:48 2003
+++ libart_lgpl2/Makefile	Thu Aug  7 16:56:38 2003
@@ -7,6 +7,7 @@
 
 PORTNAME=	libart_lgpl2
 PORTVERSION=	2.3.13
+PORTREVISION=	1
 CATEGORIES=	graphics
 MASTER_SITES=	${MASTER_SITE_GNOME}
 MASTER_SITE_SUBDIR=	sources/${PORTNAME:S/2$//}/2.3
diff -urN /usr/ports/graphics/libart_lgpl2/files/patch-art_render_gradient.c libart_lgpl2/files/patch-art_render_gradient.c
--- /usr/ports/graphics/libart_lgpl2/files/patch-art_render_gradient.c	Thu Jan  1 01:00:00 1970
+++ libart_lgpl2/files/patch-art_render_gradient.c	Thu Aug  7 16:54:51 2003
@@ -0,0 +1,230 @@
+Index: art_render_gradient.c
+===================================================================
+RCS file: /cvs/gnome/libart_lgpl/art_render_gradient.c,v
+retrieving revision 1.7
+retrieving revision 1.8
+diff -u -p -r1.7 -r1.8
+--- art_render_gradient.c	8 Jul 2003 08:16:57 -0000	1.7
++++ art_render_gradient.c	18 Jul 2003 20:00:55 -0000	1.8
+@@ -329,7 +329,7 @@ art_render_gradient_linear_render_8 (Art
+   assert (ix > 0);
+   assert (ix < n_stops);
+   assert ((stops[ix-1].offset <= offset_fraction) ||
+-	  ((stops[ix].offset == 1.0) && (offset_fraction == 0.0)));
++	  ((stops[ix].offset >= 1.0) && (offset_fraction <= 0.0)));
+   assert (offset_fraction <= stops[ix].offset);
+   assert ((offset_fraction != stops[ix-1].offset) ||
+ 	  (d_offset >= 0.0));
+@@ -420,7 +420,7 @@ art_render_gradient_linear_render_8 (Art
+ 	    }
+ 	  while (!((stops[ix-1].offset <= offset_fraction &&
+ 		   offset_fraction < stops[ix].offset) ||
+-		   (ix == 1 && offset_fraction == 1.0))); 
++		   (ix == 1 && offset_fraction >= 1.0))); 
+ 	}
+       else
+ 	{
+@@ -432,7 +432,7 @@ art_render_gradient_linear_render_8 (Art
+ 	    }
+ 	  while (!((stops[ix-1].offset < offset_fraction &&
+ 		    offset_fraction <= stops[ix].offset) ||
+-		   (ix == n_stops - 1 && offset_fraction == 0.0)));
++		   (ix == n_stops - 1 && offset_fraction <= 0.0)));
+ 	}
+       
+       bufp += 4*len;
+Index: ChangeLog
+===================================================================
+RCS file: /cvs/gnome/libart_lgpl/ChangeLog,v
+retrieving revision 1.115
+diff -u -p -r1.115 ChangeLog
+--- ChangeLog	18 Jul 2003 20:00:55 -0000	1.115
++++ ChangeLog	25 Jul 2003 19:31:41 -0000
+@@ -1,3 +1,17 @@
++Fri Jul 25 12:29:35 2003  George Lebl <jirka at 5z.com>
++
++	* art_render_gradient.c (art_render_gradient_linear_render_8)
++	  (art_render_gradient_linear_render) (art_render_gradient_linear)
++	  (art_render_gradient_radial_render) (art_render_gradient_radial):
++	  Redo the checks where float was compared by == or != to using
++	  the EPSILON define.  Also copy the ArtGradientLinear and
++	  ArtGradientRadial into the source structure, pretending that
++	  these are constants that will never change or be freed by
++	  the caller is utterly evil and in fact for librsvg it is
++	  not constant.  This fixes some more very random crashes
++	  when using librsvg with libart (which seems to be the
++	  only usage of the gradient stuff)
++
+ Fri Jul 18 12:57:36 2003  George Lebl <jirka at 5z.com>
+ 
+ 	* art_render_gradient.c: Fix more comparison-of-doubles by == bugs,
+Index: art_render_gradient.c
+===================================================================
+RCS file: /cvs/gnome/libart_lgpl/art_render_gradient.c,v
+retrieving revision 1.8
+diff -u -p -r1.8 art_render_gradient.c
+--- art_render_gradient.c	18 Jul 2003 20:00:55 -0000	1.8
++++ art_render_gradient.c	25 Jul 2003 19:31:41 -0000
+@@ -63,15 +63,19 @@ char *alloca ();
+ typedef struct _ArtImageSourceGradLin ArtImageSourceGradLin;
+ typedef struct _ArtImageSourceGradRad ArtImageSourceGradRad;
+ 
++/* The stops will be copied right after this structure */
+ struct _ArtImageSourceGradLin {
+   ArtImageSource super;
+-  const ArtGradientLinear *gradient;
++  ArtGradientLinear gradient;
++  ArtGradientStop stops[1];
+ };
+ 
++/* The stops will be copied right after this structure */
+ struct _ArtImageSourceGradRad {
+   ArtImageSource super;
+-  const ArtGradientRadial *gradient;
++  ArtGradientRadial gradient;
+   double a;
++  ArtGradientStop stops[1];
+ };
+ 
+ #define EPSILON 1e-6
+@@ -208,7 +212,7 @@ art_render_gradient_linear_render_8 (Art
+ 				     art_u8 *dest, int y)
+ {
+   ArtImageSourceGradLin *z = (ArtImageSourceGradLin *)self;
+-  const ArtGradientLinear *gradient = z->gradient;
++  const ArtGradientLinear *gradient = &(z->gradient);
+   int i;
+   int width = render->x1 - render->x0;
+   int len;
+@@ -232,6 +236,7 @@ art_render_gradient_linear_render_8 (Art
+       printf ("%f, ", gradient->stops[i].offset);
+     }
+   printf ("\n");
++  printf ("a: %f, b: %f, c: %f\n", gradient->a, gradient->b, gradient->c);
+ #endif
+   
+   offset = render->x0 * gradient->a + y * gradient->b + gradient->c;
+@@ -240,12 +245,12 @@ art_render_gradient_linear_render_8 (Art
+   /* We need to force the gradient to extend the whole 0..1 segment,
+      because the rest of the code doesn't handle partial gradients
+      correctly */
+-  if ((gradient->stops[0].offset != 0.0) ||
+-      (gradient->stops[n_stops-1].offset != 1.0))
++  if ((gradient->stops[0].offset > EPSILON /* == 0.0 */) ||
++      (gradient->stops[n_stops-1].offset < (1.0 - EPSILON)))
+   {
+     extra_stops = 0;
+     tmp_stops = stops = alloca (sizeof (ArtGradientStop) * (n_stops + 2));
+-    if (gradient->stops[0].offset != 0.0)
++    if (gradient->stops[0].offset > EPSILON /* 0.0 */)
+       {
+ 	memcpy (tmp_stops, gradient->stops, sizeof (ArtGradientStop));
+ 	tmp_stops[0].offset = 0.0;
+@@ -253,7 +258,7 @@ art_render_gradient_linear_render_8 (Art
+ 	extra_stops++;
+       }
+     memcpy (tmp_stops, gradient->stops, sizeof (ArtGradientStop) * n_stops);
+-    if (gradient->stops[n_stops-1].offset != 1.0)
++    if (gradient->stops[n_stops-1].offset < (1.0 - EPSILON))
+       {
+ 	tmp_stops += n_stops;
+ 	memcpy (tmp_stops, &gradient->stops[n_stops-1], sizeof (ArtGradientStop));
+@@ -315,7 +320,7 @@ art_render_gradient_linear_render_8 (Art
+   */
+   for (ix = 0; ix < n_stops; ix++)
+     if (stops[ix].offset > offset_fraction ||
+-	(d_offset < 0.0 && stops[ix].offset == offset_fraction))
++	(d_offset < 0.0 && fabs (stops[ix].offset - offset_fraction) < EPSILON))
+       break;
+   if (ix == 0)
+     ix = n_stops - 1;
+@@ -328,8 +333,8 @@ art_render_gradient_linear_render_8 (Art
+   
+   assert (ix > 0);
+   assert (ix < n_stops);
+-  assert ((stops[ix-1].offset <= offset_fraction) ||
+-	  ((stops[ix].offset >= 1.0) && (offset_fraction <= 0.0)));
++  assert ((stops[ix-1].offset <= offset_fraction + EPSILON) ||
++	  ((stops[ix].offset > (1.0 - EPSILON)) && (offset_fraction < EPSILON /* == 0.0*/)));
+   assert (offset_fraction <= stops[ix].offset);
+   assert ((offset_fraction != stops[ix-1].offset) ||
+ 	  (d_offset >= 0.0));
+@@ -420,7 +425,7 @@ art_render_gradient_linear_render_8 (Art
+ 	    }
+ 	  while (!((stops[ix-1].offset <= offset_fraction &&
+ 		   offset_fraction < stops[ix].offset) ||
+-		   (ix == 1 && offset_fraction >= 1.0))); 
++		   (ix == 1 && offset_fraction > (1.0 - EPSILON)))); 
+ 	}
+       else
+ 	{
+@@ -432,7 +437,7 @@ art_render_gradient_linear_render_8 (Art
+ 	    }
+ 	  while (!((stops[ix-1].offset < offset_fraction &&
+ 		    offset_fraction <= stops[ix].offset) ||
+-		   (ix == n_stops - 1 && offset_fraction <= 0.0)));
++		   (ix == n_stops - 1 && offset_fraction < EPSILON /* == 0.0*/)));
+ 	}
+       
+       bufp += 4*len;
+@@ -517,7 +522,7 @@ art_render_gradient_linear_render (ArtRe
+ 				   art_u8 *dest, int y)
+ {
+   ArtImageSourceGradLin *z = (ArtImageSourceGradLin *)self;
+-  const ArtGradientLinear *gradient = z->gradient;
++  const ArtGradientLinear *gradient = &(z->gradient);
+   int pixstride = (render->n_chan + 1) * (render->depth >> 3);
+   int x;
+   int width = render->x1 - render->x0;
+@@ -584,13 +589,17 @@ art_render_gradient_linear (ArtRender *r
+ 			    const ArtGradientLinear *gradient,
+ 			    ArtFilterLevel level)
+ {
+-  ArtImageSourceGradLin *image_source = art_new (ArtImageSourceGradLin, 1);
++  ArtImageSourceGradLin *image_source = art_alloc (sizeof (ArtImageSourceGradLin) +
++						   sizeof (ArtGradientStop) * (gradient->n_stops - 1));
+ 
+   image_source->super.super.render = NULL;
+   image_source->super.super.done = art_render_gradient_linear_done;
+   image_source->super.negotiate = art_render_gradient_linear_negotiate;
+ 
+-  image_source->gradient = gradient;
++  /* copy the gradient into the structure */
++  image_source->gradient = *gradient;
++  image_source->gradient.stops = image_source->stops;
++  memcpy (image_source->gradient.stops, gradient->stops, sizeof (ArtGradientStop) * gradient->n_stops);
+ 
+   art_render_add_image_source (render, &image_source->super);
+ }
+@@ -606,7 +615,7 @@ art_render_gradient_radial_render (ArtRe
+ 				   art_u8 *dest, int y)
+ {
+   ArtImageSourceGradRad *z = (ArtImageSourceGradRad *)self;
+-  const ArtGradientRadial *gradient = z->gradient;
++  const ArtGradientRadial *gradient = &(z->gradient);
+   int pixstride = (render->n_chan + 1) * (render->depth >> 3);
+   int x;
+   int x0 = render->x0;
+@@ -682,7 +691,8 @@ art_render_gradient_radial (ArtRender *r
+ 			    const ArtGradientRadial *gradient,
+ 			    ArtFilterLevel level)
+ {
+-  ArtImageSourceGradRad *image_source = art_new (ArtImageSourceGradRad, 1);
++  ArtImageSourceGradRad *image_source = art_alloc (sizeof (ArtImageSourceGradRad) +
++						   sizeof (ArtGradientStop) * (gradient->n_stops - 1));
+   double fx = gradient->fx;
+   double fy = gradient->fy;
+ 
+@@ -690,7 +700,11 @@ art_render_gradient_radial (ArtRender *r
+   image_source->super.super.done = art_render_gradient_radial_done;
+   image_source->super.negotiate = art_render_gradient_radial_negotiate;
+ 
+-  image_source->gradient = gradient;
++  /* copy the gradient into the structure */
++  image_source->gradient = *gradient;
++  image_source->gradient.stops = image_source->stops;
++  memcpy (image_source->gradient.stops, gradient->stops, sizeof (ArtGradientStop) * gradient->n_stops);
++
+   /* todo: sanitycheck fx, fy? */
+   image_source->a = 1 - fx * fx - fy * fy;
+ 
--- libart ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list