Package: librsvg2-2
Version: 2.36.1-2
File: librsvg
Severity: normal

The attached test program (compiled with gcc `pkg-config --cflags
--libs librsvg-2.0` test.c) sometimes outputs the following (where
the output of "Test" is missing):

Test:
     
     
     
     
     
Should be:
     
     
     
*****
*****

The bug seems to depend on various circumstances, e.g. the presence
of the (transparent) first path, or the scale factor.

It doesn't always happen. If you e.g. run the test with "watch -n0",
you can see the "Test" result appear and disappear, seemingly at
random.

I don't know if the bug is in librsvg oder libcairo etc., but since
I'm seeing it with SVG rendering, I'm reporting it here first.

-- System Information:
Debian Release: 7.6
  APT prefers stable
  APT policy: (900, 'stable'), (500, 'stable-updates'), (500, 
'proposed-updates')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-4-686-pae (SMP w/6 CPU cores)
Locale: LANG=de_DE, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages librsvg2-2:i386 depends on:
ii  libc6               2.13-38+deb7u4
ii  libcairo2           1.12.2-3
ii  libcroco3           0.6.6-2
ii  libgdk-pixbuf2.0-0  2.26.1-1
ii  libglib2.0-0        2.33.12+really2.32.4-5
ii  libpango1.0-0       1.30.0-1
ii  libxml2             2.8.0+dfsg1-7+wheezy1
ii  multiarch-support   2.13-38+deb7u4

Versions of packages librsvg2-2:i386 recommends:
ii  librsvg2-common  2.36.1-2

Versions of packages librsvg2-2:i386 suggests:
ii  librsvg2-bin  2.36.1-2

-- no debconf information
#include <string.h>
#include <stdio.h>
#include <librsvg/rsvg.h>
#include <librsvg/rsvg-cairo.h>

void test (const char *s, int scale)
{
  GError *e = NULL;
  RsvgHandle *r = rsvg_handle_new_from_data ((const unsigned char *) s, strlen (s), &e);
  cairo_surface_t *u = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1000, 1000);
  cairo_t *c = cairo_create (u);
  cairo_scale (c, scale, scale);
  rsvg_handle_render_cairo (r, c);
  unsigned char *d = cairo_image_surface_get_data (u);
  int i, j;
  for (j = 0; j < 1000; j += 200)
    {
      for (i = 0; i < 1000; i += 200)
        putchar (d[(j * 1000 + i) * 4] ? '*' : ' ');
      putchar ('\n');
    }
  cairo_destroy (c);
  cairo_surface_destroy (u);
  g_object_unref (r);
}

int main ()
{
  g_type_init ();
  printf ("Test:\n");
  test ("<svg viewBox=\"0 0 30 30\" width=\"30\" height=\"30\">"
        "<path style=\"stroke:white; opacity:0;\" d=\"m 0,0 l 1,0\" />"
        "<path style=\"stroke:white; opacity:1;\" d=\"m 0,1 l 1,0\" />"
        "</svg>", 900);
  printf ("Should be:\n");
  test ("<svg viewBox=\"0 0 30 30\" width=\"30\" height=\"30\">"
        "<path style=\"stroke:white; opacity:1;\" d=\"m 0,1 l 1,0\" />"
        "</svg>", 900);
}

Reply via email to