Whilst writing the base85 stream we advance an extra character if we spot
a '~', however we need to be paranoid that we have not stepped beyond the
end of the data for this write.
libpng changed behaviour in v1.2.30 to call the png_ptr->output_flush_fn
in png_write_end(). If no flush function is provided with
png_set_write_fn(), libpng will use its default fflush() instead - which
assumes that closure passed is a FILE* and not an arbitrary user pointer.
Consequently, we must actually set a dummy output_flush_fn to avoid
segfaulting.
We added cairo_has_show_text_glyphs() before. Since this is really a
surface property, should have the surface method too. Like we added
cairo_surface_show_page()...
The test-suite for win32 shows less than ideal error detection whilst
running on mingw32. Looking at the code, I spotted a few places where the
error propagation could be improved, and lo...
_cairo_cache_remove_random() just returned whether it found an entry to
remove and so the code can be simplified by returning a boolean as opposed
to a status code.
valgrind warns about an uninitialized read after a single char is promoted
to an int when passed to the printf. Silence the warning by using a
explicitly promoting the output byte to a full int.
When searching for a matching font, check the most recently used font
first. This optimizes the common case where pango calls save() and restore()
around rendering each layout, but almost all consecutive layouts use the
same font.
By inspecting all the users of the close display hooks, we can see that
(a) the key is redundant and (b) the data is unique to the hook. This
means we can trim the interface and stop the linear searches as soon as
we've found the correct element.
cairo_surface_get_font_options() has the side effect of initialising the
font options on the surface, but fails to check that the surface is
valid first. Therefore if we are passed a read-only error object, we will
trigger a segmentation fault.
Most likely this is the bug behind:
http://bugs.freedesktop.org/show_bug.cgi?id=17096.
Validate that we find an appropriate depth for the Xlib surface, before
attempting to create the surface. This was manifesting itself with
XInitImage() failures during _draw_image_surface() (actually detected as
a segmentation fault in XPutPixel() due to an incomplete XImage). So we
also add a couple of asserts to ensure that XInitImage() is successful -
which to the best of our knowledge, they should always be.