Commit graph

4727 commits

Author SHA1 Message Date
Vladimir Vukicevic
f2d21e7382 [stroker] fix _compute_normalized_device_slope to return correct sign
The optimization to avoid sqrt() for horizontal/vertical lines in
_compute_normalized_device_slope was causing us to return a negative
magnitude with a positive slope for left-to-right and bottom-to-top
lines, instead of always returning a positive magnitude and a slope
with an appropriate sign.
2008-02-18 17:18:51 -08:00
Adrian Johnson
8fb624dbf2 Use correct prefix for _cairo_pdf_operators_stroke
s/operator/operators/
2008-02-17 21:33:25 +10:30
Adrian Johnson
d2a1576941 PDF/PS: Fix mismatched save restore when using fill-stroke 2008-02-17 21:33:16 +10:30
Adrian Johnson
3a05b5d2d5 PDF/PS: No need to use save/restore for solid colors 2008-02-17 21:33:04 +10:30
Behdad Esfahbod
c7204adcf3 [cairo-misc.c] Add misc functions to this file
Anything functions that doesn't group with other functions enough to
justify its own file should go here now.
2008-02-17 02:32:24 -05:00
Adrian Johnson
a1360322c4 PS: Remove unused code 2008-02-17 17:21:35 +10:30
Adrian Johnson
2dfe32a0ff Implement PDF fill-stroke 2008-02-17 17:21:35 +10:30
Behdad Esfahbod
1e7fa4b9f5 [cairo-pdf-operators] Pass matrix by reference, not by value 2008-02-16 22:48:06 -05:00
Adrian Johnson
357f2334f0 PDF: Allow word_wrap_stream to split hex strings 2008-02-16 20:37:16 +10:30
Adrian Johnson
204a27aadb PDF: Word wrap _cairo_pdf_operators_show_glyphs output 2008-02-16 20:35:42 +10:30
Behdad Esfahbod
bcb0395288 [docs] Fix typo 2008-02-15 15:56:29 -05:00
Shailendra Jain
536e1963b7 Compile fix for AIX.
Minor correction for a build failure on AIX:
"mozilla/gfx/cairo/cairo/src/cairo-gstate.c", line 45.43: 1506-294 (S)
Syntax error in expression on #if directive.

(Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=415867.)
2008-02-15 13:50:43 +00:00
Chris Wilson
31a67c5f22 [pdf] Minor make check fix.
Add a missing '%' in the documentation.
2008-02-15 13:50:43 +00:00
Chris Wilson
9e9fda0478 [test/bitmap-font] Destroy the font options after use.
Fix the leak of the font options.
2008-02-15 13:50:43 +00:00
Chris Wilson
92970ec836 [test/invalid-matrix] Test detection of infinities.
Feed infinities into the API and check that we correctly return
INVALID_MATRIX.
2008-02-15 13:50:43 +00:00
Chris Wilson
012f68e043 [test/invalid-matrix] Check scale(0,0)
Test that INVALID_MATRIX is returned if the user calls cairo_scale(0,0)
or a variant thereof.
2008-02-15 13:50:43 +00:00
Chris Wilson
eb7488e1e6 [test/invalid-matrix] Promote incorrect status warning to an error.
As the last warning for an incorrect status has been resolved, throw an
error if we regress and no longer report an INVALID_MATRIX under testing.
2008-02-15 13:50:43 +00:00
Chris Wilson
fc732c3aaa [cairo-scaled-font] Create error objects on demand.
In order to correctly report the error back to the user during the
creation of a scaled font, we need to support a nil object per error.
Instead of statically allocating all possible errors, lazily allocate
the nil object the first time we need to report a particular error.

This fixes the misreporting of an INVALID_MATRIX or NULL_POINTER that
are common user errors during the construction of a scaled font.
2008-02-15 13:50:42 +00:00
Chris Wilson
38fcc015a5 [cairo-ft-font] Propagate error detected during determination of scale factors.
Ensure that if an invalid matrix is detected when creating the toy font,
the error is propagated to the caller.
2008-02-15 13:50:42 +00:00
Chris Wilson
ad265cc9f2 [cairo-font-options] Disallow use of NULL font-options.
Partial revert of commit 0086db893c.

This is a follow to the earlier commit that allowed creation of scaled
fonts using a NULL font options (by interpreting the NULL as meaning
use the default options) to reflect the comments made by Behdad
(http://lists.cairographics.org/archives/cairo/2008-January/012714.html).

The intent is that the public font options getter/setter API has similar
defensive behaviour to that of the core objects - i.e. do not overwrite
the nil object and if the object is in error then return the default
value. For the indirect use of a NULL/nil font options (e.g. creation of
scaled fonts), then an error should be returned rather than crashing.
2008-02-15 13:50:42 +00:00
Chris Wilson
790eaef71c [boilerplage] Add getopts to the boilerplate library.
Remember to compile the _cairo_getopts() function into the boilerplate
convenience library for cairo-perf.
2008-02-15 13:50:42 +00:00
Chris Wilson
fe93038ef3 [test/font-options] Check for HAVE_FCFINI
Only pull in the fontconfig headers if we actually use FcFini().
2008-02-15 13:50:42 +00:00
Chris Wilson
2eb03b8cf2 [cairo-ps-surface] Tidy return from _analyze_image_transparency().
_analyze_image_transparency() only returned SUCCESS, so use the return
parameter to pass back the transparency type instead of using an out
parameter.
2008-02-15 13:50:42 +00:00
Chris Wilson
bc83e028b8 [cairo-output-stream] Add format(printf) markup.
Add CAIRO_PRINTF_FORMAT attribute to the printf-esque output stream
functions, and fixup the one warning caught by the compiler.
2008-02-15 13:50:42 +00:00
Chris Wilson
4430157841 [test] Summarise the tests failures per backend.
After the summary, show the total number of failures per backend.
2008-02-15 13:50:42 +00:00
Chris Wilson
af88d4d9ae [test/a8-mask] Fix memleak.
Destroy the auxiallary surfaces and contexts.
2008-02-15 13:50:42 +00:00
Chris Wilson
a3f071aee7 [cairo-ft-font] Tidy usage of cairo_error().
Remove a redundant use of cairo_error(NO_MEMORY).
2008-02-15 13:50:42 +00:00
Chris Wilson
a4c960a93c [test] Add tests using each backend as a source.
Inspired by bug 7362 (painting a glitz surface onto an xlib surface
crashes cairo) and the lack of coverage for
_cairo_paginated_surface_acquire_source_image(), these tests attempt
to use each backend as a source surface for all the other backends.
For example, this checks that one can construct a PS file ready for
printing and then copy that surface to an image/xlib for previewing.
2008-02-15 13:50:41 +00:00
Chris Wilson
f59f22eecb [check] Only build documents during make check if we have GTK_DOC
Check that gtk-doc has been enabled before running attempting to build
the docs during make check.
2008-02-15 13:50:41 +00:00
Chris Wilson
e5f0253b67 [cairo-surface] Hide the compiler warnings.
Assign the return value from _cairo_surface_set_error() to hide the
compiler warnings.
2008-02-15 13:50:41 +00:00
Chris Wilson
53c1ed25ab [test/a1-sample-image] Fix the memleak.
Destroy the surface after use.
2008-02-15 13:50:41 +00:00
Chris Wilson
5efc88e910 [xmalloc] Hide valgrind warning.
Allocate the string to the next integer boundary to hide a valgrind
warning.
2008-02-15 13:50:41 +00:00
Chris Wilson
1faf208093 [cairo-png] Improve error return for invalid parameters.
Only translate an UNSUPPORTED error into a SURFACE_TYPE_MISMATCH, all
others can be returned to the user unadulterated.

PNG doesn't support width==0 or height==0 and generates an error
whilst writing - which without further information is assumed to be
a NO_MEMORY error. So check the image size at the start and return a
WRITE_ERROR for a zero sized image.
2008-02-15 13:50:41 +00:00
Chris Wilson
d0cc1d9291 [cairo-pdf-surface] Minor code tidy.
Remove code duplication.
2008-02-15 13:50:41 +00:00
Chris Wilson
d7ce0582f1 [test/font-options] Check the defaults values.
Exercise the getters by checking that a fresh cairo_font_options_t has
the default values.
2008-02-15 13:50:41 +00:00
Chris Wilson
f40f24e272 [test/invalid] Test cairo_translate() and friends for NaN safety.
Pass NaNs to cairo_translate() and friends and check that they raise
an INVALID_MATRIX error.
2008-02-15 13:50:41 +00:00
Adrian Johnson
896da0305a Win32-printing: Fix meta surface patterns
Ensure the win32-printing surface has the same fixes for meta surface
patterns with more than one level of push/pop group that PS/PDF
received in 060f384310
2008-02-15 23:54:55 +10:30
Adrian Johnson
fbde0fb872 Update PS ref images 2008-02-15 08:17:25 +10:30
Adrian Johnson
40d5082c24 PS: Use currentfile as the image data source
When the emitted image is not inside a PS procedure we can use the
currentfile operator as the datasource instead of an array of strings.
This avoids having to read to entire image data into printer memory
before the image can be decoded. This improves the performance and
reduces the chance of running out of memory on printers with limited
memory.
2008-02-15 07:42:29 +10:30
Adrian Johnson
fe334bb476 PS: Use InterleaveType 2 for image and mask
To be able to use the currentfile operator we need to combine the
image data and mask data into the one data source. InterleaveType 2
scan line interleaves the image and data.
2008-02-15 07:42:29 +10:30
Adrian Johnson
b053aaba80 PS: Don't use patterns for fill surface extend none
_ps_surface_fill() can also avoid using PS patterns for EXTEND_NONE
surface patterns. A clip path is set around the fill path then the
surface is painted.
2008-02-15 07:42:29 +10:30
Adrian Johnson
2324a48c95 Update rotate-image-surface-paint ps ref image 2008-02-15 07:42:29 +10:30
Adrian Johnson
67374af22f PS: Don't use patterns for paint surface extend none
This is the first of four patches intended to fix the bug reported in

http://lists.cairographics.org/archives/cairo/2007-December/012226.html

Previously the PS backend would draw all cairo patterns (except solid
colors) by emitting a PS pattern. As PS does not support non repeating
patterns, the PS backend would set a large repeat step to ensure that
only one copy of the pattern is on the page.

Some printers with limited memory are unable to print large images
inside a pattern. This was probably because when using patterns the
printer tries to keep the uncompressed image in memory so it can tile
the pattern.

When painting surface patterns with the extend mode EXTEND_NONE we do
not need to use PS patterns. The image or meta surface commands can be
emitted directly.
2008-02-15 07:42:29 +10:30
Adrian Johnson
6f9d71c10b Make PS backend use cairo-pdf-operators.c
Changes include:
- Replace PS prolog with new prolog that emulates PDF operators
- Remove the [1 0 0 -1 0 height] ctm on each page. PS and PDF surfaces
  now both transform all output to PS/PDF coordinates.
- Invert images to match PDF images where (0,0) is top left
- emit_surface_pattern now uses the same transform as PDF
- move the special dash handling into cairo-pdf-operators.c
2008-02-15 07:42:29 +10:30
Adrian Johnson
49f755ed2d PS: Remove the Type 3 outline glyph code
This code is never used because outline glyphs that go through the
fallback path are always embedded with Type 1 fallback. The only fonts
that are embedded as Type 3 are bitmap fonts.
2008-02-15 07:42:29 +10:30
Adrian Johnson
0c6a362122 pdf-operators: only one path matrix is required
The PDF emit path orginally had two matrix transforms in the path
struct. One for strokes and one for fill/clip. As only one transform
at a time is ever used this can be simplified.
2008-02-15 07:42:29 +10:30
Adrian Johnson
5639643efe Add PS linecap path workarounds to pdf_operators
So that pdf_operators can be used by the PS backend. PDF also needs
this workaround.
2008-02-15 07:42:29 +10:30
Adrian Johnson
0987fdee24 Add word_wrap stream to pdf-operators
The word_wrap stream in ps-surface will be removed in a later commit.
2008-02-15 07:42:29 +10:30
Behdad Esfahbod
d05f08bcee [configure.in] Make PS/PDF/SVG default enabled
Previously they were default auto-detected.  We really want people
have to go out of their way to not build them, hence the change.
2008-02-12 15:44:21 -05:00
Adrian Johnson
fd3181c7bf PDF: Remove stale comments 2008-02-12 20:22:38 +10:30