Bug 9302

Summary: Cairo 1.2 has a broken implementation of EXTEND_PAD and EXTEND_REFLECT for surface patterns.
Product: cairo Reporter: Elfi Heck <eheck>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: blocker    
Priority: high CC: mail, Ralph.Soika
Version: 1.2.4   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Elfi Heck 2006-12-11 02:35:10 UTC
The Eclipse SWT library uses Cairo to do advanced drawing. Only, when Cairo 1.2
is installed it stops drawing anything in advanced graphics mode after an
attempt to draw an image is made. This is not a problem with Cairo 1.0.
There must be something SWT does that confuses Cairo, or Cairo 1.2 is more
easily confused than Cairo 1.0.
The issue has been reported in Eclipse's Bugzilla too (with test cases):
https://bugs.eclipse.org/bugs/show_bug.cgi?id=150357.
Comment 1 Behdad Esfahbod 2006-12-11 03:01:29 UTC
You should check the status of the cairo_t that this happens to. 
cairo_status_to_string (cairo_status (cr)) may be helpful.

The only thing I can think of is the CAIRO_EXTEND_PAD that is new to 1.2, but
not implemented for surface patterns.  If you have code that sets
CAIRO_EXTEND_PAD when compiled against cairo 1.2, that may be it.
Comment 2 Elfi Heck 2006-12-11 03:19:40 UTC
The SWT image drawing code contains a line:
"Cairo.cairo_pattern_set_extend(pattern, Cairo.CAIRO_EXTEND_REFLECT);".
I just tried removing it and really the drawing succeeds. I don't know anything
about cairo, could you tell me what this statement would be good for and what
problems I'd have to expect when using a patched SWT version without it?
Comment 3 Behdad Esfahbod 2006-12-11 03:34:50 UTC
Ah, right.  That's a known bug.  Our extend-reflect test case has this comment:

Test CAIRO_EXTEND_REFLECT for surface patterns
CAIRO_EXTEND_REFLECT code is broken and corrupts memory

and the tests fail.

What that does is, it makes the pattern (the image) be tiled, but with reflected
copies.  That is, if the image you are painting looks like "b", then if you
paint a large surface out of it, with CAIRO_EXTEND_NONE you get:

 .......
 .......
 ...b...
 .......
 .......

with CAIRO_EXTEND_REPEAT you get:

 bbbbbbb
 bbbbbbb
 bbbbbbb
 bbbbbbb
 bbbbbbb

with CAIRO_EXTEND_REFLECT you are supposed to get:

 dbdbdbd
 qpqpqpq
 dbdbdbd
 qpqpqpq
 dbdbdbd

So, depending on what you / SWT is doing, this may not be necessary.  Or at
least you can avoid it for surface patterns.
Comment 4 Ralph Soika 2007-02-20 08:20:04 UTC
When we will get the fix for that issue? In the Eclipse Bug report https://bugs.eclipse.org/bugs/show_bug.cgi?id=150357 the discussion goes further and it seems that this could not be fixed by the eclipse team.
The new IBM Expeditor software (Lotus Notes 8) also runs in that problem so a lot of people will need a workaround soon. So maybe there is a workaround known? Thanks
Comment 5 Carl Worth 2007-02-20 10:16:42 UTC
(In reply to comment #4)
> When we will get the fix for that issue?

I'm marking this as a blocker for the cairo 1.4 release, (and retitling the bug to indicate that it's broken EXTEND_PAD and EXTEND_REFLECT for surface patterns that is the bug---nothing SWT-specific).

But I will follow up a bit on the linked bugs.

-Carl
Comment 6 Behdad Esfahbod 2007-03-01 19:13:30 UTC
EXTEND_REFLECT is fixed in master already.  EXTEND_PAD does not result in an error anymore.  It just acts like EXTEND_NONE for now.
Comment 7 Elfi Heck 2007-03-02 10:51:53 UTC
When's 1.4 due? The roadmap says something about January 2006 (did you mean 2007?) or how is that line in the "Themes and Schedules" section to be understood?
Comment 8 Carl Worth 2007-03-02 11:19:44 UTC
(In reply to comment #7)
> When's 1.4 due?

Minutes, not hours, (or, as soon as I can type up the release notes).

> The roadmap says something about January 2006 (did you mean
> 2007?) or how is that line in the "Themes and Schedules" section to be
> understood?

Uhm, yeah, that should have said 2007. And yeah, we should have updated that since the date passed. We're lame.

-Carl


Comment 9 Markus Thielmann 2007-03-13 11:35:18 UTC
> Uhm, yeah, that should have said 2007. And yeah, we should have updated that
> since the date passed. We're lame.

Could you give a hint on how to fix this problem for Cairo 1.3.14? Ubuntu Feisty will be based on this version and as it seems it's blocker for Lotus Notes 8. I'd love to prepare an patch for ubuntu's version, but I need some advice on what to patch :-)
Comment 10 Behdad Esfahbod 2007-03-13 12:29:22 UTC
This is fixed in cairo 1.4.
EXTEND_REFLECT works, and EXTEND_PAD simply acts like EXTEND_NONE for surface patterns.

That said, EXTEND_REFLECT is sometimes triggering a bug in some X servers, causing it to go into an almost infinite loop and then crash.  We are investigating that.
Comment 11 Markus Thielmann 2007-03-13 12:33:44 UTC
(In reply to comment #10)

> This is fixed in cairo 1.4.

I know, but Feisty won't be shipped with Cairo 1.4. So I need a fix for 1.3.14 (a "backpatch")which is just fixing this issue, without changing cairos behavior and without opening other bugs.
Comment 12 Behdad Esfahbod 2007-03-13 12:54:21 UTC
(In reply to comment #11)
> (In reply to comment #10)
> 
> > This is fixed in cairo 1.4.
> 
> I know, but Feisty won't be shipped with Cairo 1.4. So I need a fix for 1.3.14
> (a "backpatch")which is just fixing this issue, without changing cairos
> behavior and without opening other bugs.

Doesn't make any sense.  1.3.14 is a development snapshot.

Comment 13 Markus Thielmann 2007-03-13 12:59:52 UTC
> Doesn't make any sense.  1.3.14 is a development snapshot.

Didn't know that, thanks for your time. Got it working with 1.3.14 and little editing. I'm sure any possible side-effects will be eliminated when ubuntu updates to 1.4.0. At least Notes does start now! :-)

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.