Commit graph

1841 commits

Author SHA1 Message Date
Behdad Esfahbod
b706bd9b38 [cairo-polygon] Add a cache of eight edges to cairo_polygon_t
Many, if not most, of polygons have very few edges.  This avoids
calling malloc() for those cases.
2007-03-13 06:07:03 -04:00
Behdad Esfahbod
d8165d5424 [cairo-spline] Fix typo in comment 2007-03-13 05:59:33 -04:00
Behdad Esfahbod
cca7e3fec3 [cairo_polygon_t] Change has_current_point from int to cairo_bool_t 2007-03-13 05:56:38 -04:00
Behdad Esfahbod
81e15a454b [cairo_polygon_t] Remove unused member 'closed' 2007-03-13 05:55:45 -04:00
Behdad Esfahbod
2bf4ce389d [cairo_polygon_t] Reorder struct members for clarity 2007-03-13 05:53:13 -04:00
Behdad Esfahbod
3ce84390de [cairo-polygon] Clean-up realloc algorithm for clarity 2007-03-13 05:51:39 -04:00
Behdad Esfahbod
6976ab1392 [cairo-slope] Make comparison stable if both vectors are zero 2007-03-13 05:14:20 -04:00
Behdad Esfahbod
9eee167210 [cairo-spline] Add a cache of eight points to cairo_spline_t
Most of the splines need not more than eight points.  This avoids
calling malloc() for those cases, and eight-points take only 64 bytes.
2007-03-13 05:14:20 -04:00
Behdad Esfahbod
1e64ecf075 [cairo-spline] Clean-up realloc algorithm for clarity 2007-03-13 05:14:20 -04:00
Behdad Esfahbod
cee687a33f [cairo_traps_t] Reorder struct members for clarity 2007-03-13 05:14:20 -04:00
Behdad Esfahbod
24aec99ffb [cairo-traps] Add a cache of one trapezoid to cairo_traps_t
Seems like half the time, we just need one trap.  This avoids
calling malloc() for those cases.
2007-03-13 05:14:19 -04:00
Behdad Esfahbod
4737416c6e [cairo-traps] Clean-up realloc algorithm for clarity 2007-03-13 05:14:19 -04:00
Behdad Esfahbod
a9d8cb3e8a [cairo-traps] Use INT32_MIN/MAX instead of INT16_MIN/MAX << 16 2007-03-13 05:14:19 -04:00
Behdad Esfahbod
e765ac745e [skiplist] Prefix symbols with _cairo 2007-03-13 05:14:19 -04:00
Behdad Esfahbod
cd78da36f6 [test-surfaces] Prefix public symbols with _cairo 2007-03-13 05:14:19 -04:00
Behdad Esfahbod
8997b3a023 [skiplist] Move static variable out of function
Part of my secrect plan to make cairo compilable with:

	#define static

Useful for some weird debugging purposes.
2007-03-13 05:14:19 -04:00
Behdad Esfahbod
d40126f5ab [cairo_t] Embed a gstate into cairo_t
So we don't have to malloc the first gstate.
2007-03-13 05:14:19 -04:00
Behdad Esfahbod
01f9ee39fe [cairo-clip] Make _cairo_clip_init tolerate NULL target
(needed for upcoming patches.)
2007-03-13 05:14:19 -04:00
Behdad Esfahbod
bc8987068d [cairo_t] Make path an array of size one
This is more natural since cr->path can be used as if it was a pointer.
This means, for example, if we move on to making it a pointer, most of
the code using it does not need any change.  So we get some level of
encapsulation of implementation details, if you prefer the terminology :).
2007-03-13 05:14:19 -04:00
Behdad Esfahbod
74e6a24e98 [Quartz] Don't include cairo-private.h 2007-03-13 05:14:19 -04:00
Behdad Esfahbod
6bc543a0eb [cairo_t] Move gstate pointer before cairo_path_fixed_t for better cache behavior 2007-03-13 05:14:18 -04:00
Behdad Esfahbod
85aff353ca [cairo-path-fixed] Fine-tune size of buffer
such that cairo_path_fixed_t fits in 512 bytes.
2007-03-13 05:14:18 -04:00
Behdad Esfahbod
1bd073a1a2 [cairo-path-fixed] Merge op and arg bufs
This means, we have to malloc only one buffer, not two.  Worst case
is that one always draws curves, which fills the arg (point) buffer
six times faster than op buffer.  But that's not a big deal since
each op takes 1 byte, while each point takes 8 bytes.  So op space
is cheap to spare, so to speak (about 10% memory waste at worst).
2007-03-13 05:14:18 -04:00
Behdad Esfahbod
5750d669af [cairo-path-fixed] Avoid malloc for small paths
We do this by including an initial op and arg buf in cairo_path_fixed_t,
so for small paths we don't have to alloc those buffers.

The way this is done is a bit unusual.  Specifically, using an array of
length one instead of a normal member:

-    cairo_path_op_buf_t *op_buf_head;
+    cairo_path_op_buf_t  op_buf_head[1];

Has the advantage that read-only use of the buffers does not need any
change as arrays act like pointers syntactically.  All manipulation code
however needs to be updates, which the patch supposed does.  Still, there
seems to be bugs remaining as cairo-perf quits with a Bad X Request error
with this patch.
2007-03-13 05:14:18 -04:00
Behdad Esfahbod
2894ed19a3 [directfb,os2] #error if the backend is not compiled in, like others do 2007-03-13 05:14:18 -04:00
Adrian Johnson
073d06d466 Fix incorrect file permission in previous commit 2007-03-13 18:45:38 +10:30
Adrian Johnson
a944f42b3d Fix buffer overflow warning 2007-03-13 18:35:59 +10:30
Chris Wilson
789aada06b Avoid the struct copy when source and destination are the same.
On some architectures, gcc will emit a memcpy for structure copies which will
produce a valgrind warning when the source and destination pointers are the
same. Workaround this issue by explicitly checking the source and destination
for inequality before doing the structure assignment.
2007-03-12 14:48:05 -07:00
Carl Worth
ef284a2d6b Fix a LOCK vs. UNLOCK typo, (yes, I'm that stupid).
Thanks to M.Drochner@fz-juelich.de for noticing the bug.

This fixes bug #10235:

	locking bug in cairo_ft_scaled_font_unlock_face()
	http://bugs.freedesktop.org/show_bug.cgi?id=10235
2007-03-09 13:36:03 -08:00
Emmanuel Pacaud
772edc9133 SVG: fix a radial gradient failure when using CAIRO_EXTEND_REFLECT.
Assume from the beginning we're using a circle with a radius equal to
2 * ( r1 - r0 ) when emulating CAIRO_EXTEND_REFLECT.
2007-03-08 21:32:59 +01:00
Behdad Esfahbod
c07867c545 [glitz] Mark some constant static structures as const 2007-03-07 16:02:09 -05:00
Behdad Esfahbod
88632575bf [PS/PDF/SVG] Rename internal symbols to have _cairo_*_surface prefix 2007-03-07 16:02:09 -05:00
Behdad Esfahbod
2cc1c73705 [cairoint] Move endian-conversion routines into cairoint.h 2007-03-07 16:02:09 -05:00
Behdad Esfahbod
62e864e73c [Type1] Add cairo-type1-private.h that Type1 fallback and subset code share 2007-03-07 16:02:08 -05:00
Behdad Esfahbod
ef9799d596 [cosmetic] Remove static var from testing code in bentley-ottman. 2007-03-07 16:02:08 -05:00
Emmanuel Pacaud
734d32ed7a SVG: Fix CAIRO_EXTEND_REFLECT for radial gradients.
This patch also handles cases where r0 > r1, (one circle must still
be wholly contained within the other as that's all SVG supports).

This patch should also prevent a crash when r0 == r1.
2007-03-06 15:50:11 -08:00
Brian Ewins
32536a7b79 [atsui] clean up warnings
Just tidying up  warnings left behind by previous fixes.
2007-03-06 23:45:23 +00:00
Brian Ewins
9032bf4e2d [quartz] rename remaining nquartz symbols to quartz.
Renaming any nquartz symbols and files left to quartz.
2007-03-06 23:24:33 +00:00
Behdad Esfahbod
f7beb220df Remove extra word in docs 2007-03-06 10:33:09 -05:00
Adrian Johnson
81b98c93b6 PDF: Set page group color space to DeviceRGB
See http://lists.freedesktop.org/archives/cairo/2006-November/008551.html
2007-03-06 23:11:38 +10:30
Carl Worth
d0d2c40307 Clarify that extra elements in cairo_path_data is only available in cairo >= 1.4 2007-03-06 01:20:03 -08:00
Carl Worth
aa883123d2 Optimize filling of a path that is a single device-axis-aligned rectangle.
It turns out that this case is extremely common and worth avoiding
the overhead of the path iteration and tessellation code.

The optimization here works only for device-axis-aligned rectangles
It should be possible to generalize this to catch more cases, (such
as any convex quadrilateral with 4 or fewer points).

This fix results in a 1.4-1.8x speedup for the rectangles perf case:

image-rgb  rectangles-512  7.80 1.22% -> 4.35 1.62%: 1.79x speedup
▊
image-rgba rectangles-512  7.71 4.77% -> 4.37 0.30%: 1.77x speedup
▊
 xlib-rgba rectangles-512  8.78 5.02% -> 5.58 5.54%: 1.57x speedup
▋
 xlib-rgb  rectangles-512 11.87 2.71% -> 8.75 0.08%: 1.36x speedup
▍

Which conveniently overcomes the ~ 1.3x slowdown we had been seeing
for this case since 1.2. Now, compared to 1.2.6 we see only a speedup:

image-rgba rectangles-512  6.19 0.29% -> 4.37 0.30%: 1.42x speedup
▎
image-rgb  rectangles-512  6.12 1.68% -> 4.35 1.62%: 1.41x speedup
▎
 xlib-rgba rectangles-512  7.48 1.07% -> 5.58 5.54%: 1.34x speedup
▏
 xlib-rgb  rectangles-512 10.35 1.03% -> 8.75 0.08%: 1.18x speedup
▏
2007-03-05 21:01:05 -08:00
Brian Ewins
e15bb8efe6 [quartz] remove unnecessary flushes
Removing calls to CGContextFlush; these were slowing down the
mac and on other platforms it is up to the client to flush
the surface.
2007-03-06 00:40:56 +00:00
Emmanuel Pacaud
e1a598211b Use the offset attribute to improve cairo-svg handling of EXTEND_REPEAT and EXTEND_REFLECT
With this change, the cairo-svg output is perfectly fine with
CAIRO_EXTEND_REPEAT, but is still very slightly wrong with
CAIRO_EXTEND_REFLECT, (though *much* better than it was before
this fix).
2007-03-05 16:04:24 -08:00
Emmanuel Pacaud
47f2bf4e28 Remove broken special-casing of radial gradient fx,fy under CAIRO_EXTEND_NONE
Carl can't explain why he added this special-case, and removing it
eliminates one failure case from the radial-gradient test matrix.
2007-03-05 16:04:24 -08:00
Brian Ewins
a724f816e1 [quartz,atsui] separate the quartz surface and atsui font backend
Make it possible to use the --enable-quartz and --enable-atsui
independently. Quartz on its own will use the ft font backend.
2007-03-05 23:19:24 +00:00
Behdad Esfahbod
83fcce0e93 [quartz] Make utility functions static 2007-03-05 17:56:57 -05:00
Behdad Esfahbod
d25548d679 In cairo_append_path(), allow excess path_data elements 2007-03-05 17:11:39 -05:00
Behdad Esfahbod
3ab9ca54aa In cairo_text_path(), bail out if zero glyphs 2007-03-05 16:33:46 -05:00
Behdad Esfahbod
4f138e4af5 Uniform object handling in _reference(), _destroy(), and _get_reference_count()
All three now regard NULL and nil inputs the same.  This is new for
_get_reference_count().  It now returns 0 on NULL too, like it does on
nil objects.
2007-03-05 16:28:31 -05:00