This reverts the following commits:
2715f2098167e3b3c53b
See this thread for an analysis of the problems it caused:
http://lists.freedesktop.org/archives/cairo/2007-February/009825.html
In short, a single cache for all backends doesn't work, as one thread
using any backend can cause an unused xlib pattern to be evicted from
the cache, and trigger an xlib call while the display is being used
from another thread. Xlib is not prepared for this.
That is, we always emit at least one page of output. Otherwise our
PS/PDF/SVG files would be corrupt, and output with zero pages does
not make much sense.
This means, PS/PDF/SVG do not need the final cairo_show_page() anymore.
If there is any drawing in the page, a cairo_show_page() is done
automatically.
Previously we were generating an image object with the desired
transform and then a pattern with only a translation. This means,
the pattern was alwasys axis-aligned. Obviously this does not
work correctly with repeated rotated patterns.
We now use an identity matrix for the image and put all the
pattern transformation (well, it's inverse) into the pattern.
This fixes the issue nicely.
The surface-pattern test is still failing even with a reference
image, because the gs rendering of the normal case and the
device-offset=25 case are different and both have seams.
With the hack in _cairo_pattern_acquire_surface to return a 2x2
surface for reflected patterns, we can now accept REFLECT surface
patterns natively in all backends. SVG was already doing that.
The PDF case needed some changes to go through
_cairo_pattern_acquire_surface. A similar change to the recent
change in SVG.
This change is required for the upcoming hack to support
CAIRO_EXTEND_REFLECT. In short, the idea is that the surface returned
by _cairo_pattern_acquire_surface may look different from the one
returned by _cairo_surface_acquire_source_image, to support some pattern
modes not supported by the backends directly.
This was needed for SVG backend because it does not implement clone_similar.
However, I'm worried about possible infinite recursion here. Not sure what
to do.
We do this through a hack, that is, we make
_cairo_pattern_acquire_surface to return a surface that has four
copies of the original surface painted such that this image can
be simply repeated to get the effect of reflecting the original
surface.
This fixes the formerly XFAIL test extend-reflect.
The PS backend was accepting all surface patterns, just to ASSERT_NOT_REACHED
later if extend type of the pattern was PAD or REFLECT. That didn't make
sense and was causing crash for PAD (surprisingly not for REFLECT. Not sure
why). So now it rejects those types of surface patterns, just like the PDF
surface does.
for surface patterns.
Right before releasing cairo 1.2, Carl and I decided to return error on
CAIRO_EXTEND_PAD and CAIRO_EXTEND_REFLECT for surface patterns, as they
are not implemented and one was causing crashes. Well, that was probably
the worst decision we could make (other than ignoring the problem). A
much better decision would have been to make them act like
CAIRO_EXTEND_NONE and CAIRO_EXTEND_REPEAT respectively. Anyway, remove
the error paths.
Previous commit broke cairo_surface_finish, since it was checking for
ref_count == CAIRO_REF_COUNT_INVALID and bailing. But, that condition
was reached from destroy, so finish was bailing out early.
user_data setters/getters were added to public refcounted objects
that were missing them (cairo_t, pattern, scaled_font). Also,
a refcount getter (cairo_*_get_reference_count) was added to all
public refcounted objects.
Two drawables can be used in an X and Render operation only if they share
the same screen. Previously we were only checking for the same display
in is_compatible. Check for the same screen now.
David Turner said:
The returned 26.6 advance is always rounded, even with FT_LOAD_NO_HINTING.
You can however retrieve the linearly scaled value as a 16.16 fixed float
number through face->glyph->linearHoriAdvance. This works even with hinted
glyphs.
The bug was that the bounding box of the image was computed by transforming
the vector (width,height) and then using 0,0,width,height as the bounding box.
This is obviously wrong. We use _cairo_matrix_transform_bounding_box() now.
This fixes the XFAIL test rotate-image-surface-paint.
cairo-scaled-font-subsets stores two sets of subsets -
scaled and unscaled. The first time each glyph is mapped,
_cairo_scaled_glyph_lookup() is called to determine if
the glyph is bitmap or outline. Outline glyphs are put
in the unscaled subsets. Bitmap glyphs are put in the
scaled subsets. The unscaled subsets hash table keyed is
the scaled_font->font_face to ensure only one font for
each font face is created. The scaled subsets hash
table is keyed by scaled_font.
_cairo_scaled_font_subsets_create() now takes two arguments
to specify the maximum size of the scaled and unscaled subsets.
If the unscaled max size is set to 0 all glyphs are mapped
to scaled subsets.
A separate foreach function is provided for scaled and unscaled
subsets. The PDF and PS backends iterate over the unscaled
subsets to emit CFF, TrueType, and Type1 fonts. The scaled
subsets are iterated to emit Type3 bitmap fonts.
We now test for windows.h availability to automatically enable win32
backends. This nicely enables compiling cairo against libwine by just
setting CC=winegcc LD=winegcc during configure. This currently only
generates static libs though.
Adds some state, 'dash_starts_on', to keep track of whether a dashed path
starts with dash_on or not. This fixes the 'leaky-dash' bug (#4863) and
some other degenerate cases. The new version is, in my opinion,
considerably cleaner and more understandable than the old code.
Finally, the rewrite changes the behaviour of dashing to add degenerate
caps around corners that start at the same place as a dash begins. This
matches the behaviour seen in acroread.
This rewrite is based on an initial rewrite done by Jeff Smith.
has_initial_sub_path more accurately describes the condition we want to
track. This flag is used to indicate when an initial sub_path needs capping
but has no associated slope and thus no associated faces.