Commit graph

6067 commits

Author SHA1 Message Date
Chris Wilson
02a7ca80f9 [pattern] Correctly optimize away fractional translations.
As is so often the case, reading the commit log gives you fresh insight in
the problem - often called confessional debugging...

We can simplify the problem by ignoring attr->[xy]_offset, for the time
being, and focus on computing the correct matrix. This is comparatively
simple as all we need to do is perform the appropriate rounding on the
translation vector.
2008-10-14 11:08:43 +01:00
Chris Wilson
9886cb3353 [pattern] Only perform non-integer optimization for identity matrices.
A complication I realised after pushing 3eb4bc3 was handling larger
sampled areas.  Extending the test case revealed that the optimization
was broken for anything but the identity transform (after removing the
translation).  Correctness first, leaving the "pixel-exact" solution for
interested reader...
2008-10-14 10:27:21 +01:00
Chris Wilson
8dc3deecb8 Add documentation for function attributes 'pure' and 'const'.
Carl suggested that cairo_pure and cairo_const are pretty opaque, even to
the developer who added them, so it is extremely important that they have
a good description so that they are used correctly and perhaps ported to
other compilers.
2008-10-14 08:17:23 +01:00
Chris Wilson
6aa1143d5a Update documentation to remove references to cairo_has_show_text_glyphs().
With the addition of cairo_show_text_glyphs() came a couple of functions
to query whether the target supported the extended attributes. However,
at Carl's request cairo_has_show_text_glyphs() was removed - but the
documentation was not updated to reflect that.
2008-10-13 23:49:17 +01:00
Chris Wilson
b2053945df [scaled-font] Correct documentation for cairo_scaled_font_create().
Fix the documentation not to suggest that NULL is a legal value for
font_options (as we temporarily made it during the 1.[57] dev cycle).
2008-10-13 23:39:47 +01:00
Chris Wilson
3eb4bc3757 [pattern] Optimize away fractional translation for NEAREST patterns.
As identified in bug 15479,
  Unpredictable performance of cairo-xlib with non-integer translations of a
  source surface pattern
  (https://bugs.freedesktop.org/show_bug.cgi?id=15479),
source surfaces with a fractional translation hit slow paths for some
drivers, causing seemingly random performance variations. As a work-around
Owen Taylor proposed that cairo could convert non-integer translations on
NEAREST sources patterns to their integer equivalents.

The messy detail involved here is replicating the rounding mode used by
pixman for the sample offset, but otherwise the conversion is fairly
trivial.
2008-10-13 23:34:51 +01:00
Chris Wilson
ceab32e2c3 [win32] win32 also uses font subsets.
Include win32 in the list of font subset users, fixes build when
cross-compiling.
2008-10-12 12:11:12 +01:00
Chris Wilson
1d3453eee5 [pattern] Rescale the linear pattern matrix to avoid overflow.
As proof-of-principle, compute a scale factor to avoid overflow when
converting a linear pattern to pixman_fixed_t. Fixes test/huge-pattern,
but the principle should be extended to handle more cases of overflow.
2008-10-12 11:38:42 +01:00
Chris Wilson
ab1d106cba [xlib] Use the cached xrender formats.
Use the cached formats for consistency and simplify several double pointer
dereferences.
2008-10-11 19:52:28 +01:00
Chris Wilson
6736faba3e [test/any2ppm] Do not attempt to compile PS without spectre
Since CAN_TEST_PS_SURFACE does not currently require spectre, we were
attempting to compile in spectre support for any2ppm even on systems
without libspectre installed. Fix that by adding a separate flag for
CAIRO_HAS_SPECTRE.
2008-10-11 19:01:43 +01:00
Benjamin Otte
b358711162 [test] Add huge pattern.
Add a test case to exercise range overflow during gradient construction.
2008-10-11 18:12:29 +01:00
Chris Wilson
7707027081 [test] Use _POSIX_C_SOURCE for flockfile.
From bug 18010 (https://bugs.freedesktop.org/show_bug.cgi?id=18010),
in order to make flockfile() available we need to set _POSIX_C_SOURCE and
according to the man page, the appropriate feature check is
_POSIX_THREAD_SAFE_FUNCTIONS.
2008-10-11 18:12:28 +01:00
Adrian Johnson
34ff7e4ac4 Check that reads in truetype_reverse_cmap are within valid data
Bulia Byak reported a bug where cairo was crashing with a particular
font. The font had an incorrect entry in the cmap table that caused
cairo to read from outside of the buffer allocated for the cmap.
2008-10-11 23:44:37 +10:30
Chris Wilson
a16ef6ead2 [INSTALL] Mention pkg-config requirement
Mention that building the configure script requires at least version 0.16
of pkg-config.

See the old bug:
  Bug 4702 PKG_PROG_PKG_CONFIG: command not found
  (https://bugs.freedesktop.org/show_bug.cgi?id=4702)
2008-10-10 18:03:49 +01:00
Chris Wilson
eba9d87d54 [image] Warn about a potential NULL return after finish().
Improve the wording as suggested by
  https://bugs.freedesktop.org/show_bug.cgi?id=12659
to warn about the possibility of returning NULL even if the passed in
surface was an image surface.
2008-10-10 16:51:07 +01:00
Chris Wilson
ac3e4b4bea [xlib] Disable XRender support if the surface has no xrender_format
Bug 11734:
  XRender crashes due to NULL pointer from Cairo on SGI O2
  (https://bugs.freedesktop.org/show_bug.cgi?id=1173)
is an example of a case where we try to perform an XRender operation on a
surface with a format that was not supported by the XRender extension. By
marking the extension version as -1 on those surfaces, the current checks
for SURFACE_RENDER_HAS_* always correctly return false and prevent us try
to create a Picture with a NULL xrender_format.
2008-10-10 15:42:09 +01:00
Carlos Garcia Campos
8ac8e8c523 [test] Add ps2png check program using libspectre
Add a simple program to compliment pdf2png and svg2png.
2008-10-09 12:25:08 +01:00
Carlos Garcia Campos
3e6afb353d [test/any2ppm] Enable PS conversion using libspectre.
Complete the vector trilogy using libspectre to provide a similar
interface (to poppler and librsvg) around GhostScript.
2008-10-09 12:25:08 +01:00
Chris Wilson
ddd1615a17 [pattern] Remove incorrect assert.
It's possible to reach that point without setting the filter to NEAREST,
for example if using FAST or GAUSSIAN.
2008-10-09 12:25:07 +01:00
Benjamin Otte
c647c0bbca [TEST] make imagediff work again
It seems to have bitrotten
2008-10-09 13:22:01 +02:00
Björn Lindqvist
f644d78dc1 [perf] Add composite performance test.
Add a new test case to Cairo for checking the performance of Cairo's
equivalent to GDK's gdk_pixbuf_composite_color() operation. That is an
operation that happens to be extremely useful when viewing or editing
transparent images so I think it is important that it is as fast as
possible.
2008-10-08 20:10:27 +01:00
Chris Wilson
96b083d3f0 [test] Exercise degenerate dashes.
Add a test case to capture the current behaviour when a segment ends on
an off/on dash transition.

Originally filed as bug:
  Miter artifacts for dashed strokes
  https://bugs.freedesktop.org/show_bug.cgi?id=17973
2008-10-08 19:04:42 +01:00
Chris Wilson
6487a147a2 [cairo.h] Be defensive when checking for _MSC_VER
Since cairo.h is a public header file, we need to be careful so that it
can be compiled by random compilers and even users specifying "-Werror
-Wundef" (mentioning no names, Company). So replace the bare (and legal)
  #if _MSC_VER
with
  #if defined (_MSC_VER)
just in case.
2008-10-08 15:26:03 +01:00
Chris Wilson
59141e56a7 [win32] Restore fine-grained fallback support for printing.
Missed updating win32 when implementing the new paginated API to query
support for the fine-grained fallbacks.

(Thanks to Adrian for spotting this oversight.)
2008-10-08 13:51:43 +01:00
Chris Wilson
565c02a37e [svg] Use finer-grained fallbacks for SVG 1.2
The use of fine-grained fallbacks requires the native support of the
SOURCE operator applied to an image on the target surface. SVG 1.2
introduces the "comp-op:src" mode fulfilling this criteria - so we can
enable fine-grained fallbacks for 1.2+.

Update test/fine-grained-fallbacks to exercise this pathway in SVG 1.2 -
as SVG natively supported all the current operations within that test.
This reveals yet another librsvg bug in handling SVG 1.2.
2008-10-08 12:43:35 +01:00
Vladimir Vukicevic
0c777a3e0d [win32] Use wide-char versions of some API functions, for compat with Windows Mobile 2008-10-07 15:20:33 -07:00
Chris Wilson
cf572b58e1 [tessellator] Compile fixes for !HAVE_INT64_T
Fixup a couple of instances of implicit down-casting to 32bits from a
64bit wide integer and add a new is_zero() predicate.
2008-10-07 22:16:26 +01:00
Chris Wilson
6b8c055962 [tessellator] Avoid implicit promotion to 64bit integer.
Avoid passing a 32bit integer as a cairo_int64_t in case we do not have a
64bit native integral type. As a side-effect this means we can also use a
narrower multiply.
2008-10-07 22:16:07 +01:00
Chris Wilson
eaa4bd1392 [pattern] After cloning adjust [xy]_offset if possible.
For the simple case where the pattern matrix only contains an integer
translation then care is taken to convert that to a identity source matrix
with the translation applied to the [xy]_offsets. 5b97ee6525 broke this
guarantee by applying the clone offsets to the source matrix. So when the
source matrix is identity we can simply adjust the [xy]_offsets and
preserve the identity matrix. (This idea can be extended further by
removing any integer translation from the source matrix and storing it in
the [xy]_offsets as a means to extend the limited precision in
pixman_matrix_t - encountered when downscaling large images offset onto
the target surface.)
2008-10-07 21:09:16 +01:00
Chris Wilson
552cc09e6b [xlib] Check integer translation for XCopyArea.
A precondition for using the core XCopyArea protocol is that the source
attributes contain only integer translations. However, we failed to apply
any integer translations from the source matrix to the XCopyArea offsets.
This worked prior to 5b97ee6525 as
_cairo_pattern_acquire_surface_for_surface() was careful to only generate
an identity matrix if the pattern matrix only contained an integer
translation (and thus we would use XCopyArea in the xlib backend).
2008-10-07 21:05:57 +01:00
Chris Wilson
308485a3fc [test] Add a test for a reported regression by Michael Natterer.
mitch reported on irc that expose events in the gimp were suffering from
artifacts which he tracked down to a bug with clipping and source
surfaces. This is the cairo test case for that regression.
2008-10-07 20:23:12 +01:00
Vladimir Vukicevic
28a3b546b9 [win32] create_similar should fall back to DIBs if DDB creation fail 2008-10-07 10:25:46 -07:00
Vladimir Vukicevic
4ae37a97b3 [quartz] initialize do_reflect field correctly for pattern draws 2008-10-07 10:18:41 -07:00
Chris Wilson
8cf399b944 [test] Add a test to exercise the internal twin font
Although Behdad promises that the rendering is subject to improvement,
introduce a test to check consistency across platforms and update as
required.
2008-10-07 01:45:46 +01:00
Chris Wilson
1f813ff040 [array] Silence gtk-doc complaints.
gtk-doc fails make check for array as it insists that even the simplest
functions must have a long description and cannot be entirely described by
their arguments and return value.
2008-10-07 01:45:45 +01:00
Chris Wilson
7cb9ccb4cb Fixup a couple of trivials doc warnings.
Correct the 'Returns' statement to match what gtk-doc expects.
2008-10-07 01:45:45 +01:00
Chris Wilson
d6f0351b6c [skiplist] Avoid repeated calls to compare on the same element when inserting.
During insertion we must traverse the skiplist in order to find the
insertion point for the new element. As we descend each level, the next
element in the chain for this level is sometimes the same as the one we
just compared against (and know that the new element is greater than).
Hence we can skip the search on that level and descend to the next. During
world_map this reduces the number of calls into _sweep_line_elt_compare()
by ~2.5% (and when performing trapezoidation on strokes gives a similar
speed up of about 2% - not bad for the addition of a single line.)
2008-10-07 01:45:45 +01:00
Chris Wilson
1440399625 [hull] Replace open-coding of 64bit arithmetic.
Use primitives from cairo-wideint-private.h - in this case it helps to
make the code more readable as well as reduce dependence on native 64bit
integers.
2008-10-07 01:45:45 +01:00
Chris Wilson
c6a6bf580f [slope] Replace open-coding 64bit integer arithmetic.
Prefer to use the operations form cairo-wideint-private.h in order to
improve readability and reduce our assumptions on the availability of
64bit integers.
2008-10-07 01:45:45 +01:00
Chris Wilson
5e3fcb7934 [wideint] Declare the wideint arithmetic functions as const.
'const' is a stricter form of 'pure' in that functions declared with that
attribute do not access any values other than their arguments (in
contrast to 'pure' which is allowed to read from global memory).
2008-10-07 01:45:45 +01:00
Carl Worth
9430bf57eb Fix scrambled version number in generated documentation.
In the cairo 1.8.0 release the documentation would get generated with
the second and third version components transposed, (so it would say
1.0.8). Fix the obviously mistaken transposition.
2008-10-06 14:02:19 -07:00
Behdad Esfahbod
5beae8f530 [Makefile.am.releasing] Make 'make snapshot' print a banner when done
Copied from "make distcheck" implementation.  Prints something like:

=============================================================
cairo-1.8.1-20081006-38de89 archives ready for distribution:
cairo-1.8.1-20081006-38de89.tar.gz
=============================================================
2008-10-06 12:46:41 -04:00
Behdad Esfahbod
38de895d38 [RELEASING] Fix sample distcheck output to reflect current versioning 2008-10-06 12:11:18 -04:00
Behdad Esfahbod
f8018cf193 [boilerplate] Fix "make dist"
The cairo-boilerplate-ps/pdf/svg.h files where removed in commit
9841d9d58e but the Makefile.sources
listing was not updated.
2008-10-06 11:45:08 -04:00
Behdad Esfahbod
6578ac148e [twin-font] Make the stroke lighter
I'm still to fine-tune the font and add hinting and bold/oblique support.
In the mean time though, a lighter stroke produces much nicer glyphs.
2008-10-06 11:40:34 -04:00
Behdad Esfahbod
2fb7753903 [Makefile.am.releasing] Exclude uid/gid from tarball
By setting GNU tar options --owner=0 --group=0
2008-10-06 11:40:34 -04:00
Behdad Esfahbod
589564c3b0 [user-font] Fix comment re backend interface 2008-10-06 11:40:33 -04:00
Chris Wilson
c98c1cb532 [wideint] Mark functions as pure
Take advantage of the gcc function attribute 'pure', which tells gcc that
the function result only depends upon its arguments and it has zero side
effects (e.g. it does not clobber memory). This gives gcc greater
opportunity to rearrange and optimize the wideint arithmetic.
2008-10-06 12:52:09 +01:00
Chris Wilson
76dd4603d0 [tessellator] Replace open-coding _cairo_int64_cmp().
We often use the construct:
  if (_cairo_int64_lt (A, B)
     return -1;
  if (_cairo_int64_gt (A, B)
     return 1;
  return 0;
to compare two large integers (int64, or int128) which does twice the
required work on CPUs without large integer support. So replace it with a
single wideint function _cairo_int64_cmp() and therefore allow
opportunities to both shrink the code size and write a more efficient
comparison. (The primarily motivation is to simply replace each block with
a single more expressive line.)
2008-10-06 12:07:41 +01:00
Chris Wilson
6eead4a5f7 [stroke] Simplify dash-off logic.
Remove a redundant level of if-else branching (and remove a duplicate
code) block by testing dash_on first.
2008-10-06 12:02:29 +01:00