On Fri, Jun 03, 2016 at 11:49:18AM -0500, Jason Crain wrote:
> On Thu, Oct 31, 2013 at 08:38:40AM +0100, Christophe TROESTLER wrote:
> > The attached document displays well in windowed mode and in full
> > screen, EXCEPT when the full screen happens inside a Xephyr window.
> > All other pictures of the document were displayed fine (including
> > within xephyr).
> 
> This is not related to zephyr, but the image in this document sometimes
> disappears based on zooom levels.  You can see it by running:
> 
>     pdftocairo -r 100 -singlefile -png -f 1 -l 1 D.pdf a
> vs.
>     pdftocairo -r 150 -singlefile -png -f 1 -l 1 D.pdf a

The PDF contains drawing commands with large numbers like:

    0 0 m
    0 2147483647 l
    1098 2147483647 l
    1098 0 l
    W* n

And cairo doesn't deal well with it.  Whether anything is drawn varies
with the scale.  Attached C program reproduces this through just cairo.
#include <cairo.h>

int main (int argc, char *argv[]) {
    cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
                                                           100, 100);
    cairo_t *cr = cairo_create (surface);

    // behavior varies with scale, uncommenting the below line makes it work.
    // some scalings work and some don't, I don't see a pattern.
    // cairo_scale (cr, 0.9, 0.9);

    // cairo doesn't like this big number, clamping it also fixes it
    cairo_rectangle (cr, 0, 0, 100, 2147483647);
    cairo_clip (cr);
    cairo_rectangle (cr, 10, 10, 80, 80);
    cairo_fill (cr);

    cairo_surface_write_to_png (surface, "test.png");
    cairo_destroy (cr);
    cairo_surface_destroy (surface);
    return 0;
}

Reply via email to