Commit graph

6038 commits

Author SHA1 Message Date
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
Chris Wilson
4aa0991a11 [test] Mark fallback-resolution as XFAIL.
There appears to be no simple solution here, as it seems to be a
fundamental flaw in the design of the meta-surface wrt to replaying into
a fallback image. (I may be wrong, but if Carl found no easy solution then
I feel no shame for my own failure ;-)
2008-10-06 12:02:29 +01:00
Chris Wilson
ae87382a84 [tessellator] Special case edge comparisons when on either end-point.
If the sweep-line is currently on an end-point of a line,
then we know its precise x value and can use a cheaper comparator.
Considering that we often need to compare events at end-points (for
instance on a start event), this happens frequently enough to warrant
special casing.
2008-10-04 11:58:45 +01:00
Chris Wilson
ab23c29953 [tessellator] Direct comparison of result in edges_compare_x_for_y.
We need to compare the x-coordinate of a line at a for a particular y,
without loss of precision.

The x-coordinate along an edge for a given y is:
  X = A_x + (Y - A_y) * A_dx / A_dy

So the inequality we wish to test is:
  A_x + (Y - A_y) * A_dx / A_dy -?- B_x + (Y - B_y) * B_dx / B_dy,
where -?- is our inequality operator.

By construction we know that A_dy and B_dy (and (Y - A_y), (Y - B_y)) are
all positive, so we can rearrange it thus without causing a sign
change:
  A_dy * B_dy * (A_x - B_x) -?- (Y - B_y) * B_dx * A_dy
                                - (Y - A_y) * A_dx * B_dy

Given the assumption that all the deltas fit within 32 bits, we can compute
this comparison directly using 128 bit arithmetic.
2008-10-04 10:12:37 +01:00
Chris Wilson
7db03ac68c [tessellator] Use abort() instead of exit().
More friendly when debugging, as the debug will (by default) catch the
SIGTRAP and break at the offending test.
2008-10-04 10:12:37 +01:00
Chris Wilson
59e569576d [traps] Discard trivially empty trapezoid.
The convex_quad tessellator (and possibly even the more general polygon
tessellator) will generate empty trapezoids when given a
rectangle which can be trivially discarded before inserting into traps.
2008-10-04 10:12:37 +01:00
Chris Wilson
7a2329e9c8 [traps] Reset extents on clearing.
When clearing the array of current trapezoids, reset the extents to
infinite so that they are properly recomputed.
2008-10-04 10:12:37 +01:00
Chris Wilson
8ec24a443d [xlib] Share the common conditions for starting a new xGlyphElt using a macro.
Move the predicate for starting a new glyph elt into a macro so that it
can be shared between _cairo_xlib_surface_emit_glyphs() and
_emit_glyph_chunks() without code duplication.
2008-10-04 10:10:52 +01:00
Chris Wilson
a593338b2c [xcb] Return false from _cairo_xcb_surface_is_similar().
_cairo_xcb_surface_is_similar() is currently only used by the pattern
cache to determine whether to keep the surface in the solid color cache.
This is fundamentally broken without hooking into Display closure as it
keeps a reference to an expired picture. So in order to prevent spurious
application crashes, disable the caching for xcb.
2008-10-04 08:16:45 +01:00
Chris Wilson
65f1575f6b [xcb] Compile fix.
Must compile xcb more often. Especially after copying code over from xlib.
2008-10-04 08:16:13 +01:00
Behdad Esfahbod
e76432f754 [win32] Use -MDd and -LDd instead of -MD and -LD for debug build
As reported by Damian Frank:

"I ran into a hitch with the Makefile.win32 infrastructure.  It uses -MD and
-LD when linking regardless of the config, but it should be using -MDd and
-LDd for the debug config.  I believe both the Makefile.win32.common and
src/Makefile.win32 files include erroneous declarations.  This produces
warnings at link time about a mismatch when linking against properly created
debug libs (for instance, I had a zlib built as "LIB ASM Debug" that linked
properly against the debug runtime).

This problem applies to pixman too; can you pass this along to the
maintainer?"

Would be delighted to if someone commits a fix to pixman reading this
commit message.
2008-10-04 00:35:43 -04:00
Carl Worth
8ea9cb187a Use symbolic constants for Render repeat modes.
Names like RepeatNone and RepeatNormal are much easier to
read and understand than bare 0 and 1.
2008-10-01 14:12:18 -07:00
Behdad Esfahbod
2c58a2c385 [xlib] Start a new glyph element every 128 glyphs
Xrender has limits at 252 glyphs.  We play safe and fast and limit
elements to 128 glyphs.  That's plenty, no measurable performance
hit expected.
2008-09-30 17:55:01 -04:00
Behdad Esfahbod
fd7e09c7e6 [xlib] Allow room for glyph element padding
Xrender pads glyph elements to 4byte boundaries.  We didn't consider
that in our request size calculations.  We do now.
2008-09-30 17:46:06 -04:00
Behdad Esfahbod
c01fb77abb [xlib] s/_cairo_xlib_surface_emit_glyphs_chunk/_emit_glyphs_chunk/
For readability's sake.
2008-09-30 17:41:51 -04:00
Behdad Esfahbod
c2ba25df1a [xlib] Add comment about glyph chunk invariant 2008-09-30 17:40:56 -04:00
Behdad Esfahbod
e983458e1f Revert "[xlib] Correct calculation of XRenderComposite* request size."
This reverts commit 0eb0c26474.
The change was too drastic and overlooked some subleties of the old
code, but the main reason for the revert is that it introduced an
ugly duplicated glyph flush block.  I'm working on a more incremental
fix.
2008-09-30 17:26:46 -04:00
Behdad Esfahbod
32a1585288 [configure.ac] Require autoconf >= 2.59 and automake >= 1.9.6
These are the versions available on RHEL5 (two years old now), and
we know cairo works with them.  There's evidence that our build system
does not work with older automake, and we've been requiring autoconf 2.58
but no one ever tested 2.58 with the new build system.  It's very likely
that 2.58 doesn't work and needs some macro backporting.  In any case,
no one reported that they have 2.58 when I asked on the list.
2008-09-30 15:22:30 -04:00
Chris Wilson
0eb0c26474 [xlib] Correct calculation of XRenderComposite* request size.
show-glyphs-many is triggering an assertion failure within xlib. The cause
appears to be that we are submitting an overlong request.

Reviewing the code and comparing with libXrender/src/Glyph.c I found two
points to address.

1. When encountering the first 2-byte, or 4-byte glyph and thus triggering
the recalculation of the current request_size, we did not check that there
was enough room for the expanded request. In case there is not, we need to
emit the current request (before expansion) and reset.

2. Subtleties in how XRenderCompositeText* constructs the binary protocol
buffer require that xGlyphElts are aligned to 32-bit boundaries and that
it inserts an additional xGlyphElt every 252 glyphs when width==1 or
every 254 glyphs for width==2 || width==4.  Thus we need to explicitly
compute how many bytes would be required to add this glyph in accordance
with the above.

Considering the complexity (and apparent fragility since we require tight
coupling to XRender) of the code, I'm sure there are more bugs to be
found.
2008-09-30 15:29:30 +01:00
Chris Wilson
02a56a4c84 [test/show-glyphs-many] Exercise xlib boundary conditions.
Within _cairo_xlib_surface_emit_glyphs() there are a number of
complications to do with packing as many glyphs as possible into a
single XRenderCompositeGlyph*() call. Essentially these consist of
choosing the right function and packing for the current glyphs, describing
runs of glyphs and ensuring that we do not exceed the maximum request size
within a single call. So we add to the test case we an attempt to show 64k
2-byte glyphs and an attempt to mix 64k 1-byte and 2-byte glyphs, with the
change-over point chosen to overflow the maximum request size, should
_cairo_xlib_surface_emit_glyphs() naively resize the current request.
2008-09-30 15:29:23 +01:00
Chris Wilson
2a347a92b0 [test/show-glyphs-many] Re-enable test to trigger crash in xlib.
Moral of this story is bugs cluster. If we made a mistake, especially in a
complicated bit of code that is interfacing with another library, then we
are likely to make a similar mistake in future. Disabling this test hid a
regression between 1.4 and 1.6.
2008-09-30 15:28:48 +01:00
Torsten Schönfeld
fade54e71a [doc] Add links to solid pattern constructors.
Add links for the solid pattern constructors to the language bindings
guidelines in line with the other pattern types.
2008-09-30 11:47:53 +01:00
Chris Wilson
d9f50d7841 [test/filter-nearest-offset] Remove XFAIL status
I swear that when I said that it was a rounding error, I was looking at an
image where the squares were overlapping the lines and had a listing of
all the coordinates used. However, the current output on all the machines
I have to hand is correct so I believe the underlying bug to be fixed.

Update the reference images for the external renderers because (a) GS
exhibits the same bug cairo had and (b) librvsg/PDF do not use NEAREST
when applying surface patterns, so the squares are blurred as a result.
2008-09-30 11:13:21 +01:00
Chris Wilson
7d5e6a18d5 [test/filter-nearest-offset] Paint a grey background
Avoid requiring (an absent!) rgb24 ref image by using an opaque grey
background. Confirm the reference image is identical to the old one
(modulo the background change) using GIMP.
2008-09-30 11:11:51 +01:00
Chris Wilson
35be087155 [Makefile.am] Only rerun headers-standalone if a header file has changed
Use a stamp to mark the time that the headers were last checked and only
rerun the test if any have been modified since.
2008-09-30 11:11:47 +01:00
Chris Wilson
6da8d8ea62 [pattern] Fix up OBO introduced to cloned area
In the midst of porting 5eec3e378a I failed
to include the pad in the floor() and ceil() which introduces two
potential off-by-one errors into each dimension of the region of interest
of the source surface.
2008-09-29 18:00:57 +01:00
Behdad Esfahbod
e3f9e40df7 Fix residues of the Makefile.*.config Makefile.*.features renaming
They just don't seem to want to die...
2008-09-29 11:49:50 -04:00
Chris Wilson
d703f964aa Clean up compile warnings.
A couple of unchecked status returns (which should always be
CAIRO_STATUS_SUCCESS) and an unused variable.
2008-09-29 16:40:28 +01:00
Behdad Esfahbod
1310df44ed [text_to_glyphs] Further enhance the docs
The most complex public cairo API deserves more doc love...
2008-09-29 11:34:19 -04:00
Chris Wilson
41c66a9dfa [test/xlib-surface-source] Fix ill-timed XCloseDisplay
Sigh - finding a crasher in xlib seemed too good to be true. And it was.
The bug is due to the coupling of the XCloseDisplay with the user_data on
the source surface.

This was an externally trigger XCloseDisplay whilst the user had live
surfaces, so I consider this a gross application bug and therefore does
not require graceful handling within cairo-xlib. However, I'm willing to
listen to reason...
2008-09-29 15:33:09 +01:00