[cairo] Recording surface as source. Bug? Cairo 1.12.11/1.12.12

Edward Zimmermann Edward.Zimmermann at cib.de
Fri Feb 1 01:38:56 PST 2013


We are having some odd problems with recording surface "playback".

Background: We want to use nested recording surfaces.

Below is a very simple test: three recording surfaces.
We play each back onto another surface but alter the matrix.

Draw a rectangle into recording surface 1.
recording surface 1 into recording surface 2.
recording surface 2 into recording surface 3.
recording surface 3 into a final image surface. From this we write a PNG file.

In our example we set the matrix: 0,-1,1,0,0,40 for the first and 0,-1,1,0,0,80 for the second round.
The PNG file does not contain our rectangle.

If we use an identity matrix it works as we expect: rectangle in the PNG file.
If we rotate it only once it shows up if we rotate it twice we get an empty canvas.

The interesting thing is: If we do the last playback to a vector surface such as PDF it works! If we play it back to the image surface.. Nothing..

Bug? Our stupidity? Ideas?

Dump follows:

%!CairoScript - test4
//COLOR_ALPHA [ 0 0 40 40 ] record dup /s0 exch def
context % c0
10 10 20 20 rectangle
1 0 1 1 set-source-rgba
stroke
1 1 1 1 set-source-rgba
//COLOR_ALPHA [ 0 0 80 80 ] record dup /s1 exch def
context % c1
save
0 -1 1 0 0 40 matrix transform
s0 pattern set-source
/source get /p0 exch def
p0
//FILTER_NEAREST set-filter
exch paint
restore
exch pop % p0 destroyed
/p0 undef
//COLOR_ALPHA [ 0 0 160 160 ] record dup /s2 exch def
context % c2
save
0 -1 1 0 0 80 matrix transform
s1 pattern set-source
/source get /p0 exch def
p0
//FILTER_NEAREST set-filter
exch paint
dict
  /width 842 set
  /height 842 set
  /format //ARGB32 set
  /content //COLOR_ALPHA set
  image dup /s3 exch def
context % c3
s3 0 0 595 842 subsurface % s4
exch 1 1 1 1 set-source-rgba
//SOURCE set-operator
1 paint-with-alpha
//OVER set-operator
0.8 0 0 0.8 41 165 matrix transform
5 set-line-width
s2 pattern set-source
/source get /p1 exch def
p1
//FILTER_NEAREST set-filter
exch paint
% s4 (dummy.png) write-to-png pop
3 -1 roll pop % s4 destroyed
exch pop % p1 destroyed
/p1 undef
pop % c3 destroyed
exch pop % p0 destroyed
/p0 undef
pop % c2 destroyed
pop % c1 destroyed
pop % c0 destroyed


This has been tested with both 1.12.11 (Linux 64-bit built using gcc) and 1.12.12 (Win32 32-bit built using Studio 9) so its not a platform/compiler thing.



More information about the cairo mailing list