Commit graph

7748 commits

Author SHA1 Message Date
Adrian Johnson
4fc7bdaed6 PS: Add some missing pdf-operators flushes 2009-11-26 21:17:52 +10:30
Benjamin Otte
3f0c9afa97 [clip] Don't ignore outermost clip when it clips everything
Fixes testcases clip-stroke-no-op and clip-fill-no-op added in
0d8a04ef47
2009-11-25 16:02:20 +01:00
Benjamin Otte
0d8a04ef47 test: Add cases to exercise clipping after no-ops
Whilst investigating:

  Bug 31788: SVG <line> with y1 == y2 and both with fractional
             part don't render
  https://bugs.webkit.org/show_bug.cgi?id=31788

I found that it can be reduced to a no-op clip following a no-op stroke
or fill. These conditions are exercised here and are shown to be a bug
introduced in the 1.9.x development series.
2009-11-25 10:53:39 +00:00
Andrea Canciani
26e9f14906 Improve stroking of densely dashed styles
Add some auxiliary functions to cairo-stroke-style to compute
properties of the dashed patterns (period, "on" coverage) and to
generate approximations when the dash pattern is sub-tolerance.
These functions are used in cairo-path-stroke to simplify dash
patterns stroked by cairo.
Fixes dash-infinite-loop
See http://bugs.freedesktop.org/show_bug.cgi?id=24702
2009-11-11 18:21:04 +01:00
Andrea Canciani
9c24288c82 Revert "[test] Reorder dash-infinite-loop to not hit a runaway allocation."
The infinite loop problem in _cairo_stroker_dash_start is solved by
commit ee02f3484899527380df94c00f40da87f41660ea, so hitting that
problem is not possible anymore and dash-infinite stroke always
hit the memory intensive loops.
This reverts commit 29432d3d32.
2009-11-11 16:45:19 +01:00
Andrea Canciani
cc2d263066 Improve stroke offset computation
The stroke offset was forced to be positive because stroking code
wants to be able to decrement it until it finds the first dash to be
drawn. This can lead to long (almost infinite) loops if the offset is
positive but huge compared to the total length of the dash pattern.
Computing the offset this way guarantees that it's always the smallest
non-negative equivalent offset.
2009-11-11 16:44:23 +01:00
Andrea Canciani
e436a57c22 Fix odd length dashing with negative offset
When computing an equivalent offset, a wrong total dash length was
used when the dash elements were odd and more than 1.
Doubling the total dash length whenever they are odd is needed to
correctly compute the new offset.
Fixes dash-offset.
2009-11-11 16:39:30 +01:00
Andrea Canciani
b1a7639465 Add dash-offset test
Stroking a dash pattern of odd length with a negative offset is broken
(except when the pattern is composed by a single dash).
2009-11-11 16:38:29 +01:00
Robert O'Callahan
7d8788b4ba [quartz] Cleanup fallback source
Remove the transformation code as it's useless and confusing.
The clipbox was transformed in a wrong way if the CTM
was not the base one, otherwise the transformation did nothing.
As long as _cairo_quartz_setup_fallback_source is only called
with the base CTM, no transformation needs to be performed on the
clipbox.
Patch by Robert O'Callahan, see Mozilla bug #507939.
2009-11-10 12:25:57 +01:00
Andrea Canciani
248090e52b [quartz] Fix compositing operators
Fallback on SATURATE (since quartz doesn't support it) and on
blending operators (to be implemented using CGContextSetBlendMode,
after its availability has been assessed).
Workaround the different behaviour of quartz operators on alpha
masks.
Fixes text in clip-operator and clip-text, blend modes in
extended-blend, extended-blend-alpha, saturate in operator,
operator-alpha and surface-pattern-operator.
Changes the output of operator-alpha-alpha, but to really fix it
pure-alpha surfaces needs to be treated as alpha masks and not as
greyscale images.
2009-11-10 12:25:47 +01:00
Andrea Canciani
d44414191a [quartz] Fix source-unbounded compositing of surface sources
Surface sources were not respecting EXTEND_NONE when composited
because the part outside of the surface rectangle was not changed.
To correctly extend the source, it's sufficient to composite a
transparent rectangle with a hole in the region covered by the surface.
Fixes clip-unbounded and operator-source. Changes the output of
surface-pattern-operator.
2009-11-10 12:25:47 +01:00
Andrea Canciani
7ef611a67a [quartz] Fix stroking with unbounded operator
Stroking was not fixed up correctly when the stroke trasform
was not the identity and when the stroked path was dashed.
Instead of building a mask image and clearing through it
(forgetting to use the CTM and the dash setting), the code now
simply fills the outside of the stroke with tranparent black.
Additionally this commit moves the CTM composition so that the invocation
of _cairo_quartz_setup_source is always done with the base CTM.
This commit changes the result of clip-stroke-unbounded (the clip
mask is now correctly aligned to the stroked path).
2009-11-10 12:25:46 +01:00
Andrea Canciani
577ac4fc6d [quartz] Fix implied colour of alpha-only surface sources
If a fill colour was set, an alpha-only surface source would
have used that colour instead of black.
2009-11-10 12:25:46 +01:00
Andrea Canciani
8b25e4a7fd [quartz] Improve unbounded operators fixup
Don't allocate a colorspace and use a 16-bytes aligned stride and
an alpha-only image for the rendering of the fixup mask.
2009-11-10 12:25:45 +01:00
Andrea Canciani
ed8bdcd598 [quartz] Improve A8 image handling
A8 images were cosidered grayscale, whereas they should behave like
transparency mask. They are now alpha-only images and the stride is
16-bytes aligned, as suggested.
Fixes alpha-similar and mask-transformed-similar. Makes the patterns
behave (as expected) as masks in surface-pattern-operator.
Affects the output of operator-alpha-alpha, but the result is not
correct because of wrong compositing.
2009-11-10 12:25:45 +01:00
Robert O'Callahan
b32695c248 [quartz] Fix gradient pattern painting
CTM was changed and not restored when painting gradients.
Fixes the alignment of surface patterns in surface-pattern-operator.
Patch by Robert O'Callahan, see Mozilla bug #507939.
2009-11-10 12:22:20 +01:00
Andrea Canciani
1ce096657b Fix compilation on MacOS X
Enable "ld_preload" (DYLD_INSERT_LIBRARIES + DYLD_FORCE_FLAT_NAMESPACE)
and build cairo-trace as a library instead of a module to make it
work also on MacOS X.
2009-11-09 16:59:31 +00:00
Andrea Canciani
c181f9e9ae Add new operator-alpha-alpha test
Compositing of alpha-only sources is not throughly tested and
as a consequence the misbehaviour of some backends is not
shown by the test suite.

[ickle: Added XFAILs for pdf, ps, svg.]
2009-11-09 16:58:06 +00:00
Adrian Johnson
cee3a6169b Type1-subset: Append "cleartomark" operator for binary fonts that don't include it
Type 1 fonts embedded in PDF may omit the fixed-content portion of the
font that contains the "cleartomark" operator.
2009-11-08 21:52:06 +10:30
Adrian Johnson
d962d6bae2 PDF: Include Type 1 fixed-content portion in the embedded font
Some fonts may contain additional PostScript code after the
cleartomark.
2009-11-08 21:46:16 +10:30
Adrian Johnson
ac59c75808 Type1-subset: Check for binary eexec data
Type 1 fonts embedded in PDF have the the encrypted portion in binary
but the existing check for binary only works for Type 1 fonts in PFB
format.

Add an additional check based on the first 4 characters of eexec data.
The Type 1 specification gurantees that at least one of the first 4
bytes of ciphertext is not an ASCII Hex character.
2009-11-08 21:38:58 +10:30
Adrian Johnson
a4a59be600 Type 1 subset: Don't add a new line when in binary mode
At the end of the private dictionary a new line is appended so that
the trailing zeros will not exceed 80 columns. In hex mode (used for
PS embedding) extra white space is harmless as it is ignored when
parsing the ascii hex encoded data. But in binary mode (used for PDF
embedding) the new line must not be added as it corrupts the binary
data.

https://bugs.launchpad.net/ubuntu/+source/cups/+bug/419143
2009-11-07 14:36:49 +10:30
Chris Wilson
9775f44436 AUTHORS: Add Andrea Canciani 2009-11-05 10:13:34 +00:00
Andrea Canciani
d51915f873 xlib: Fix double free
Both _cairo_xlib_call_close_display_hooks and _cairo_xlib_screen_destroy
invoke _cairo_xlib_screen_close_display, which frees all the cached
GCs, but (if HAS_ATOMIC_OPS is undefined) doesn't mark them as freed,
thus freeing them agin upon the second invocation.
2009-11-05 10:11:56 +00:00
Andrea Canciani
7c1424a315 quartz: Fix compilation
The function _cairo_image_surface_create_for_content does not exist.
The correct name of the function is instead _cairo_image_surface_create_with_content.
2009-11-05 10:11:41 +00:00
Chris Wilson
8a10c25c3f test: Tweak Benjamin's xcomposite-projection
Include Benjamin's advice on how to make the bug more visible inline
with the code.
2009-11-05 10:02:54 +00:00
Benjamin Otte
a9f37953c7 [xlib] Use correct number when checking if points are out of range 2009-11-04 13:59:58 +01:00
Benjamin Otte
aa1f245ea3 [test] Add "target=raster" to test
The test isn't useful on vector backends and fails there due to
antialiasing issues.
2009-11-04 13:56:15 +01:00
Benjamin Otte
52afe9c77f [xlib] Fix new Composite test
When the reference point was tirggering _line_exceeds_16_16() and got
adjusted, the code failed to compute the srcX and srcY arguments for the
call to XRenderCompositeTrapezoids() correctly and caused the resulting
source image to be misaligned.
2009-11-04 11:20:45 +01:00
Benjamin Otte
84bbf179c3 [test] Add a test exposing bugs in XRenderComposite
This test fills a slightly rotated surface slightly above the 0 line.
This hits some corner cases in the XRenderComposite path.
I discovered these issues while playing with video rendering onto the
canvas in HTML5 (both Webkit and Mozilla have this problem).
I used CAIRO_ANTIALIAS_NONE and a single-color source in the test to get
rid of aliasing issues in the output images. This makes some issues
slightly less visible, but still fails for all of them. If you want to
get a clearer view, disable it and use romedalen.png instead - it has
the same size as the red surface.

(At least) 3 bugs are at work here:
- if _line_exceeds_16_16() triggers for the reference point, the
  source surface will be misaligned.
- the intel driver seems to have an off-by-one bug on my i945 when
  positioning the source surface, causing black seams at the top
  (not visible in the test unless using romedalen.png) and on the left
  of the image.
- My Xvfb fails completely in picture up/download in the xlib-fallback
  path.
2009-11-04 11:20:04 +01:00
Chris Wilson
9b42b6156d build: Add -pthread to real_pthread_CFLAGS 2009-11-02 12:50:45 +00:00
Benjamin Otte
3eecf2f60c sphinx: Add required pthread libs
Try again, this time for real hopefully.
2009-11-02 13:20:25 +01:00
Chris Wilson
837eb577b4 sphinx: Add required pthread libs
Switching to pthread-stubs broke the build for sphinx on unbroken
platforms [those that do not unnecessarily link against -lpthreads].
2009-11-02 12:01:45 +00:00
Benjamin Otte
942a15ba9e [test] Update upscale test to expose an Xlib failure
By filling the background with grey, we can see that Xlib fills areas
with black that it shouldn't. Xlib therefore now fails this test.
2009-11-02 12:51:14 +01:00
Chris Wilson
19c411a5b8 path: Skip any secondary degenerate line-to segments.
Only the very first line-to following a move-to can have any
significance if degenerate whilst stroking, so skip all others.
In other words,

  0 0 m 0 0 l stroke

produces a capped degenerate path (i.e a dot),

  0 0 m 0 0 l 0 0 l stroke

produces the same degenerate stroke, and

  0 0 m 0 0 l 1 0 l stroke

produce a horizontal line.
2009-10-30 08:08:27 +00:00
Chris Wilson
23bcf91748 path: Misclassification of rectilinear after degenerate line-to
Malte Nuhn reported hitting an assertion:

  cairo-path-stroke.c:1816: _cairo_rectilinear_stroker_line_to: Assertion `a->x == b->x || a->y == b->y' failed.
  http://bugs.freedesktop.org/show_bug.cgi?id=24797

when stroking an apparently simple path:

  0 8.626485 m
  0 8.626485 l
  5.208333 2.5 l
  10.416667 2.5 l
  15.625 2.5 l
  20.833333 2.5 l
  26.041667 2.5 l
  31.25 2.5 l
  36.458333 2.5 l
  41.666667 2.5 l
  46.875 2.5 l
  52.083333 2.5 l
  57.291667 2.5 l
  62.5 2.5 l
  67.708333 2.5 l
  72.916667 2.5 l
  78.125 2.5 l
  83.333333 2.5 l
  88.541667 2.5 l
  93.75 2.5 l
  98.958333 2.5 l
  104.166667 2.5 l
  109.375 2.5 l
  114.583333 2.5 l
  119.791667 2.5 l
  125 2.5 l
  stroke

which upon reduction becomes:

  0.000000 8.625000 m 5.207031 2.500000 l 125.000000 2.500000 l stroke

The bug is that after spotting a repeated line-to we move the previous
end-point without reclassifying the path, hence we miss the
non-rectilinear step.
2009-10-30 08:08:13 +00:00
Adrian Johnson
600dd83398 Provide a builtin implementation of isspace() and isdigit()
The glibc versions are slow in utf8 locales.
2009-10-29 22:05:19 +10:30
Chris Wilson
f571356d34 xlib: Set has_component_alpha = FALSE for gradient Pictures
Whilst creating the xlib surface wrapper for gradient Pictures, the
corresponding attributes require ComponentAlpha disabled.
2009-10-27 20:27:09 +00:00
Chris Wilson
1a80cd2aa0 scaled-font: Fix documentation examples with incorrect derefs
Bug 24730 -- New: misleading use cases in cairo_scaled_font_text_to_glyphs's docs
http://bugs.freedesktop.org/show_bug.cgi?id=24730

An apparent copy'n'paste error from the code which has to deal with
indirect pointers crept into the documentation for the same functions.
2009-10-26 11:05:38 +00:00
Chris Wilson
f648fcd2f9 gitignore: Add forgotten cairo-perf-print 2009-10-26 11:03:16 +00:00
Chris Wilson
6911ba2f76 perf: Fix comparisons
The sort order was unstable resulting in incorrect ordering dependent
upon libc version.
2009-10-26 11:03:16 +00:00
Chris Wilson
f955a4cba7 wideint: Protect 64_32_div for non-HAVE_UINT16_T systems
Peter Clifton spotted that we failed to properly wrap
_cairo_int64_32_div() for systems without a native 64 bit type.
2009-10-25 11:04:17 +00:00
Chris Wilson
c701d7813b [pattern] Compute zero extents for empty patterns
If the pattern is for example a repeating 0x0 image, then treat it as
having zero extents.

This should workaround the bug presented here:

  https://bugs.freedesktop.org/show_bug.cgi?id=24693
  Attached PDF crashes evince with a Floating point exception
2009-10-23 14:58:33 +01:00
M Joonas Pihlaja
43a775f60d [meta] Rename cairo_meta_surface_t to cairo_recording_surface_t.
The new name is more descriptive than the rather opaque meta surface.
Discussed with vigour on the mailing list and #cairo:

http://lists.cairographics.org/archives/cairo/2009-July/017571.html
2009-10-22 02:29:47 +03:00
Chris Wilson
df357f26ff Support component-alpha.
Within our code base we carried a few hacks to utilize the component
alpha capabilities of pixman, whilst not supporting the concept for our
own masks. Thus we were setting it upon the pixman_image_t that we
passed around through code that was blissfully unaware and indeed the
component-alpha property was forgotten (e.g. upgrading glyph masks).

The real issue is that without explicit support that a pattern carries
subpixel masking information, that information is lost when using that
pattern with composite. Again we can look at the example of compositing
a sub-pixel glyph mask onto a remote xlib surface for further failure.
2009-10-21 11:37:16 +01:00
Chris Wilson
f0cd20e6ce [gl] Do not clear internal surfaces.
Create a scratch surface that will be initialised as required for
internal use. External surfaces, i.e. those returned to the user, are
cleared as normal.
2009-10-21 11:37:16 +01:00
Chris Wilson
7c9ebd4a85 Make the surface->is_clear logic common
A nasty surprise whilst profiling is that performing redundant clear
operations is extremely painful. We can mitigate this somewhat by
tracking the cleared state of surfaces and skipping repeated attempts to
clear a surface.
2009-10-21 11:37:16 +01:00
Chris Wilson
723055722f [doc] Add comments on when surfaces are cleared on construction.
Or perhaps, more importantly, when the contents are left unmodified.
2009-10-21 11:37:16 +01:00
Andrea Canciani
cef8194178 [test] Add surface-pattern-operator
Test the results of compositing ALPHA and COLOR_ALPHA surfaces
with different operators.
2009-10-20 14:57:41 +01:00
Chris Wilson
710303ef15 [test] Update rotate-image-surface-paint
Update this test case so the background is not the default border colour
so that we spot when the backend pads out the transformed image surface.
2009-10-19 17:21:57 +01:00