Bug 19584

Summary: Setting x co-ords as double appears to affect y co-ords too in set_source_surface
Product: cairo Reporter: Karl Lattimer <karl>
Component: xlib backendAssignee: Carl Worth <cworth>
Status: RESOLVED NOTABUG QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.8.0   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Karl Lattimer 2009-01-15 07:43:14 UTC
In some cairo code I've been battling with I've found something particularly weird.

here's an example, I'm hoping someone can confirm (i'm using vala).

--
double x = 0.5;
double y = 0;

cr.set_source_surface(surface, x, y);
cr.paint();
--

For some reason the surface gets vertically offset by 0.5px as well. In order to fix the bug I had to do this;

--
int x = 0.5; // not really, but essentially the same code
int y = 0;

cr.set_source_surface(surface, x, y);
cr.paint();
--

And the bug is gone :/
Comment 1 Chris Wilson 2009-01-24 10:26:07 UTC
This is the expected behaviour. The x-,y-coordinates to cairo_set_source_surface() is an offset of the origin of the surface with respect to the current transformation origin, i.e. the position at which you wish the surface to appear.

http://cairographics.org/manual/cairo-context.html#cairo-set-source-surface

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.