Commit graph

6856 commits

Author SHA1 Message Date
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
Søren Sandmann
e3e1b35eb9 [region] Make cairo_region_t a malloced object. 2009-03-28 17:58:48 -04:00
Søren Sandmann Pedersen
c2c637cf1d Simplify _cairo_clip_intersect_region()
The intermediate intersection region is not necessary because if the
operation fails, clip->region will end up as a pixman error region.
2009-03-28 04:26:10 -04:00
Bertram Felgenhauer
fe10cd6467 [spline] fix wrong sign in _cairo_spline_bound. 2009-03-27 07:10:21 +01:00
Bertram Felgenhauer
53107de63a [in_fill] Correctly track current point in curve_to.
When discarding a bezier path segment, we still need to update the
current point.
2009-03-26 04:56:27 +01:00
Chris Wilson
578b06a978 [perf] Use CAIRO_LDFLAGS
Use CAIRO_LDFLAGS in order to pull in additional link options, such as
--coverage.
2009-03-24 07:50:58 +00:00
Chris Wilson
ac30ced613 [test] Check for surface create failure.
If the image surface creation fails, the data pointer will be NULL leading
to a segfault -- so check!
2009-03-24 07:50:58 +00:00
Chris Wilson
b5a4a2c4b1 [test] Early test for memfault.
Check the error status within after each iteration in
solid-pattern-cache-stress.
2009-03-24 07:50:58 +00:00
Chris Wilson
1a7b94f934 [test] Check for errors during get-path-extents.
Need to check that an error was not raised on the context before checking
whether the extents match expectations.
2009-03-24 07:50:58 +00:00
Vladimir Vukicevic
3b54533088 [win32] Use _hypot instead of hypot
The hypot symbol is deprecated on Win32, and nonexistent on Windows CE
2009-03-21 11:56:18 -07:00
Stefan Klug
895fce1632 [wince] Use the official _WIN32_WCE define instead of WINCE 2009-03-20 17:20:22 -04:00
Jeff Muizelaar
86a935de42 [msvc] Fix definition of CAIRO_ENSURE_UNIQUE for non-x86
The current definition of CAIRO_ENSURE_UNIQUE uses x86 assembly so make sure we
only compile it when targeting x86.
2009-03-20 17:14:08 -04:00
Chris Wilson
c932a809d6 [test] Propagate allocation failure.
Check for memfaults during rel-path test.
2009-03-18 09:44:33 +00:00
Chris Wilson
7db55b37d4 [test] Destroy pattern on error paths.
Destroy the pattern after encountering an error in pattern-getters test.
2009-03-18 09:44:33 +00:00
Chris Wilson
dc176d88ac [test] Trivial leak on error in show-glyphs-many.
Free the allocated glyph array after failure.
2009-03-18 09:44:33 +00:00
Chris Wilson
a4b44ca89e [pattern] Report the true error status from getters.
As the getters actually return an error status, use it to report any
pre-existing error status on the pattern.
2009-03-18 09:44:33 +00:00
Behdad Esfahbod
496bbcf582 Make CAIRO_STATUS_LAST_STATUS public 2009-03-17 19:46:25 -04:00
Behdad Esfahbod
922c108365 [twin] Reorganize matching code to better reflect the code in Pango
Makes it easier to update later.
2009-03-17 19:22:31 -04:00
Behdad Esfahbod
2b4044a36f [twin] Update parsed weights and stretches from Pango 2009-03-17 18:52:16 -04:00
Behdad Esfahbod
3ec94f9b59 Support compiling without fontconfig
Adds a new, fake, fontconfig font backend.  Fontconfig can be disabled
using --disable-fc, in which case the toy text API wont find fonts and
the internal font will always be used.

Also defines the feature macro CAIRO_HAS_FC_FONT.  The two fontconfig-specific
functions in cairo-ft.h depend on that macro now.
2009-03-17 00:58:40 -04:00
Chris Wilson
0e7bcb5e37 [scaled-font] Improve comments.
Grr. I thought I had merged this in with the previous commit...
2009-03-16 21:32:44 +00:00
Chris Wilson
9c80392ac4 [scaled-font] Lean and mean global glyph cache.
Jeff Muizelaar pointed out that the severe overallocation implicit in the
current version of the glyph cache is obnoxious and prevents him from
accepting the trunk into Mozilla. Jeff captured a trace of scaled font
and glyph usage during a tp run and presented his analysis in
http://lists.cairographics.org/archives/cairo/2009-March/016706.html

Using that data, the design was changed to allocate pages of glyphs from a
capped global pool but with per-font hash tables. This should allow the
glyph cache to have tight memory bounds with fair allocation according to
usage. Note that both the old design and the 1.8 glyph cache had
essentially unbounded memory constraints, since each scaled font could
cache up to 256 glyphs (1.8) or had a reserved page (old), with no limit
on the number of active fonts. Currently the eviction policy is a simple
random strategy, this gives a 'fair' allotment of the cache, but a LRU
variant might perform better.

On a sample run of firefox-3.0.7 perusing BBC news in 32 languages:
1.8:  cache allocation 8190x, ~1.2 MiB; elapsed 88.2s
old:  cache allocation 771x, ~13.8 MiB; elapsed 81.7s
lean: cache allocation 433x,  ~1.8 MiB; elapsed 82.4s
2009-03-16 20:51:50 +00:00
Chris Wilson
121d4bb656 [scaled-font] Initialise original_font_face
Eek, attempting to use+free an uninitialised pointer!
2009-03-16 19:53:49 +00:00
Chris Wilson
9099c7e730 [trace] Disable mark dirty tracing.
Applications like firefox have a very conservative approach and mark
surfaces dirty before every render. As we record the image data every
time, firefox traces can grow very large with redundant data - so allow
the user to disable mark dirty tracing.
2009-03-04 09:26:17 +00:00
Jeff Muizelaar
addeb32c75 [pdf] Intialize 'interpolate'
Intialize 'interpolate' to prevent a gcc warning. Do this instead of adding a
'default' case to the switch statement so that we still get warnings if new
filter types are added.
2009-03-03 12:20:47 -05:00
Chris Wilson
a8158d443e [truetype] Move the sizeof asserts to compile time.
Eliminate the need for a runtime test on the sizeof the private structures
by performing the check at compile time. This was provoked by Ginn Chenn
noting that the test was including a private header.
2009-03-03 11:21:35 +00:00
Ginn Chen
e4b1f871e9 [configure] Detect mkdir variant with non-gcc compilers.
It doesn't work for non GCC compiler right now, as "-Werror -Wall" is
an error to non GCC compiler.

I swapped the sequence of build/configure.ac.system and build/
configure.ac.warnings, then WARN_CFLAGS can be used.
2009-03-03 10:27:44 +00:00