We can only correct rounding errors between cairo and pixman matrices for
scaled matrices - so skip the inversion and point transformation overhead
for simple translation matrices.
Adrian Johnson discovered cases where we mistakenly compared the result
of unsigned arithmetic where we need signed quantities. Look for similar
cases in the users of cairo_rectangle_int_t.
_cairo_gstate_backend_to_user_rectangle() requires that its input
arguments are non-NULL and describe the input rectangle to be transformed.
However, we were passing through output parameters from the public API
which were allowed to be NULL. So we need to allocate temporary variables
in which to compute the output rectangle, but only copy them as required.
If the image was opaque with no alpha channel, we filled the output alpha
with 0. Typically, the destination surface for dithering is an RGB window,
so this bug went unnoticed. However, test/xlib-expose-event is an example
where we generate an intermediate alpha-only pixmap for use as a stencil
and this was failing as the mask was left completely transparent. The
simple solution is to ensure that for opaque images, the output alpha is
set to the maximum permissible value.
It's not fair to steal this name from the namespace of family names.
There are definitely cairo.ttf files that exist out there, and people
may already be using these, (or may use them in the future), with
cairo_select_font_face and a family name of "cairo".
In place of this, we'll want to come up with some other new, and
documented API for selecting the internal font face.
Carl spotted that 1db894 introduced an error into text_to_glyphs() such
that following an allocation error the code would attempt to thaw an
unfrozen glyph cache, leading to an attempt to unlock an unlocked mutex -
which causes a deadlock under win32.
Quartz fonts and user fonts use an indirect font face when creating a
scaled font for the toy font face. This means that they insert a scaled
font into the font map that has a different font face to the one that is
initially searched upon. The result is that when we try to create an
identical scaled font, we fail to find the existing scaled font and
attempt to insert a duplicate into the hash table - which triggers an
assert.
In order to avoid creating duplicate fonts, we add a new method to the
font backends that allows cairo_scaled_font_create() to peek at the
font_face that will be used to actually implement the scaled font
constructor - thus we are able to use the correct font_face as part of the
hash key.
After discussing the scaled font locking with Behdad, it transpired that it
is not sufficient for a font to be locked for the lifetime of a scaled glyph,
but that the scaled font's glyph cache must be frozen for the glyph'
lifetime. If the cache is not frozen, then there is a possibility that the
glyph may be evicted before the reference goes out of scope i.e. the glyph
becomes invalid whilst we are trying to use it.
Since the freezing of the cache is the stronger barrier, we remove the
locking/unlocking of the mutex from the backends and instead move the
mutex acquisition into the freeze/thaw routines. Then update the rule on
acquiring glyphs to enforce that the cache is frozen and review the usage
of freeze/thaw by all the backends to ensure that the cache is frozen for
the lifetime of the glyph.
Mention in the API docs that you can pass a NULL filename to
cairo_(pdf|ps|svg)_surface_create in order to construct a queryable
surface without generating any temporary files. Similarly when passing a
NULL write_func to cairo_pdf_surface_create_for_stream et al.
The current version of DirectFB does not support any filters, so set
NEAREST on the source patterns so that we can fully optimize the pattern
inside core.
If we have non-integer translation on a source pattern then we need to use
STRECTHBLIT (the core takes care to optimize NEAREST patterns to integer
translations so that this will only be used when interpolation is
required).
Allow the user to specify a NULL write_func for the output stream so that
a dummy surface can be created, for example, for querying target font
options or font extents.
Currently we do not perform any sanity checks at the user entry point and
will generate a mysterious SEGV during cairo_surface_finish() - which may
not immediately be obvious that it is due to a NULL write_func.