Commit graph

4873 commits

Author SHA1 Message Date
Adrian Johnson
112bbacea3 Don't use fill-stroke during analysis
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.
2008-03-15 00:28:21 +10:30
Adrian Johnson
112b43452d Fix bug in _cairo_path_fixed_is_equal
Ensure the entire path is compared.
2008-03-15 00:18:59 +10:30
Adrian Johnson
7e83d6e6fb Do not use PDF fill-stroke operator with transparent fill
because the PDF rendering does not match cairo. See
PDF Reference 7.6.3.

Bug report at
https://bugs.launchpad.net/inkscape/+bug/202096
2008-03-14 21:37:14 +10:30
Adrian Johnson
0aef7c1a34 PDF/PS: Optimize away the stroke ctm when not required
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.
2008-03-14 19:46:51 +10:30
Adrian Johnson
2bd15d080c Add PS reference image for stroke-ctm-caps 2008-03-14 19:46:15 +10:30
Jeremy Huddleston
761b4ce8dd [mac] Correctly handle endianness in multi-architecture compiles on MacOS X 2008-03-13 17:45:25 -07:00
Vladimir Vukicevic
4cc93881d9 [test] Add testcase for previous stroker regression fix
Add Adrian's original testcase for reproducing the stroker device
vector issue.  (b4f518f917)
2008-03-13 17:30:59 -07:00
Vladimir Vukicevic
a33351f9c6 [quartz] remove some compiler warnings 2008-03-13 15:37:57 -07:00
Vladimir Vukicevic
b4f518f917 Correctly pass the device-space vector through to stroker
Part of the earlier optimization caused the wrong slope to be used for
some computations; this passes the correct slope vector down to
_compute_face.
2008-03-13 15:37:57 -07:00
Adrian Johnson
5050c55f93 Use the correct glyph metrics in Type1 fallback
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.
2008-03-13 21:37:32 +10:30
Vladimir Vukicevic
ed452713cf [win32] Use a DIB when cloning a surface for a WIN32_PRINTING dest
In some cases we were creating a 1bpp temporary surface, losing all
color/grayscale data while printing.

Ref: https://bugzilla.mozilla.org/show_bug.cgi?id=399388
2008-03-12 18:33:21 -07:00
Vladimir Vukicevic
6ac3eb487c [quartz] correctly force subpixel AA on a context, even if defaults say otherwise
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.
2008-03-12 18:33:21 -07:00
Vladimir Vukicevic
5d11b937f1 [quartz] Apply fixup to unbounded operators to clear area outside of mask 2008-03-12 18:33:21 -07:00
Chris Wilson
c86cbcdd64 [cairoint.h] Mark _cairo_image_analyze_transparency as private.
Add the required cairo_private markup for make check.
2008-03-12 17:55:55 +00:00
Chris Wilson
222eb6f140 Define _BSD_SOURCE to enable prototypes for strdup, snprintf.
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.
2008-03-12 17:52:16 +00:00
Adrian Johnson
2d9203c349 win32-printing: Don't scale the miter limit
since the miter is a ratio it should not be scaled like the other
stroke parameters when the user ctm is scaled.
2008-03-10 22:30:16 +10:30
Adrian Johnson
f534fe434d PDF: Use cairo_image_analyse_transparency during analysis
OPERATOR_SOURCE is only supported for opaque images. Check if and ARGB
image really contains transparency before returing unsupported.
2008-03-10 17:23:10 +10:30
Adrian Johnson
61d45c9d1f Remember the results of _cairo_image_analyze_transparency
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.
2008-03-10 17:04:01 +10:30
Adrian Johnson
7eb8f497d8 Move analyze_image_transparency in to cairo-image-surface.c 2008-03-10 17:02:31 +10:30
Adrian Johnson
00091d50a6 Add fallback image comment to PS output
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
2008-03-09 16:44:18 +10:30
Adrian Johnson
95acec69d8 Round fallback image size up instead of down
to ensure the fallback image completely covers the fallback region.
2008-03-09 16:40:25 +10:30
Vladimir Vukicevic
94e41d5565 [quartz] Don't force interpolation off for images
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.
2008-03-08 17:45:47 -08:00
Vladimir Vukicevic
08e38d3f20 [quartz] align strides to 16 bytes, as per apple docs
The docs indicate that doing so can yield a peformance win, so we align
ARGB32/RGB24 surface strides to 16 bytes.
2008-03-08 16:06:01 -08:00
Vladimir Vukicevic
73444f16fa [quartz] Don't try to call CGBitmapContextCreateImage on non-bitmap contexts 2008-03-08 15:31:15 -08:00
Vladimir Vukicevic
091df2c59b [quartz] properly honor text antialiasing modes in show_glyphs 2008-03-08 15:16:05 -08:00
Vladimir Vukicevic
4f7ac14b8f [quartz] implement REPEAT/REFLECT for gradients
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.
2008-03-08 15:15:45 -08:00
Vladimir Vukicevic
869942a97e [quartz] some more quartz ref images 2008-03-07 16:55:47 -08:00
Vladimir Vukicevic
2e33d5f57b [quartz] Update a bunch of reference images
Generated with Bitstream Vera font family installed, using ATSUI
font backend.
2008-03-07 16:46:53 -08:00
Vladimir Vukicevic
fb1378a24b [quartz] Correctly handle gradients with non-identity pattern transform
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=14248
2008-03-07 16:46:15 -08:00
Vladimir Vukicevic
6c7610067f [quartz] handle antialiasing correctly in stroke() and clip()
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.
2008-03-07 15:35:31 -08:00
Vladimir Vukicevic
21dab3c5e9 [quartz] look up the right symbol name for CGContextGetType 2008-03-07 14:49:46 -08:00
Vladimir Vukicevic
e52bad5e33 [quartz] split out (experimental) quartz-image into separate file 2008-03-07 14:49:15 -08:00
Vladimir Vukicevic
b52f127c12 [quartz] fix text rendering with gradient or image source
A quirk in how CGContextShowGlyphsWithAdvances works was causing all
non-solid glyphs to be rendered on top of eachother.  This fixes the problem.
2008-03-06 16:53:39 -08:00
Chris Wilson
de515e0f9a [cairo-png] Revert accidental chunk from FORMAT_A1 support.
Whilst splitting the patches, I left in this line which would preserve
1-bit grayscale unexpanded, but without any of the other FORMAT_A1
support.
2008-03-06 08:10:16 +00:00
Chris Wilson
8ba8a11924 [win32] make check doc fixup.
Add the missing '%' to the macro as demanded by make check.
2008-03-04 13:59:57 +00:00
Chris Wilson
1dd894115e [cairo-pattern] Raise an error for _cairo_pattern_create_solid() failure.
Add a missing _cairo_error() for the malloc failure in
_cairo_pattern_create_solid().
2008-03-04 09:31:21 +00:00
Chris Wilson
5efc5238d5 [cairo-hull] Propagate error during hull computation.
Propagate the original error status instead of returning a new NO_MEMORY
error.
2008-03-04 09:31:21 +00:00
Chris Wilson
11a2444ec8 [cairo-png] Support generating CAIRO_FORMAT_RGB24 from PNGs.
If the PNG does not have an alpha channel, then create an opaque image.
2008-03-04 09:31:21 +00:00
Chris Wilson
06b375aee9 [cairo-png] Use cairo_format_stride_for_width()
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.
2008-03-04 09:31:21 +00:00
Chris Wilson
b181f40949 [test/a8-mask] Check negative strides as well.
Check that we also allow surfaces to be created using a negative stride.
2008-03-04 09:31:20 +00:00
Chris Wilson
b6eb1c5c92 [cairo-image-surface] Harden cairo_format_stride_for_width().
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.
2008-03-04 09:31:20 +00:00
Chris Wilson
c06d929325 [cairo-png] Further hardening against malloc failures.
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.
2008-03-04 09:31:20 +00:00
Chris Wilson
c985096e6d [cairo-xlib] Tidy usage of _cairo_error().
Avoid a duplicate call to _cairo_error() and add a missing one.
2008-03-04 09:31:20 +00:00
Chris Wilson
914f4a3ec5 [cairo-pattern] Tidy usage of _cairo_error().
Remove the duplicate calls to _cairo_error() along the constructor
error paths and a missing call to _cairo_error().
2008-03-04 09:31:20 +00:00
Chris Wilson
d9fb4d4bc5 [cairo-ft-font] Simplify return of the nil font face during construction.
Simply return the nil font face from the internal constructor rather
than returning NULL and repeating the same fixup in the callers.
2008-03-04 09:31:20 +00:00
Chris Wilson
fd7d5d6e1d [cairo-clip] Raise _cairo_error() at original error site.
In a couple of places where we detect an error and return an error
object to the user, we did not throw a _cairo_error().
2008-03-04 09:31:20 +00:00
Chris Wilson
1654510a34 [cairo-cff-subset] Propagate error status.
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)!
2008-03-04 09:31:20 +00:00
Chris Wilson
3b93d90edd [cairo-type1-fallback] Propagate original error status.
_cairo_error() has already been called at the originating error site, so
remove the duplicate (hard-coded!) call at the return statement.
2008-03-04 09:31:20 +00:00
Chris Wilson
141c54cd27 [cairo-truetype-subset] Remove duplicate _cairo_error().
_cairo_error() has already been called at the originating error site, so
remove the duplicate call at the return statement.
2008-03-04 09:31:19 +00:00
Vladimir Vukicevic
d89edde84d [meta] always copy glyph array before passing to _cairo_surface_show_glyphs
_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.)
2008-03-04 00:15:46 -08:00