Commit graph

1569 commits

Author SHA1 Message Date
Dan Amelang
6cfb4a01e0 Refactor _cairo_matrix_is_integer_translation
Now that we have _cairo_matrix_is_translation, we can change
_cairo_matrix_is_integer_translation to use it and thus reduce code
duplication.
2006-11-22 16:25:54 -08:00
Dan Amelang
ca79307bdf Add _cairo_matrix_is_translation 2006-11-22 16:25:54 -08:00
Daniel Amelang
57fba8d9b6 Replace existing rounding code with _cairo_lround 2006-11-22 16:25:53 -08:00
Daniel Amelang
efb483c3a3 Add _cairo_lround for much faster rounding
This function uses the same "magic number" approach as _cairo_fixed_from_double.
2006-11-22 16:25:53 -08:00
Behdad Esfahbod
eaaeba170d [SVG] Fix compiler warning
cairo-svg-surface.c:980: warning: 'id' might be used uninitialized in this function
2006-11-21 19:05:16 -05:00
Behdad Esfahbod
c6fceb6721 [PS] Rename n_glyphs to num_glyphs_unsigned
Follow-up on my previous commit.  Use a more descriptive name to avoid
confusion between n_glyphs and num_glyphs.
2006-11-21 17:52:58 -05:00
Behdad Esfahbod
75eeb88976 [PS] Eliminate compiler warnings about unoptimizable loops
An innocient-looking loop like this:

  for (j = 0; j <= last; j++)
    something();

cannot be optimized, because it may loop forever!
Imagine the case that last is MAXINT, the loop will never end.  The correct
way to write it is:

  for (j = 0; j < last+1; j++)
    something();

In this case, if last is MAXINT, the loop will never run.  Not correct, but
better than looping forever.

Still better would be to correctly handle the MAXINT case (even though it
doesn't make any sense to show MAXINT number of glyphs in one operation!)  To
do that, we can use the fact that the input num_glyphs is a signed.  If
there is one good thing about using signed int as input length, it's that you
can use an unsigned looping variable to avoid looping forever.  That is
exactly what this patch does.
2006-11-21 12:11:19 -05:00
Emmanuel Pacaud
2dbb3dfd5f SVG: plug a memory leak
What's the point in creating a memory stream if we overload the
pointer a couple of lines below ?
2006-11-21 14:43:43 +01:00
Behdad Esfahbod
12f8718a3e [SVG] Define enum _cairo_svg_version. 2006-11-21 00:22:19 -05:00
Carl Worth
e5bd21136c Add const qualifier to cairo_path_t* parameter of cairo_append_path 2006-11-20 09:36:10 -08:00
Emmanuel Pacaud
10920c1326 Merge branch 'svgprint' 2006-11-18 12:59:12 +01:00
Behdad Esfahbod
f3f6ea3092 Fix typo. 2006-11-14 17:58:09 -05:00
Carl Worth
29b01f93ca Make miter join code use tessellate_convex_quad rather than tessellate_polygon
This provides an additional 22-29% speedup on top of the previous
fix for stroking paths with many miter joins:

image-rgba  world_map-800  459.73 0.27% -> 356.80 0.32%:  1.29x speedup
▎
image-rgb   world_map-800  458.83 0.37% -> 358.08 0.41%:  1.28x speedup
▎
 xlib-rgba  world_map-800  566.57 0.23% -> 463.84 0.31%:  1.22x speedup
▎
 xlib-rgb   world_map-800  562.31 0.64% -> 460.51 0.83%:  1.22x speedup
▎
2006-11-13 16:50:30 -08:00
Carl Worth
3d53f623fa Make _cairo_stroker_add_sub_edge use tessellate_convex_quad rather than tessellate_polygon
This gives a 17-20% speedup for stroking polygons with many
straight line segments as seen in the world_map test case:

Speedups
========
image-rgba  world_map-800  555.41 0.17% -> 460.69 0.20%:  1.21x speedup
▎
image-rgb   world_map-800  554.91 0.25% -> 460.73 0.26%:  1.20x speedup
▎
 xlib-rgb   world_map-800  669.85 3.70% -> 570.31 0.24%:  1.17x speedup
▏
 xlib-rgba  world_map-800  663.71 0.46% -> 567.74 0.19%:  1.17x speedup
▏
2006-11-13 16:50:00 -08:00
Carl Worth
fefa7d9b99 Rewrite tessellate_rectangle as tessellate_convex_quad to make it more useful
Currently there aren't even any users of this code, (they had
stopped using it when they realized what they really wanted
was tessellate_convex_quad).
2006-11-13 15:57:50 -08:00
Carl Worth
e324bbcbc6 Add a status field to cairo_traps_t to enable less error checking 2006-11-13 14:44:21 -08:00
Emmanuel Pacaud
ad6d3a8369 Add SVGPrint support.
It's only activated when svg version >= 1.2.
Last page without a show page call is ignored if blank.
2006-11-12 20:45:10 +01:00
Vladimir Vukicevic
1e4515c548 [win32] implement EXTEND_REPEAT in composite when possible
Optimizes EXTEND_REPEAT, especially when DDBs are in use through the
use of PatBlt or manually expanding out the repeated blits (up to a
limit).  Will still fall back to fallback code as necessary.
2006-11-07 13:15:28 -08:00
Vladimir Vukicevic
6db219c3a1 [win32] clean up win32_surface_composite
Make sure that all operations are correct (the operations chosen
are listed in cairo-win32-surface.c); in particular, deal with the extra
byte present in FORMAT_RGB24 surfaces correctly.

Also adds support for calling StretchDIBits to draw RGB24
cairo_image_surfaces directly.
2006-11-07 13:12:09 -08:00
Carl Worth
fc584e1fbb Rewrite _cairo_matrix_transform_bounding_box to actually accept a box not a rectangle
It turns out that all of the callers want a box anyway, so this
simplfies the code in addition to being more honest to the name.

(For those new to the convention, a "box" is an (x1,y2),(x2,y2)
pair while a "rectangle" is an (x,y),(width,height) pair.)
2006-11-07 01:42:21 -08:00
Dan Amelang
4cd50965a1 Change _cairo_fixed_from_double to use the "magic number" technique
See long thread here:
http://lists.freedesktop.org/archives/cairo/2006-October/008285.html

This patch provides a 3x performance improvement (on x86) for the
conversion of floating-point to fixed-point values as measured by
the recent pattern_create_radial performance test:

image-rgba      pattern_create_radial-16     8.98 3.36% ->   2.97 1.03%:  3.38x speedup
██▍
image-rgb       pattern_create_radial-16     8.94 3.21% ->   2.97 0.18%:  3.36x speedup
██▍
 xlib-rgb       pattern_create_radial-16     9.55 3.17% ->   3.64 0.51%:  2.93x speedup
█▉
 xlib-rgba      pattern_create_radial-16     9.63 3.53% ->   3.69 0.66%:  2.91x speedup
█▉
2006-11-06 09:37:40 -08:00
Jinghua Luo
8e74f9f945 glitz: fix a memory leak in _cairo_glitz_surface_composite_trapezoids. 2006-11-06 12:21:25 +08:00
Christian Biesinger
e29aea745a [win32] Add parentheses around & operator
This fixes a GCC warning. Also, it fixes a bug: The precedence
of & is not what you might expect.
2006-10-27 23:51:55 +02:00
Christian Biesinger
05a259d493 [beos] Fix build error
Rename cairo_rectangle_fixed_t to cairo_rectangle_int16_t
as needed per commit 746f66c3fc.
2006-10-26 21:47:16 +02:00
Adrian Johnson
bd0f991908 Add OpenType/CFF Subsetting 2006-10-27 00:00:24 +09:30
Adrian Johnson
e4c3da8080 PS: Use xshow/yshow/xyshow for strings of glyphs
Optimize show glyphs by looking for strings of glyphs from the same subset
and use the xyshow operator to display. As a further optimization the xshow
and yshow operators are used for displaying horizontal and vertical text.
2006-10-26 23:41:57 +09:30
Behdad Esfahbod
e1ded5b1e0 [PDF] Set CTM before path construction
The previous order is undefined according to the PDF spec.  The resulting PDF
was being misrendered using OS X Preview viewer.  This was reported in this
thread:

  http://lists.freedesktop.org/archives/cairo/2006-October/008271.html
2006-10-25 21:40:08 -04:00
Carl Worth
02096f66f3 Fix typo 2006-10-25 12:52:02 -07:00
Carl Worth
7955fe63cc Fix offset/extent bug in ps output for repeating source surface patterns
The bug was exposed by the recent addition of the paint-repeat test.
The ps output was crashing various interpreters by using infinite
extents for repeating patterns. Fixing that was easy enough, but
the offset of the repeating pattern was still being lost. The fix
for both involved imitating the style of emit_surface_pattern as
it exists in cairo-pdf-surface.c, (though the details are quite
different due to differences in the models of PS and PDF).
2006-10-25 12:52:02 -07:00
Carl Worth
7e9aad2289 Fix repeating source surface patterns with xlib backend.
This broke with the clone_similar optimization in
8d7a02ed58 The optimization added an
interest rectangle to clone_similar, but with a repeating source
pattern, the interest rectangle might not intersect the extents of the
surface at all.

The test suite caught this with the trap-clip case.

The fix here is to clone the entire surface if the pattern has an
extend mode of REPEAT.
2006-10-25 10:32:37 -07:00
Jinghua Luo
804e5b58cd glitz: further fix for clone_similar.
Don't try to get pixels outside image extent. The failure number of
tests cut down to 19 with this fix, not too bad;).
2006-10-25 13:29:06 +08:00
Ian Osgood
69f740913d bug: wrong xcb_copy_area param order 2006-10-24 08:24:30 -07:00
Carl Worth
8381e53cc7 8711: Fix transformed source surface patterns with xlib backend.
This broke with the clone_similar optimization in
	 8d7a02ed58
The optimization added an interest rectangle to clone_similar,
but the acquire_surface path was neglecting to transform its
rectangle by the pattern matrix.

The test suite did catch this, but apparently we were too
distracted by the performance improvements to notice. Only
backends other than image that implemented clone_similar
would be affected by the bug, (which meant I only saw xlib
failures in my testing).

This fixes bug #8711
2006-10-23 20:46:43 -07:00
Adrian Johnson
9e4a48557e type1 fallback: ensure all functions perform correct status checking 2006-10-23 23:17:06 +09:30
Christian Biesinger
bd5d7c1fb2 Don't return an uninitialized value if _cairo_output_stream_create fails 2006-10-22 20:10:02 +02:00
Christian Biesinger
153f2d1cad Actually return a value from _cairo_type1_fallback_init_* 2006-10-22 20:10:02 +02:00
Jinghua Luo
f29a1920b0 glitz: my previous changes in _cairo_glitz_surface_create_similar is
incorrect.
2006-10-22 12:31:40 +08:00
Ian Osgood
1a90d28c3f XCB: make create_internal match Xlib
minus font options and buggy repeat
plus some cleanup and removal of more Xlib diffs
2006-10-21 11:58:01 -07:00
Jinghua Luo
343d9ef030 glitz: don't go fackback path for bitmap glyphs.
Test case bitmap font still passes with changes and improves performance
 a lot.
2006-10-21 17:27:28 +08:00
Jinghua Luo
3b1d0d3519 glitz: fix test case glyph-cache-pressure.
Glitz backend need freeze glyph cache as xlib backend otherwise it'll
crash, let's fix it now.
2006-10-21 17:23:11 +08:00
Jinghua Luo
f3c5835071 glitz: fix for clone similar.
This corrects mosts of changes in clone similar commit. But it's
still a problem in _cairo_glitz_surface_set_image, it'll crash if
source region is outside image extents.
2006-10-21 17:18:51 +08:00
Jinghua Luo
2ef9c7d9e8 glitz: fix a crash in _cairo_glitz_surface_get_image.
The previous changes in _cairo_glitz_surface_get_image causes test
clip-fill-rule-pixel-aligned and clip-fill-rule fail with a pretty
crash, this fix that.
2006-10-21 17:07:19 +08:00
Ian Osgood
a34a4a2bd7 XCB: bring composite, trapezoids up-to-date with Xlib
Categorize & recategorize
Distinguish DO_COPYAREA and DO_XTILE
Create trapezoid mask
Fixup unbounded
2006-10-20 11:17:03 -07:00
Carl Worth
b1944e1672 Fix bug in _cairo_clip_init_deep_copy (fixes clip-push-group crash)
Thanks to Miklós Erdélyi <erdelyim@gmail.com> for reporting
the original problem and suggesting the fix.
2006-10-19 15:48:13 -07:00
Ian Osgood
8d2f036752 XCB: implement subimage_copy fix
Needs further testing and review.
2006-10-19 13:42:04 -07:00
Christopher (Monty) Montgomery
8d7a02ed58 Add extents to clone_similar (fixing subimage_copy performance bug)
This fixes a huge performance bug (entire image was being pushed to X
server in order to copy a tiny piece of it). I see up to 50x improvement
from subimage_copy (which was designed to expose this problem) but also
a 5x improvement in some text performance cases.

 xlib-rgba              subimage_copy-512    3.93 2.46% ->   0.07 2.71%: 52.91x faster
███████████████████████████████████████████████████▉
 xlib-rgb               subimage_copy-512    4.03 1.97% ->   0.09 2.61%: 44.74x faster
███████████████████████████████████████████▊
 xlib-rgba              subimage_copy-256    1.02 2.25% ->   0.07 0.56%: 14.42x faster
█████████████▍
 xlib-rgba        text_image_rgb_over-256   63.21 1.53% ->  11.87 2.17%:  5.33x faster
████▍
 xlib-rgba       text_image_rgba_over-256   62.31 0.72% ->  11.87 2.82%:  5.25x faster
████▎
 xlib-rgba     text_image_rgba_source-256   67.97 0.85% ->  16.48 2.23%:  4.13x faster
███▏
 xlib-rgba      text_image_rgb_source-256   68.82 0.55% ->  16.93 2.10%:  4.07x faster
███▏
 xlib-rgba              subimage_copy-128    0.19 1.72% ->   0.06 0.85%:  3.10x faster
██▏
2006-10-18 17:06:23 -07:00
Carl Worth
e21c155e73 Merge branch '8379' into cairo 2006-10-18 15:03:04 -07:00
Carl Worth
10cd23d51f Fix infinite-join test case (bug #8379)
The trick for this was to carefully ensure that the pen always has
at least 4 vertices. There was a previous attempt at this in the
code already but the test case had a combination of matrix and radius
that resulted in a value that was just able to sneak past the previous
check.
2006-10-18 15:02:12 -07:00
Ian Osgood
968ceeec1d XCB: find_standard_format using wrong enumeration.
Requires latest xcb/util/renderutil library from git.
2006-10-18 08:14:55 -07:00
Ian Osgood
e2a0c57c1f XCB: glyph rendering support
todo: get_font_options, testing
2006-10-17 08:09:29 -07:00