Bug 92044 - Matrix operations offset draw on widget creation.
Summary: Matrix operations offset draw on widget creation.
Status: RESOLVED NOTABUG
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: Chris Wilson
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-18 22:56 UTC by Chris S. Cowles
Modified: 2015-09-20 11:25 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Source files illustrating cairo matrix offset bug. (1.63 KB, text/plain)
2015-09-18 22:56 UTC, Chris S. Cowles
Details

Description Chris S. Cowles 2015-09-18 22:56:34 UTC
Created attachment 118353 [details]
Source files illustrating cairo matrix offset bug.

When using cairo (version 1.14.3) in creating a widget, matrix use causes image to be offset within the cairo_t.  This can be illustrated by drawing with/without an identity matrix. (Matrix is needed for image rotation on widget.) An example is attached. Define "USE_MATRIX" in the header file to turn on the error. Environment used: Debian 4.8.4-1, Linux version 3.16.0-4-amd64, gcc version 4.9.2
Comment 1 Uli Schlachter 2015-09-20 11:25:55 UTC
This works as documented. Try using things like cairo_rotate() instead of overwriting the matrix. At least try something like this:

cairo_matrix_t matrix, identity_matrix;
cairo_get_matrix(cr, &matrix);
cairo_matrix_init_identity(&identity_matrix); // This makes no sense, but feel free to replace with a rotation
cairo_matrix_multiply(&matrix, &matrix, &identity_matrix);
cairo_set_matrix(cr, &matrix);

(Technical detail: Gtk is giving you a cairo context onto a large surface and uses the matrix so that it appears to you as if the surface's (0, 0) were at the top-left corner of your widget. If you ignore the matrix, stuff breaks.)


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.