Commit graph

6882 commits

Author SHA1 Message Date
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
Chris Wilson
f027405429 [region] Add leading underscore to private _cairo_region_set_error()
Differentiate the private _cairo_region_set_error() function by using a
leading underscore.
2009-03-30 10:12:41 +01:00
Chris Wilson
ed7188a471 [region] Add slim_hidden_def.
Fixes for check-plt.sh (and a few adjacent whitespace).
2009-03-30 10:11:14 +01:00
Chris Wilson
f31c6548f8 Silence compiler warnings for CAIRO_STATUS_LAST_STATUS
Add ASSERT_NOT_REACHED (or similar) cases to the error handling switches
to silence the compiler.
2009-03-29 08:31:15 +01:00
Søren Sandmann Pedersen
62d84847c3 [region] Add documentation for all the new region methods. 2009-03-28 18:02:58 -04:00
Søren Sandmann Pedersen
980e9f0dbd [region] Fix status propagation for regions
When an operation fails, store the status code in the destination
region rather than leaving it unchanged.
2009-03-28 18:02:58 -04:00
Søren Sandmann Pedersen
64e490a464 [region] Use signed ints for width and height in cairo_rectangle_int_t 2009-03-28 18:02:58 -04:00
Søren Sandmann
26999e5aa8 [region] Add cairo_region_intersect_rectangle() and _subtract_rectangle()
Intersecting with and subtracting rectangles is quite common, and we
already have cairo_union_rectangle().
2009-03-28 18:02:58 -04:00
Søren Sandmann Pedersen
4b3245481c [region] Expand rect to rectangle in a couple of names
Specifically,

	cairo_region_union_rect  ->  cairo_region_union_rectangle
	cairo_region_create_rect ->  cairo_region_create_rectangle

Also delete cairo_region_clear() which is not that useful.
2009-03-28 18:02:57 -04:00
Søren Sandmann Pedersen
bf6d9bc175 [region] Delete cairo_region_create_rectangles()
It was only used in _cairo_traps_extract_region() which could be
simplified significantly by calling cairo_region_union_rect()
repeatedly instead.
2009-03-28 18:02:57 -04:00
Søren Sandmann
e6d82afcab [region] Add slim_hidden_proto for region functions 2009-03-28 18:02:57 -04:00
Søren Sandmann
e29103c081 [region] Move region function prototypes to cairo.h along with helper types.
Move struct _cairo_region to cairoint.h and delete
cairo-region-private.h. Delete cairo_private from the function
definitions that had it.
2009-03-28 18:02:57 -04:00
Søren Sandmann
1cca5a1348 [region] Remove underscores from _cairo_region_* 2009-03-28 18:02:07 -04:00
Søren Sandmann
fcdca96694 [region] Always define cairo_rectangle_int_t with ints
Use ints in cairo_rectangle_int_t, no matter the fixed type.
2009-03-28 18:01:19 -04:00
Søren Sandmann
cfa7a384b7 [region] Add _cairo_region_contains_point() 2009-03-28 18:01:19 -04:00
Søren Sandmann Pedersen
15564d1949 [region] Add _cairo_region_union 2009-03-28 18:01:19 -04:00
Søren Sandmann Pedersen
df883aa937 [region] Add a cairo_region_overlap_t type 2009-03-28 18:01:19 -04:00
Søren Sandmann Pedersen
ebd0e685ae [region] Consistently use rectangles in the API of regions
Usually, rectangles are more useful than boxes, so regions should only
expose rectangles in their public API.

Specifically,
  _cairo_region_num_boxes becomes _cairo_region_num_rectangles
  _cairo_region_get_box becomes _cairo_region_get_rectangle

Remove the cairo_box_int_t type
2009-03-28 18:01:19 -04:00
Søren Sandmann
c29aeee2d3 [region] Change sense of _cairo_region_not_empty() to _cairo_region_empty()
Having "not" in the name causes double negatives.
2009-03-28 18:01:19 -04:00
Søren Sandmann
c88321d0a2 [region] Miscellaneous bug fixes.
- Initialize region->status in _cairo_region_create_boxes()
- Make _cairo_region_copy() actually return a region.
- Fix a bug where a NULL region could be dereferenced

Also add an assertion that the result of cairo_region_copy() is never
NULL.
2009-03-28 18:01:19 -04:00
Søren Sandmann
93b285dc2c [region] Get rid of clip->has_region 2009-03-28 18:01:19 -04:00