Commit graph

4710 commits

Author SHA1 Message Date
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
Adrian Johnson
bdb857a78b PDF: Fix uninitialized variable in previous commit 2008-02-12 20:19:03 +10:30
Kristian Høgsberg
ba6788fc96 [pdf] Use compressed PDF stream instead of compress_dup()
The deflate stream has bounded (constant) memory overhead, whereas
compress_dup() allocates memory proportional to the uncompressed data.

This replaces compress_dup() usage with a compressed PDF stream for
emitting images, alpha masks and font subsets, and eliminates the
compress_dup() function.
2008-02-11 16:57:56 -05:00
Behdad Esfahbod
e68584d3a1 [xlib] Move multiple CAIRO_MUTEX_INITIALIZE into one place they all end up anyway 2008-02-08 17:37:50 -05:00
Peter Weilbacher
0626cac6db [os2] fix typo in comment 2008-02-08 15:09:19 +01:00
Peter Weilbacher
b4fe25d9af [os2] only call FcInit/Fini when compiled with FT font backend 2008-02-08 15:04:49 +01:00
Antoine Azar
5e9cdcca00 Fixed rounding function call 2008-02-08 00:19:57 -05:00
Vladimir Vukicevic
80e11a85a9 [pdf] restore alpha_size back to correct bit size 2008-02-07 14:36:51 -08:00
Azar@.(none)
95db215cc1 Some fixes and improvements to the Win32 build 2008-02-06 21:45:24 -05:00
Carl Worth
7800cfd7de Add several Makefile.win32 files to EXTRA_DIST
Otherwise, these files were being omitted from the tar files.
2008-02-06 17:01:22 -08:00
Carl Worth
ac743e25fa cairo_xlib_surface_create_similar: Pass the original drawable to XCreatePixmap
Previously we were passing the root window of the same screen.
Letting the X server know the actual Drawable for which we're
trying to be similar allows the X server to be more efficient.
2008-02-06 17:01:21 -08:00
Peter Weilbacher
cb9f9086a1 Merge branch 'master' of ssh://pmw@git.freedesktop.org/git/cairo 2008-02-07 00:07:20 +01:00
Peter Weilbacher
c11b036b75 [os2] Improve documentation
Move the API documentation for the OS/2 backend from the .h file to the .c file and use the correct format.
2008-02-07 00:03:33 +01:00
Vladimir Vukicevic
a9b0e54d38 Avoid buffer overflow in ps/pdf surface
A few places weren't using _cairo_malloc_*; fixed.
2008-02-06 13:52:33 -08:00
Vladimir Vukicevic
bf1f7f70b6 Do correct calculation of pen dimensions for stroke optimization 2008-02-06 13:07:13 -08:00
Alp Toker
e104fcab1c Introduce cairo_has_current_point()
cairo_has_current_point() can be used to determine whether a current
point is defined. We introduce this new symbol with a boolean return
value to avoid the versioning ambiguity of modifying
cairo_get_current_point(). This way we also don't have to map what
should be a routine operation to an error condition as was previously
proposed.
2008-02-06 01:06:01 -05:00
Alp Toker
1f0c3d0689 Revert "Change cairo_get_current_point() to return cairo_status_t instead of void"
This reverts commit b3eea75d1f.

Reverted in favour of an alternative approach.

Conflicts:

	src/cairo.c
2008-02-06 01:06:00 -05:00
Azar@.(none)
4c005f7ce3 replaced round with _cairo_lround. Round doesn't compile on Win32 2008-02-06 00:27:57 -05:00