Commit graph

6902 commits

Author SHA1 Message Date
Chris Wilson
30735f790a [xlib] Use a similar content surface for cloning images
Simply request a surface with a similar content to the source image when
uploading pixel data. Failing to do so prevents using a 16-bit (or
otherwise non-standard pixman image format) window as a source - in fact
it will trigger an infinite recursion.
2009-05-05 21:38:18 +01:00
Chris Wilson
60e38d0530 [surface] Convert FORMAT_INVALID during snapshots
Currently the surface snapshotting attempts to clone the source using a
new surface of identical format. This will raise an error if the source is
an unusual xserver, for example one operating at 16bpp. The solution to
this is to create the surface using the content type rather than the
format (as elsewhere within the code base). However, we also wish to
preserve FORMAT_A1 (which is lost if we only choose the format based on
_cairo_format_from_content) as the various backends may be able to
trivially special case such bitmaps.
2009-05-05 21:21:28 +01:00
Chris Wilson
31f5a2e94d [png] Coerce FORMAT_INVALID to a known image format
It is possible for cairo_surface_write_to_png() to acquire a non-standard
image surface when, for example, we try to dump a low bit-depth XServer.
Handle this scenario by coercing the unknown image format to a standard
type via pixman.
2009-05-05 21:21:24 +01:00
Chris Wilson
c488b33644 [test] Create a new fallback surface to exercise 16-bit paths.
Add a variation of test-fallback-surface that forces the use of a 16-bit
pixman format code instead of the standard 32-bit types. This creates an
image surface akin to the fallbacks used with low bit-depth xservers.
2009-05-05 21:17:11 +01:00
Chris Wilson
1d609d6722 [image] Treat A1 image surfaces as BILEVEL_ALPHA
Categorise the transparency of FORMAT_A1 image surfaces as BILEVEL_ALPHA.
2009-05-05 21:17:05 +01:00
Chris Wilson
aac132a76a [image] Make _cairo_image_analayze_transparency() more format agnostic
Use the content in preference to the format to determine
CAIRO_IMAGE_IS_OPAQUE/CAIRO_IMAGE_HAS_ALPHA.
2009-05-05 21:17:05 +01:00
Chris Wilson
4be6de9fc6 [image] Return FORMAT_INVALID for an error surface.
The default error value should be CAIRO_FORMAT_INVALID [-1] not 0 (which
corresponds to CAIRO_FORMAT_ARGB32).
2009-05-05 21:17:05 +01:00
Chris Wilson
6675cf5587 [build] Add lcov-1.7 to known list 2009-05-05 21:17:04 +01:00
Chris Wilson
526fcdb7e6 [build] Enable shave support
shave transforms the messy output of autotools into a pretty (quiet!)
Kbuild-like one.

Lets see how controversial a simple change can be...
2009-05-05 21:16:55 +01:00
Chris Wilson
1ae2ddc1dd [memfault] Manually inject faults when using stack allocations
Ensure that no assumptions are made that a small allocation will succeed
by manually injecting faults when we may be simply allocating from an
embedded memory pool.

The main advantage in manual fault injection is improved code coverage -
from within the test suite most allocations are handled by the embedded
memory pools.
2009-04-23 09:22:51 +01:00
Chris Wilson
817589e196 [test] Call FcInit() manually.
Pre-initialise fontconfig whilst memfault is disabled to avoid a lot of
expensive, redundant testing of FcInit() throughout the test suite.
2009-04-20 10:21:24 +01:00
Chris Wilson
be27e844c8 [ft] Propagate status from font creation
Return the true error status whel
_cairo_ft_unscaled_font_create_internal(). This ensures that the original
error is not masked and we are able to report the error during fontconfig
pattern resolution.
2009-04-20 10:21:24 +01:00
Chris Wilson
d46c56f18c [ft] Check for pattern duplication failure.
Check the return of FcPatternDuplicate() for failure, and propagate the
error.
2009-04-20 10:21:23 +01:00
Chris Wilson
50302f156d [ft] Check (correctly!) for pattern duplication failure.
Check the return from FcPatternDuplicate() for allocation failure (and not
the original pattern)!
2009-04-20 10:21:23 +01:00
Chris Wilson
8bf109bd2a [pattern] Silence compiler with impossible case.
Assert that the pattern is one of the four known types, and return an
error so that the compiler knows that the local variable can not be used
uninitialised.
2009-04-20 10:21:23 +01:00
Chris Wilson
5a76c233bf [type3] Propagate error from font creation.
Perform an error check after creating a scaled-font to prevent operations
on a nil-object.
2009-04-16 09:34:03 +01:00
Chris Wilson
d46bd67c8b [type3] Add status checks.
Propagate error from the stream when creating the surface and add status
guards before writing to the potential nil object.
2009-04-16 09:34:03 +01:00
Chris Wilson
a6ffb69a54 [type3] Check error status before emit_image().
Be careful not to pass an error object down to emit_image() hook,
propagate the error instead. This relieves the burden of the error check
from the callee -- which was causing an assertion failure in the ps
backend.
2009-04-16 09:34:03 +01:00
Chris Wilson
21d1138da9 [scaled-font-subsets] Check for malloc failure.
Check that the utf8 string is successfully allocated before writing to it,
otherwise propagate the error status back to the callers.
2009-04-16 09:34:03 +01:00
Chris Wilson
0f0e2d7384 [pdf] Propagate failure from type3 glyph surface creation.
Add an early check that we successfully created the glyph surface.
2009-04-16 09:34:02 +01:00
Chris Wilson
1496c5cf51 [analysis] Use _cairo_region_init()
Avoid secondary allocations of the thin region wrappers during surface
creation by embedding them into the parent structure. This has the
satisfactory side-effect of not requiring status checks which current code
lacks.
2009-04-16 09:34:02 +01:00
Chris Wilson
ad83765a14 [xlib] Allocate bounded region on stack.
Eliminate the extremely short-lived and oft unnecessary heap allocation
of the region by first checking to see whether the clip exceeds the
surface bounds and only then intersect the clip with a local
stack-allocated region.
2009-04-16 09:34:02 +01:00
Chris Wilson
75b06b8bdb [pattern] Do not modify outparam on error path.
The pdf backend was crashing as a failed pattern copy stored an invalid
pointer with the resource group.
2009-04-16 09:34:02 +01:00
Chris Wilson
82cccb2672 [test] Handle memfaults during surface-finish-twice
Check and report memory allocation failures.
2009-04-16 09:34:02 +01:00
Chris Wilson
f12d52bfca [test] Use xmalloc() to evade memfault.
Do not use the simple malloc() as memfault will inject allocation failures
(unlike xmalloc() for which faults are excluded) - as this is unnecessary
inside the test harness and thus does not exercise any cairo code paths.
2009-04-16 09:34:02 +01:00
Chris Wilson
ca501d99bb [test] Disable signal handling under valgrind
Capturing and handling the signals prevents valgrind from providing
backtraces for fatal signals -- which is often more useful.
2009-04-16 09:34:01 +01:00
Jeff Muizelaar
f853972636 [win32] Fix building with libpng and zlib
Include zlib and libpng dependencies using something like '$(cairo_dir)/../zlib/zdll.lib'
instead of just 'zdll.lib'. Also, do similarly for the headers.
2009-04-07 14:50:25 -04:00
Adrian Johnson
1798fc6607 Fix the TrueType subsetting fix in 9b496af5c
Oops.
2009-04-05 11:17:02 +09:30
Adrian Johnson
fe97e815e8 Fix TrueType subsetting bug
Fix incorrect counting of arguments in composite glyphs
2009-04-05 01:09:32 +10:30
Adrian Johnson
9b496af5c2 Fix buffer size check in TrueType subsetting
Andrew Cowie reported a problem with the Charis SIL font being
embedded as a fallback font.

The buffer size check for composite glyphs was incorrect causing the
subsetting to fail for some fonts.
2009-04-05 00:44:02 +10:30
Jeff Muizelaar
ba2ec8e1d9 Remove trailing comma in cairo_region_overlap_t enum. 2009-04-01 13:29:12 -04:00
Jeff Muizelaar
2d6336624c [test-win32] Fix static linking of the test suite.
Previously, the test suite needed to be dynamically linked to work.
2009-04-01 11:32:58 -04:00
Søren Sandmann Pedersen
0f21893b05 [region] pixman_region32_contains_point() does not allow NULL for box 2009-04-01 08:56:10 -04:00
Chris Wilson
e46c1d7fa3 [scaled-font-subset] Cleanup after failure to convert to utf16.
Avoid leaking the local hashtable and strings after failing to convert the
string to utf16.
2009-03-31 12:16:03 +01:00
Chris Wilson
180b964aac [scaled-font-subset] Propagate error from scaled-font to collection.
Don't attempt to collect the sub_font if it is in error.
2009-03-31 12:16:02 +01:00
Chris Wilson
8362c6f726 [type1] Fixup error path during write_charstrings()
On the common error path we attempted to unlock a mutex that was not
always held, so reorder the error paths appropriately.
2009-03-31 12:16:02 +01:00
Chris Wilson
88956cd42e [ps] Check for error during stroking.
Add a missing error status check that caused errors during stroke to be
masked.
2009-03-31 12:16:02 +01:00
Chris Wilson
043352aa8d [pdf] Prevent leak of pad_image on error path.
Ensure that the local pad_image is destroyed after an error.
2009-03-31 12:16:02 +01:00
Chris Wilson
b0689f5611 Check for errors during get_mime_data()
cairo_surface_get_mime_data() may raise an error on the surface, so we
need to check lest it goes unnoticed and we generate a corrupt file.
2009-03-31 12:16:02 +01:00
Chris Wilson
9f63cbb870 [pdf] Free compressed stream after error.
Ensure that the compressed stream is destroyed after encountering an
error.
2009-03-31 12:16:02 +01:00
Chris Wilson
ba1a0fa601 [truetype] Free local names on failure.
Ensure that all local allocations are freed on the error path.
2009-03-31 12:16:01 +01:00
Chris Wilson
edce97a750 [pdf] Remove false assertion.
The stream itself may be in an error state, so an error could be raised.
2009-03-31 12:16:01 +01:00
Chris Wilson
b580a4a8d6 [test] Improve fault injection coverage
In order to exercise the meta-surfaces, we need to inject faults into
cairo_surface_finish().
2009-03-31 12:16:01 +01:00
Søren Sandmann Pedersen
80d5b53b47 [region] Change name of cairo_region_empty() to cairo_region_is_empty() 2009-03-31 05:47:44 -04:00
Jonathan Kew
77ee65fd03 [win32] Fix horizontal glyph positioning bug
The _cairo_win32_scaled_font_backend version of show_glyphs collects
glyph runs to hand to ExtTextOutW until the y-offset changes, then flushes the
glyphs buffered so far. As each glyph is buffered, it also calculates and
buffers the dx value for the preceding glyph.

However, when it sees a change in dy and decides to flush, it should *not*
append an entry to the dx buffer, as this would be the "dx" of the previous
glyph, and instead the new start_x value will be used for the new glyph run
that's being collected. This bug means that after any vertically-offset glyph,
the remaining glyphs in the run will get incorrect dx values (horizontal
escapement).

Mozilla bug #475092
2009-03-30 14:45:48 -04:00
Chris Wilson
aee71e2063 [test] Memfault checks.
Don't assume an error means the test failed, check for injected allocation
errors.
2009-03-30 13:41:00 +01:00
Chris Wilson
ea6197c2f5 [surface] Propagate region allocation failure.
Propagate the error status from failing to allocate the region.
2009-03-30 10:54:26 +01:00
Chris Wilson
c35d226f7d [traps] Propagate allocation failure.
Report failure to allocation region.
2009-03-30 10:46:37 +01:00
Chris Wilson
e238d10b30 [region] Use const cairo_rectangle_int_t consistently.
Add the const declaration to a couple of functions.
2009-03-30 10:23:30 +01:00
Chris Wilson
de1612bdd7 [region] Use _cairo_status_is_error
Replace the open-coded version with the more readable macro.
2009-03-30 10:17:49 +01:00