Bug 14248

Summary: Gradient pattern with matrix transform causes error
Product: cairo Reporter: Richard Hult <richard>
Component: quartz backendAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium CC: Brian.Ewins, vladimir
Version: 1.5.7   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Minimal test case

Description Richard Hult 2008-01-25 07:08:49 UTC
Trying to run GTK+ on quartz with the clearlooks theme produces an error in the terminal, and vertical scrollbars are not drawn. I will attach a small testcase that uses the same code as clearlooks, using only cairo.

The error is:

<Error>: CGBitmapContextGetBitsPerPixel: invalid context

and from what I can tell it's from the fallback surface code, that wants a bitmapcontext but probably gets a real context?
Comment 1 Richard Hult 2008-01-25 07:10:25 UTC
Created attachment 13935 [details]
Minimal test case
Comment 2 Richard Hult 2008-02-01 14:02:36 UTC
Adding Brian to CC, hope that's OK.

To clarify what the test case shows: gradient patterns cause an error as soon as there is a transformation in place.

Comment 3 Brian Ewins 2008-02-01 15:03:34 UTC
(it's always ok to CC me on bugs, btw)

At first I thought this was the problem we've seen with clearlooks on mac forever - it pushes at the things (like transparency) that require fallback. However, erroring because of the /transform/ is surprising. I'll take a dig into that over the weekend.
Comment 4 Richard Hult 2008-02-02 10:36:10 UTC
Thanks, let me know if you want me to test any patches or so.
Comment 5 Richard Hult 2008-03-07 12:33:47 UTC
Vlad, I noticed that you fixed the warning that I mention in this bug, "CGBitmapContextGetBitsPerPixel: invalid context". If I got things right, that was just a harmless warning so the actual problem here probably is caused by something else. Do you have any idea what it might be?
Comment 6 Vladimir Vukicevic 2008-03-07 12:43:50 UTC
It was, I don't think that there's an actual error here at all.  That call/path was just used to see if a certain optimization could be used.  As long as the rendering is correct, this can probably be resolved as one of NOTABUG/INVALID/WORKSFORME.

If the rendering isn't correct though, then we have a problem :)
Comment 7 Richard Hult 2008-03-07 12:55:58 UTC
Ah, I wasn't quite clear :) There is a visual error, the simple test case attached here shows it clearly, run it with and without the matrix transformation:

  /* This transformation seems to be what triggers the error: */
  cairo_matrix_init (&matrix, 0, 1, 1, 0, 0, 0);
  cairo_transform (cr, &matrix);         // <-- comment out this line to get it working


The result is an empty window vs a black to white gradient across the whole window.

Btw, I just noticed that the warning fix doesn't work:

+    CGContextGetTypePtr = dlsym(RTLD_DEFAULT, "CGContextGetTypePtr");

The "Ptr" part of the symbol looks like a typo.

Comment 8 Vladimir Vukicevic 2008-03-07 13:40:44 UTC
Ah, ok!  I'll take a look.  Good catch on the Ptr bit, I didn't have a good testcase for the warning and was able to only trigger it sporadically through firefox.  I'll fix that and take a look at the rendering error.
Comment 9 Vladimir Vukicevic 2008-03-07 16:47:39 UTC
Just checked in a fix for this -- fb1378a24b5c6cd65b73aa611bb049ebb6f2b57a.
Comment 10 Richard Hult 2008-03-08 00:47:46 UTC
Awesome, thanks!

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.