Instead ensure the fill and stroke are each analyzed separately.
This fixes a bug in the PS output where if a fill-stroke with a
translucent fill resulted in a fallback image with the stroke clipped
to the fill path.
The PDF/PS backends change the ctm to user space when emitting and
stroking a path. When the user space ctm does not alter the pen shape
we can avoid changing the ctm.
This patch optimizes the most common case where the user ctm is
[1 0 0 -1 0 y] due to conversion from cairo to PDF coordinates.
Now that the PS backend is using PDF operators, it uses the glyph
metrics in the font to position each glyph in a string. This exposed a
bug in Type 1 fallback where the glyph width and height was used in
the charstrings instead of x_advance/y_advance. This was causing
strings to print diagonally due to the no zero y_advance.
In some cases (in my case, having an external monitor attached to my
MBP), Quartz seems to default to grayscale AA even when it should be
using subpixel AA. CGContextGetAllowsFontSmoothing returns FALSE in
this case (pretty sure this is a Quartz bug). We can force subpixel
AA in this case by setting CGContextSetAllowsFontSmoothing.
strdup() and friends require at least _BSD_SOURCE or
_XOPEN_SOURCE >= 500 to be defined for the prototypes to be included.
For the time being, add the define to each source file that requires one
of the BSD functions.
As _cairo_image_analyze_transparency() is only used on images in the
meta surface, we can store the results of the image analysis and
return the saved value on second and subsequent calls to analyze the
same image.
Previously each image was analyzed twice - once during
CAIRO_PAGINATED_MODE_ANALYZE and once during
CAIRO_PAGINATED_MODE_RENDER.
To help better understand when fallback images are used, a comment
similiar to the following is included with each fallback image in the
PS output.
% Fallback Image: x=101, y=478, w=50, h=10 res=300dpi size=31500
Creating a CGImage with interpolation set to FALSE means that
it will never be interpolated; otherwise the interoplation
is controlled by the destination context's interpolation
quality setting.
Implement REPEAT/REFLECT for gradients in Quartz: for linear gradients,
they're implemented natively (by extending the gradient region); for
radial gradients, we generate a fallback image using pixman and render
that.
A CoreGraphics bug was fixed so strokes are no longer incorrectly
drawn with antialiasing disabled; we no longer have to ignore
antialiasing for stroke(). Also, antialiasing was not being
correctly set for clip(). This fixes both issues.
Use cairo_format_stride_for_width() instead of assuming the pixel size
and manually calculating the row stride. This should make it easier to
support loading multiple image formats in future.
Check the user supplied values for validity and potential overflow,
returning -1 in such cases, and update the documentation to warn of the
new error return.
On some OOM paths, libpng raises a warning as opposed to an error,
these were not being propagated back to the caller. We were also not
checking that we did not overwrite a pre-existing error status when
raising an error whilst performing I/O.
Remove duplicate _cairo_error() by ensuring that the error status is
always propagated from the original error site. Note that in one case
this eliminates a potential _cairo_error(CAIRO_INT_STATUS_UNSUPPORTED)!
_cairo_surface_show_glyphs is allowed to mutate the glyph array; if it's
handed the internal array that the meta surface holds, then any subsequent
playback (such as for fine-grained fallbacks) will result in incorrect
glyph rendering.
Ref: https://bugzilla.mozilla.org/show_bug.cgi?id=419917
(I was unable to create a simple cairo testcase to demonstrate the problem.)