Commit graph

6011 commits

Author SHA1 Message Date
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
Chris Wilson
63ee963c63 [user-font] Rewrite text_to_glyphs allocation instructions.
Resolve the seemingly conflicting two paragraphs that instruct the writer
of a user-font on when to allocate the glyphs array during text_to_glyphs,
so that it is consistent with itself and the code. In particular, I could
find no indication in the code that num_glyphs is preset to -1 (it should
be a user parameter reflecting the number of entries in the supplied glyph
buffer) and the callback must allocate the array using
cairo_glyph_allocate().
2008-09-29 15:18:29 +01:00
Chris Wilson
c23dbc4c61 [test/surface-source] Modify to trigger a crash.
Whilst investigating:
  Bug 7360 painting huge surfaces fails
  https://bugs.freedesktop.org/show_bug.cgi?id=7360
I found a particular combination of operations that cause a crash within
xlib, so I'm committing the test for posterity.
2008-09-29 13:54:12 +01:00
Chris Wilson
3b33d49d37 [test/filter-bilinear-extents] Remove XFAIL.
With the reintroduction of Carl Worth's and Owen Taylor's work to expand
pattern extents as necessary to include extra samples due to the filter
radius, we expect filter-bilinear-extents to PASS. This patch series is
important as it factors out our assumptions about filter radius into a
single function and cleans up the code in its wake.

However, since the external PS/PDF renderers do not necessarily use the same
filter as cairo (and currently they only use NEAREST due to lack of
/Interpolate emission in those backends) we can expect differences in test
output. So add the respective reference images to capture current
expectations and to highlight future changes.

Fixes bugs:
  Bug 15349 - bad clipping with EXTEND_NONE
  [https://bugs.freedesktop.org/show_bug.cgi?id=15349],
  Bug 15367 -Improve filtering handling in cairo-pattern.c
  [https://bugs.freedesktop.org/show_bug.cgi?id=15367]
2008-09-29 09:46:50 +01:00
Owen W. Taylor
5eec3e378a [pattern] Improve handling of filter radius and optimize when possible.
Factor out common filter analysis code from _cairo_pattern_get_extents()
so that we can share it with _cairo_pattern_acquire_surface_for_surface()
as well. During the analysis of the filter determine whether the pattern
matrix maps source pixels exactly onto destination pixels and if so convert
the filter to NEAREST - generalising the existing conversion to NEAREST.

(Patch ported to master by Chris Wilson, all bugs are his.)
2008-09-29 09:46:50 +01:00
Carl Worth
7d7057cf88 _cairo_pattern_get_extents: Fix to allow for expansion based on filter
This fixes the filter-bilinear-extents test case and the
related bug entry:

	bad clipping with EXTEND_NONE
	http://bugs.freedesktop.org/show_bug.cgi?id=15349

Though there are still differences in the PDF and PostScript
backends, (primarily because we can't capture cairo's filter
modes in those file formats).
2008-09-29 09:46:49 +01:00
Owen W. Taylor
6ef4bd4ecf [pattern] Fix acquiring outside of source bounds
Restrict the area we acquire from the source image to the bounds of
the source image, even when we have an identity matrix. This handles
circumstances where the pattern extents may be enlarged due to
filtering, for example when applying a bilinear filter.

This patch replaces the open-coded rectangle intersection which has
already proven itself to be a source of bugs.

(Patch ported to master by Chris Wilson, all bugs are his.)
2008-09-29 09:46:49 +01:00
Owen W. Taylor
6d0f2c4421 [pattern] Remove the hack to support cloning surface patterns.
Remove instances (abuses) of calling _cairo_pattern_acquire_surface() on
a known-surface-pattern with a hack to say "give me the entire surface".
If you know you just want the entire surface as an image surface, that
can be done more simply.

(Split from original patch on
https://bugs.freedesktop.org/attachment.cgi?id=15703, by Chris Wilson -
as usual all bugs are his.)
2008-09-29 09:46:49 +01:00
Chris Wilson
117f643e49 [test/filter-bilinear-extents] Extend testing.
First, explicitly set the filter mode to BILINEAR in case the default should
ever change. And then draw a second pattern with extents that in theory
are larger than the source surface in order to test handling of acquiring
out-of-bounds extents.
2008-09-29 09:46:09 +01:00
Chris Wilson
3ff86a4510 [test] Disable caching of SVG fail/pass surfaces.
As we use cairo to convert SVG files back to an image, that process is
dependent upon changes within our library and so we cannot skip the
conversion if the SVG file happens to match a previous run. Fortunately,
librsvg is quick enough that this is not a major issue.
2008-09-29 09:08:10 +01:00
Chris Wilson
24b22f0d21 [glitz] Compile fix for typo.
I wonder whether merely fixing a compile error in glitz will do anything
towards its utility... Anyway fix the missing comma as reported by
Shunichi Fuji and correct the asserts.
2008-09-29 08:30:25 +01:00
Chris Wilson
4f449107af [test/fallback-resolution] Exercise a couple of outstanding bugs.
Use dashes to exercise bugs:
  https://bugs.freedesktop.org/show_bug.cgi?id=9189
  https://bugs.freedesktop.org/show_bug.cgi?id=17223
Note bug 17223 indicates that this is still relevant for win32 printing
where fallbacks are used if the dash offset is non-zero.

And use a pattern to exercise the (fixed) regression:
  https://bugs.launchpad.net/inkscape/+bug/234546
2008-09-28 21:05:36 +01:00
Chris Wilson
0a7d781ab0 [perf] Add rounded rectangle perf case.
Add the performance test case to compare the speed of filling a rounded
rectangle (one with camphered corners) as opposed to an ordinary
rectangle. Since the majority of the pixels are identical, ideally the two
cases would take similar times (modulo the additional overhead in the more
complex path).
2008-09-28 18:59:43 +01:00
Karl Tomlinson
d52b55cb1b [xlib] _surfaces_compatible() can return true for different picture formats
_surfaces_compatible in cairo-xlib-surface returns true for surfaces with
different xrender_format when each has the same depth and no (NULL)
visual.

Common picture formats will not have the same depth, but
it is possible to create a surface with a non-standard xrender_format
having the same depth as another xrender_format with
cairo_xlib_surface_create_with_xrender_format.

Both cairo_xlib_surface_create_with_xrender_format and
_cairo_xlib_surface_create_similar_with_format create surfaces with no
visual.

The same issue exists in the xcb backend.

Fixes bug https://bugs.freedesktop.org/show_bug.cgi?id=16564.
2008-09-28 17:51:23 +01:00
Chris Wilson
b6b54e2f27 [svg] Compile fix for last commit.
Sorry - badly merged patch (missed a chunk).
2008-09-28 17:13:11 +01:00
Chris Wilson
cff3bcba68 [svg] Check that the mask is supported.
During the analyze phase we also need to check whether we can emit the mask
without requiring fallbacks.
2008-09-28 17:06:32 +01:00
Chris Wilson
8ad3031359 [svg] Enable the assertion that paint() is supported.
The XXX comment before the disabled assert is misleading as the final
fallback image paint operation should never trigger UNSUPPORTED.
2008-09-28 17:04:15 +01:00
Chris Wilson
95e637f9ac [paginated] Set paginated mode before every replay.
Previously we were replaying full page fallbacks without updating the
mode - this was upsetting SVG.
2008-09-28 16:57:42 +01:00
Chris Wilson
36b9858991 [svg] Kill _cairo_svg_surface_force_fallbacks.
It is not used, but refuses to die!
2008-09-28 16:24:40 +01:00
Benjamin Otte
57851464f9 [SVG] make backend handle new operators gracefully
Previously, the SVG backend would rash when new operators were added to
cairo.h, now it returns UNSUPPORTED.
Also unsupported operators can now be set as NULL, so image fallbacks can
be used properly.
Should use fallbacks instead of color-dodge for CAIRO_OPERATOR_STURATE?
2008-09-28 17:10:22 +02:00
Benjamin Otte
fda80cc852 [SVG] use _cairo_operator_bounded_by_source()
previously, the code was duplicating its functionality
2008-09-28 17:10:22 +02:00
Chris Wilson
3c18d95b29 Compute device_transform_inverse.
Because we can independently set either the device scale or the device
offset, we need to be careful and recompute the inverse rather than simply
assuming that the original contents of the device transform is identity.

Fixes regression https://bugs.launchpad.net/inkscape/+bug/234546.
2008-09-28 16:08:18 +01:00
Chris Wilson
9841d9d58e Automate error checking for fallback-resolution.
For this we extend the boilerplate get_image() routines to extract a
single page out of a paginated document and then proceed to manually
check each page of the fallback-resolution test.

(Well that's the theory, in practice SVG doesn't support multiple pages
and so we just generate a new surface for each resolution. But the
infrastructure is in place so that we can automate other tests,
e.g. test/multi-pages.)
2008-09-28 14:57:12 +01:00
Chris Wilson
cca1fc6358 [test] Fix target specific tests for recent SVG/PS version split.
A few tests explicitly checked whether the "ps" or "svg" target was
enabled and this broke because of the name change. So fixup, to run
the generic test if either PS or SVG target is enabled as appropriate.
2008-09-27 21:53:21 +01:00
Chris Wilson
39e4a0bcd0 [test] Update list of REFERENCE_IMAGES
A few typos, deletions and additions from the inclusion of versioned
SVG/PS testing.
2008-09-27 19:33:51 +01:00
Chris Wilson
260362e572 [cairo-test] Fix cairo_test_file_is_older().
It did not even compile, so no longer it wasn't deleting cached results
if you updated the reference images.
2008-09-27 19:16:34 +01:00
Chris Wilson
ffbb67303c [test/gradient-constant-alpha] Remove ps2 reference images.
PostScript level 2 has no support for gradients and so should uses image
fallbacks and hence do not require the GS specific reference images.
2008-09-27 18:54:45 +01:00
Chris Wilson
4fa9f8c060 [test/large-source] Remove stale comment.
Delete a reference to an old limitation of pixman.
2008-09-27 17:42:06 +01:00