Commit graph

4627 commits

Author SHA1 Message Date
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
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
Luo Jinghua
ea39f0302a atomic: correct libatomic_ops version of _cairo_atomic_int_cmpxchg
AO_compare_and_swap_full() doesn't have the same semantic as
_cairo_atomic_int_cmpxchg(). The former returns a TRUE on success
FALSE otherwise while the later returns the atomic value.
2009-10-19 22:28:05 +08:00
Benjamin Otte
a2254e5647 [gstate] Apply target device offsets to patterns immediately
Previously target device offsets were applied in cairo-surface.c which
could cause bugs when paths were taken as fallbacks, as for example
pointed out by ade55037ff and quick-fixed
by 79190d8985. The quick-fix is now
unnecessary and was removed.
2009-10-18 22:12:13 +02:00
Benjamin Otte
4b720d56db [clip] Remove non-existing functions from header 2009-10-18 21:32:10 +02:00
Benjamin Otte
cacf9ccedf [path] Fix compiler warnings 2009-10-18 21:30:22 +02:00
Benjamin Otte
a70705b2ed [xlib] Fix compiler warnings 2009-10-18 21:30:06 +02:00
Chris Wilson
54df07a3da [surface] Don't AND in the desired content.
Gah, that was a horrible mistake. It was a flawed hack to create Pixmaps
of the correct depth when cloning patterns for blitting to the xlib
backend. However, it had the nasty side-effect of discarding alpha when
targeting Window surfaces. The correct solution is to simply correct the
Pixmap of the desired depth and render a matching pattern onto the
surface - i.e. a reversal the current acquire -> clone. See the
forthcoming revised xcb backend on how I should have done it originally.
2009-10-16 17:04:16 +01:00
Chris Wilson
6a19a82efd [image] Clone the format for a similar surface with identical content
Honour the incoming surface format when we are asked to create a similar
surface with identical content. The goal of
cairo_surface_create_similar() is to create an intermediate with similar
characteristics to the original that can be used in place of the
original and be quick to copy to the original. Matching the format for
the same content, ensures that the blits between the two need only be a
memcpy.
2009-10-16 10:13:57 +01:00
Chris Wilson
ed94d7caad [fallback] Create intermediate surface with same content.
The goal is to create a similar surface with an identical format to
maximise performance in the subsequent blit, e.g. the xlib backend could
make the similar surface with an identical depth and so use the core
protocol, or the image surface could indeed make an identical copy so
that pixman only has to do a fast memcpy. As there is no direct method
to specify such a clone, we ask the backend for a similar surface of
identical content, and trust that the semantics are clear enough for the
intent to obvious.
2009-10-16 09:00:16 +01:00
Chris Wilson
79190d8985 [surface] Avoid double application of device offset when calling fill()
_cairo_surface_fallback_paint() attempts to avoid a clipped operation if
we can convert the paint into a fill of the clipmask. However by calling
_cairo_surface_fill() we incur a double application of device offset to
the source, triggering various failures.

Company spotted this and managed to extract an excellent minimal test
case, test/clip-device-offset. This commit fixes that failure.
2009-10-15 14:08:01 +01:00
Chris Wilson
dac73d260a [build] Link against pthread-stubs
Avoid pulling in the real pthread library if the application is single
threaded and not using pthreads, by linking against pthread-stubs
instead.
2009-10-15 13:05:47 +01:00
Chris Wilson
ef9286751d [atomic] Fallback to libatomic-ops-dev
Use libatomic-ops-dev in preference to mutex-based atomics, if we do not
have the builtin atomic intrinsics available.
2009-10-15 13:05:46 +01:00
Chris Wilson
d85eda97dd [pattern] Compute extents for gradients
As noted in the comments we could also compute the pattern extents for
gradients with CAIRO_EXTEND_NONE under certain circumstances, i.e.
radial gradients and device axis aligned linear gradients.
2009-10-15 13:05:42 +01:00
Adrian Johnson
3a83bc8617 PDF: Fix regression caused by 1ae5a419
Bug 24240 acroread prints error message when printing
2009-10-02 23:28:10 +09:30
Adrian Johnson
91a4f59f13 PDF: Fix regression caused by 1ae5a419
Bug 24240 first char missing when printing a PDF.
2009-10-02 23:11:54 +09:30
Chris Wilson
e9bc2180d7 [xcb] Deferred error checking.
XCB avoids the dreaded abort on XError mechanism by forcing the client
to perform deferred error checking. So do so. This allows us to combine
the fire-and-forget rendering model with accurate error checking,
without killing the client or mixing our errors with theirs.

XCB for the win!
2009-09-30 20:11:07 +01:00
Chris Wilson
395555b116 [xlib] Suppress warning that should never have been. 2009-09-30 17:50:35 +01:00
Adrian Johnson
42ea356c03 Fix truetype subset crash
Bug 24213
2009-09-30 21:24:41 +09:30
Benjamin Otte
6809e12161 [API] Make _cairo_meta_surface_replay() private again
Replaying a meta surface can be achieved by using it as a source for a
cairo_paint() so exporting a separate API is unnecesary and confusing.
So after consulting Chris and Carl, we decided to remove the function
again.
2009-09-30 08:58:19 +02:00
Chris Wilson
f8c49b4187 [xlib] XRequest bread crumbing
Add bread crumbs in the form of NoOperations that can be parsed by
xtrace and very useful when debugging protocol/server errors.
2009-09-29 03:03:51 +01:00
Chris Wilson
1c4f61ec50 [tessellator] Invalid conversion of list head to edge.
When scanning for collinear right edges, we need to check that we do not
go beyond the end of the array.
2009-09-29 03:03:51 +01:00
Benjamin Otte
50163a9faf [xlib] Set proper bpp when computing format from masks
Fixing omission in caa9eed464
2009-09-29 00:24:37 +02:00
Benjamin Otte
a160c8c400 [xlib] Handle 24bpp formats during dithering 2009-09-29 00:11:52 +02:00
Benjamin Otte
9e89de8135 [image] Fix masks computation for BGRx format
Patch originally by Mark Kettenis
2009-09-29 00:11:48 +02:00
Adrian Johnson
4b2c74e285 PS: Use standard page size names for some common sizes
Some PS viewers like gv use the label in the %PageMedia DSC comment as
the displayed page size.

The page names and sizes were obtained from the list at:

http://www.gnu.org/software/gv/manual/html_node/Paper-Keywords-and-paper-size-in-points.html
2009-09-28 22:57:10 +09:30
Adrian Johnson
db5e3db0a9 PS: Add DocumentMedia/PageMedia DSC comments
Provide default DocumentMedia and PageMedia DSC comments if the user
does not specify them using cairo_ps_surface_dsc_comment(). This is
required so that PostScript viewers such as gv use the correct page
size.
2009-09-25 23:24:36 +09:30
Benjamin Otte
caa9eed464 [xlib] Handle case in draw_image() where pixman format is not RGB
When an image cannot be expressed as masks, its data cannot be used in
an XImage. In that case, we use pixman to copy the image to the desired
format.
2009-09-25 00:16:39 +02:00
Benjamin Otte
9f5fe67115 [image] Return cairo_bool_t from _pixman_format_to_masks
Return FALSE when the pixman format does not support ARGB masks. In
particular, return FALSE for YUV formats.
2009-09-25 00:14:15 +02:00
Chris Wilson
c8a4f48671 [image] Do not trust user supplied data to be clear
Gah, more important than the whitespace was the reversal of is_clear...
2009-09-23 18:08:34 +01:00
Chris Wilson
03bce099ea [image] Tweak coding style
Whitespace spam.
2009-09-23 17:56:00 +01:00
Benjamin Otte
ab558fa843 [image] Move setting of is_clear to _create_with_pixman_format()
Simplifies code and ensures other users of that function don't run into
the same bug.
2009-09-23 17:40:45 +02:00
Chris Wilson
07ee9cfbf0 [image] Do assumption initial user data is cleared.
Benjamin Otte pointed out the error of my ways that a clear on a
cairo_image_surface_create_for_data() was not working. This is because I
modified the image surface to skip clears when it knows the target data
has been cleared. This flag must be reset when the user interacts with
the surface, such as providing the initial surface data.
2009-09-23 15:37:35 +01:00
Chris Wilson
30f45ce5f7 [gl] Handle an absent visual.
If we cannot find the correct visual for the fbconfig, return an error
instead of crashing. The difference is subtle, granted.
2009-09-22 15:46:56 +01:00
Adrian Johnson
e74cb7fa3e win32-printing: correct the use of the CAIRO_HAS_WIN32_FONT #ifdef
it was wrapping code required for non windows fonts.
2009-09-22 22:44:34 +09:30
Adrian Johnson
3dd2cc8f6d win32-printing: fix meta surface pattern regression caused by bed2701e 2009-09-22 22:40:53 +09:30
Adrian Johnson
7658635c65 win32-printing: Allow GDI CTM with scale < 1 to be set
To better support creating EMF files with the win32-printing surface,
allow a GDI CTM with scale < 1 to be used.

http://lists.cairographics.org/archives/cairo/2009-September/018110.html
2009-09-22 22:36:20 +09:30
Adrian Johnson
19c0916703 Make win32 fonts work in EMF files created by win32-printing 2009-09-22 22:35:33 +09:30
Adrian Johnson
f01a54266d Fix compiler warnings in win32-surface 2009-09-22 22:34:56 +09:30
Adrian Johnson
23663e2078 Fix compiler error on cygwin 2009-09-22 22:34:21 +09:30