Commit graph

7773 commits

Author SHA1 Message Date
Eric Anholt
e26e2c8cc4 [gl] Fix the color bits of CAIRO_CONTENT_ALPHA surface patterns to be 0.
Fixes surface-pattern-operator and alpha-similar.
2010-01-14 10:07:46 -08:00
Eric Anholt
520945603c [gl] Remove the special-casing of acquiring a pattern surface.
_cairo_pattern_acquire_surface() should do fine at it, and matches
what cairo-drm-i915 does.
2010-01-14 10:00:37 -08:00
Eric Anholt
dbf9faf823 [gl] Use GLSL for fill_rectangles when available.
Ultimately, we want all of our paths to use shaders when they are
exposed -- it brings us closer to GL 3.0 compatibility and it should
reduce the work that GL drivers have to do per operation to compute
the required hardware state.
2010-01-14 09:28:58 -08:00
Eric Anholt
57341cf5ac [gl] Use ADD instead of SOURCE when making a mask for overlapping glyphs.
The whole point of making the mask was to avoid overwriting one glyph
with the data from another.  Whoops.

Fixes ft-show-glyphs-positioning, text-rotate, overlapping-glyphs,
clip-text.
2010-01-13 14:28:23 -08:00
Eric Anholt
6e0a63102e [gl] Clear the current_target cache when binding a framebuffer in creation.
Failing to do so meant that we might not re-bind the framebuffer to
the correct one if we didn't follow up surface creation with drawing
to it.

Fixes many testcases.  Thanks to T. Zachary Laine for tracking down
that the current_target was the source of these issues.
2010-01-13 14:28:22 -08:00
T. Zachary Laine
ad0f4bee19 [gl] Clear the is_clear flag on the temporary glyph mask we create.
Normally is_clear is cleared by the caller of one of the 5 basic
entrypoints, but in this temporary surface usage nobody else can do it
for us.

Fixes ft-show-glyphs-table, user-font-rescale, and select-font-face.
2010-01-13 14:28:22 -08:00
T. Zachary Laine
384e50d858 [gl] Removed repeated lines of source
The two removed lines are redundant with code a few lines above them.
2010-01-13 14:28:22 -08:00
Eric Anholt
515ccb63a6 [gl] Fix the glyph cache full flush to really try again.
Previously, the initial error handling would dump through to software
fallback instead of retrying in the following code.
2010-01-13 14:28:22 -08:00
Chris Wilson
4aae4bfa8f test: Fix typo in path-stroke-twice reference image
Sigh. I committed the reference image with the name
path-stroke-twice-ref.png.
2010-01-12 17:11:15 +00:00
Chris Wilson
74ea4c9080 path: Do not remove anti-parallel line segments in case we are stroking
Bug 26010 - cairo_line_to optimizes away path segments
  http://bugs.freedesktop.org/show_bug.cgi?id=26010

As exercised by path-stroke-twice, we incorrectly optimise away a line
segment if the path doubled back upon itself. This is very reminiscent
of the optimisation bug for replacing curve-to with line-to.
2010-01-12 17:07:30 +00:00
Chris Wilson
a5dd5a6069 test: Add path-stroke-twice
Exercises a bug found by alois@astro.ch, whereby we inadvertently remove
a line segment when the path doubles back upon itself.

  Bug 26010 - cairo_line_to optimizes away path segments
  http://bugs.freedesktop.org/show_bug.cgi?id=26010
2010-01-12 17:07:28 +00:00
Chris Wilson
4204605813 type1: Destroy the output stream.
mpsuzuki spotted that the output stream for the subset was not being
destroyed on the error path - on closer inspection, it wasn't destroyed
along the normal path either and may never have been correctly
initialised to NULL on an earlier error.

Reported-by: mpsuzuki@hiroshima-u.ac.jp
2010-01-08 11:58:15 +00:00
Chris Wilson
41a24d822a trace: Correctly encode octal values.
How embarrassing.
2010-01-07 11:58:01 +00:00
M Joonas Pihlaja
3ae9d04c6d [stroker] Fix off-by-one memory allocation in _tessellate_fan().
The number of points in a triangle fan was miscomputed because
it was computing the number of line segments rather than points
in the fan.  Now we include the final point of the fan correctly
in the count.

This fixes https://bugs.webkit.org/show_bug.cgi?id=33071 as
reported by Benjamin Otte.  A derived test case was not added
to the cairo test suite since the bug is difficult to trigger in
a reliable way which causes visible results (as opposed to
silent heap corruption.)

The easiest way of triggering the bug is to stroke a line
using a large line width and round caps or joins.
2010-01-01 20:13:33 +02:00
Chris Wilson
a0ea0b63fd arc: Just emit a line-to if radius is zero.
In order to be consistent with the semantics of cairo_arc() using a
radius of 0 should simply degenerate into a line-to.

Reported-by: Benjamin Berg
2009-12-30 16:21:50 +00:00
Andrea Canciani
21560b3ec6 [trace] Fix compilation when FreeType is disabled
cairo-trace needs some headers which are missing if freetype is
not enabled. Adding them explicitly fixes compilation.
2009-12-30 14:08:38 +01:00
Tim Janik
393d2d9c91 Fixed documentation typo. 2009-12-28 15:25:57 +01:00
M Joonas Pihlaja
e2d75203c5 [dirty] Add more missing surface dirtying notifications.
Now that the image surface actually cares about
cairo_surface_mark_dirty() we're hitting cases where
we've forgotten to mark surfaces dirty.
2009-11-29 15:56:26 +02:00
M Joonas Pihlaja
b76565d2f4 [test] Don't use uninitialised data in surface-source.c
The draw_pattern() function assumed the incoming surface
was clear, but it's not.  Explicitly clear the surface first.
2009-11-29 15:40:30 +02:00
M Joonas Pihlaja
e09b754fdd [gstate] Change dash offset normalisation to preserve offsets in range.
We have a test case get-and-set which wants to see whatever it puts
into a cairo_t come back out again, but at the same time cairo-gstate
wants to range reduce the dash offset it's given to a sane range.
This patch changes the range reduction algorithm to always normalize
to a non-negative dash offset and not touch dash offsets which are
already in range.
2009-11-29 13:17:52 +02:00
M Joonas Pihlaja
b394240941 [test] Add missing mark_dirty() calls to test cases.
A recent optimisation has added a flag to the image
surface which is used to track whether the surface
is clear or not.  This makes it imperative that clients
call cairo_surface_mark_dirty() if they use cairo to
allocate their pixel buffers and then proceed to
initialize them without telling cairo about it.
2009-11-29 13:17:51 +02:00
Adrian Johnson
9ddf14cfd5 PDF: Don't specify colorspace in JPEG2000 image dictionary
PDF uses the colorspace specified in the JPEG2000 image.
2009-11-29 10:40:18 +10:30
Benjamin Otte
d58560bda8 Satisfy make check 2009-11-27 21:04:55 +01:00
Benjamin Otte
16fffc5c05 Apply device transform in surface wrapper 2009-11-27 21:04:48 +01:00
Adrian Johnson
02d7e123d6 PDF: Remove extraneous \n from end of jpeg/jp2 data
PDF requires a '\n' between the end of stream data and the "endstream"
that is not included in the stream length. Ensure this is always added
in _close_stream where it is not included in the stream length.

Previously the jpeg/jp2 embedding functions were adding the '\n'. This
resulted in the '\n' becoming part of the stream data.
2009-11-27 23:11:56 +10:30
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