Bug 6157 - Incorrect drawing of thin lines on xlib surface
Summary: Incorrect drawing of thin lines on xlib surface
Alias: None
Product: cairo
Classification: Unclassified
Component: xlib backend (show other bugs)
Version: 1.0.2
Hardware: Other Linux (All)
: medium normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
Depends on:
Reported: 2006-03-06 17:31 UTC by Alexander Darovsky
Modified: 2006-03-05 22:55 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

a testcase (2.56 KB, text/plain)
2006-03-06 17:33 UTC, Alexander Darovsky
result of running a testcase (3.22 KB, image/png)
2006-03-06 17:37 UTC, Alexander Darovsky
added cairo_translate (3.21 KB, image/png)
2006-03-06 17:40 UTC, Alexander Darovsky

Description Alexander Darovsky 2006-03-06 17:31:57 UTC
I'm gonna port an app from native X to cairo, but I've discovered the 
following incompatibility: if I draw a thin 1 pixel line (with identity 
transformation matrix) I get it antialiased between 2 nearest lines.  
It looks like 2-pixel line with 0.5 alpha.  
cairo_translate(cr, 0.5, 0.5) makes it to produce expected results, but 
this is an ugly hack... 
Testcase is attached below
Comment 1 Alexander Darovsky 2006-03-06 17:33:46 UTC
Created attachment 4837 [details]
a testcase

Here is a testcase. It is mostly an example from cairo-demo/knockout.c, but
the only thing it draws is incorrectly antialiased line
Comment 2 Alexander Darovsky 2006-03-06 17:37:26 UTC
Created attachment 4838 [details]
result of running a testcase

this is a result of tescase being run as-is
Comment 3 Alexander Darovsky 2006-03-06 17:40:39 UTC
Created attachment 4839 [details]
added cairo_translate

if you change this testcase this way, you fill see (correct) picture

--- thin_line.old	2006-03-06 11:39:52.000000000 +0500
+++ thin_line.c 2006-03-06 11:39:55.000000000 +0500
@@ -62,6 +62,8 @@
					 win->width, win->height);
     cr = cairo_create(surface);

+    cairo_translate(cr, 0.5, 0.5);
     cairo_set_source_rgb(cr, 1, 1, 1);

     cairo_set_line_width(cr, 1.);
Comment 4 Behdad Esfahbod 2006-03-06 17:55:19 UTC
That's the way cairo coordinates are.  It won't change at this point.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.