[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cairo
Subject:    [cairo] rendering bug
From:       "Benjamin Otte" <otte () gnome ! org>
Date:       2007-10-29 21:56:34
Message-ID: a4ed255b0710291456g2ae5078fk388923ae3cdc7bd () mail ! gmail ! com
[Download RAW message or body]

Hi,

I have found a rare rendering bug in the xlib backend. It only happens
at a very specific scaling of the cairo context. If you want to
reproduce the original, get Swfdec and tennis.swf [1], resize it to
the same size as in this screenshot [2] and you will see the same
artifacts. Somehow, the topmost and leftmost pixel are not rendered.

As I knew you wouldn't like such a broad claim, I tried to cut it down
into a test, that test is attached. If you compare the output of
xlib-argb32 with the output of xlib-argb32-similar, you will notice
that the top- and leftmost lines are semi-transparent in one but not
the other test.

Excuse the output of that test, but it's autogenerated code that went
through my surgery. I have heavily patched Jeff's excellent
libcairowrap to capture the drawing output of cairo and emit it as C
code. So if you're interested in making test cases out of the stuff
your app draws, grab it at
git://people.freedesktop.org/~company/libcairowrap - it's very much a
work in progress, but I'll add features whenever I need to do a cairo
test.


Cheers,
Benjamin


[1] http://www.onemorelevel.com/games2/tennis.swf
[2] http://people.freedesktop.org/~company/stuff/rendering-issue.png

["foo.c" (text/x-csrc)]

  
#include "cairo-test.h"

static cairo_test_draw_function_t draw;

cairo_test_t test = {
    "foo",
    "Test an off-by-one bug that only happens at a certain size",
    24, 23,
    draw
};

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_surface_t *surface_0x88cba08 = cairo_surface_reference (cairo_get_target (cr));
    cairo_surface_set_device_offset(surface_0x88cba08, -334, -370);

    cairo_t *cr_0x8afeeb8 = cairo_create(surface_0x88cba08);
    cairo_set_operator(cr_0x8afeeb8, 2);
    cairo_set_fill_rule(cr_0x8afeeb8, 1);
    // starting rendering of 334 370 24 23
    cairo_save(cr_0x8afeeb8);
      cairo_translate(cr_0x8afeeb8, 122, 0);
      cairo_scale(cr_0x8afeeb8, 0.05516666666666666, 0.05516666666666666);
      cairo_save(cr_0x8afeeb8);
	cairo_push_group_with_content(cr_0x8afeeb8, 8192);
	  cairo_save(cr_0x8afeeb8);
	    {
	      cairo_matrix_t matrix = { 1, 0, 0, 3.75, 0, -16500 };
	      cairo_transform(cr_0x8afeeb8, &matrix);
	    };
	    cairo_set_source_rgb (cr_0x8afeeb8, 0, 0, 0);
	    cairo_rectangle (cr_0x8afeeb8, 0, 4400, 12000, 3200);
	    cairo_fill(cr_0x8afeeb8);
	  cairo_restore(cr_0x8afeeb8);
	cairo_pattern_t *pattern_0x8befee0 = cairo_pop_group(cr_0x8afeeb8);
	cairo_push_group(cr_0x8afeeb8);
	  cairo_push_group_with_content(cr_0x8afeeb8, 8192);
	    {
	      cairo_matrix_t matrix = { 1, 0, 0, 3.75, 0, -16500 };
	      cairo_transform(cr_0x8afeeb8, &matrix);
	    };
	    cairo_set_source_rgb (cr_0x8afeeb8, 0, 0, 0);
	    cairo_rectangle (cr_0x8afeeb8, 0, 4400, 12000, 3200);
	    cairo_fill(cr_0x8afeeb8);
	  cairo_pattern_t *pattern_0x8c45f78 = cairo_pop_group(cr_0x8afeeb8);
	  cairo_push_group(cr_0x8afeeb8);
	    cairo_set_source_rgb (cr_0x8afeeb8, 1, 1, 1);
	    cairo_rectangle (cr_0x8afeeb8, 1139, 5140, 3400, 3400);
	    cairo_fill(cr_0x8afeeb8);
	  cairo_pop_group_to_source(cr_0x8afeeb8);
	  cairo_mask(cr_0x8afeeb8, pattern_0x8c45f78);
	  cairo_pattern_destroy(pattern_0x8c45f78);
	cairo_pop_group_to_source(cr_0x8afeeb8);
	cairo_mask(cr_0x8afeeb8, pattern_0x8befee0);
	cairo_pattern_destroy(pattern_0x8befee0);
      cairo_restore(cr_0x8afeeb8);
    cairo_restore(cr_0x8afeeb8);
    cairo_destroy(cr_0x8afeeb8);
    cairo_surface_destroy(surface_0x88cba08);

    return CAIRO_TEST_SUCCESS;
}

int
main (void)
{
    return cairo_test (&test);
}


_______________________________________________
cairo mailing list
cairo@cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic