Commit graph

11008 commits

Author SHA1 Message Date
Bryce Harrington
be206ddf20 Add explanation to enum _cairo_int_status
Patch based on suggestion by Homer Hsing

Bugzilla:  https://bugs.freedesktop.org/show_bug.cgi?id=50416
2014-02-26 18:40:12 -08:00
Bryce Harrington
19b31bbe70 image: Fix bad HTML generation in code docs for cairo-format-stride-for-width
Patch from Simon Kågedal Reimer

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63257
2014-02-26 18:36:15 -08:00
Bryce Harrington
7b50883577 gl: Handle PIXMAN_a8r8g8b8_sRGB format in switch
Fixes the following compiler warning:

  cairo-gl-surface.c:182:5: warning: enumeration value
  ‘PIXMAN_a8r8g8b8_sRGB’ not handled in switch

Same fix as done for image in 1d0055078.

Chris Wilson <chris@chris-wilson.co.uk>
2014-02-25 12:14:36 -08:00
Bryce Harrington
44a09f462c mesh: Avoid theoretical infinite loops
This quells this warning:

  src/cairo-mesh-pattern-rasterizer.c:731:5: warning: cannot
  optimize possibly infinite loops

I guess the compiler's complaining because if vsteps were negative or
equal to UINT_MAX the loop could cycle infinitely.  Silly compiler.

Fix as suggested by Chris Wilson <chris@chris-wilson.co.uk>
2014-02-25 12:14:09 -08:00
Bryce Harrington
19f412bb1f xml: constify source objects for emit routines
This quells the following warnings:

  src/cairo-xml-surface.c:576:5: warning: passing argument 2 of
  ‘_cairo_xml_surface_emit_clip_boxes’ discards ‘const’ qualifier from
  pointer target type
  src/cairo-xml-surface.c:462:1: note: expected ‘struct cairo_clip_t
  *’ but argument is of type ‘const struct cairo_clip_t *’

Most of the cairo_xml*emit* routines const their source objects;
these should follow suit.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-25 12:13:56 -08:00
Bryce Harrington
dc8ca191f5 xml: Drop unused variable
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-25 12:13:50 -08:00
Bryce Harrington
9b8a752249 test: Quell warning for deprecated g_type_init()
The g_type_init() routine was deprecated in glib 2.34.  Tested and
verified this conditionalization on glib 2.32 and 2.36.  No need to
change version dependencies.

  test/any2ppm.c:864:5: warning: ‘g_type_init’ is deprecated
  (declared at /usr/include/glib-2.0/gobject/gtype.h:669)

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-25 12:13:40 -08:00
Bryce Harrington
75e671c29b test: Quell warning for inclusion of old rsvg header files
This silences a warning due to header file deprecated as of libsrvg
2.36.2.  Tested and verified this hackaround on librsvg 2.36.4 and
2.36.1.  No need to change version dependencies.

  In file included from test/any2ppm.c:73:0:
  /usr/include/librsvg-2.0/librsvg/rsvg-cairo.h:27:2: warning:
  #warning "Including <librsvg/rsvg-cairo.h> directly is deprecated."

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-25 12:13:34 -08:00
Bryce Harrington
a346e40ed3 perf: Guarantee path width is non-negative
This quells the following warning:

  perf/micro/hatching.c:39:5: warning: cannot optimize loop, the
  loop counter may overflow

Width and height aren't going to be negative so enforce it so that the
compiler can do whatever optimization it wants to do.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-25 12:13:10 -08:00
Ryan Lortie
4144307dbf cairo-version: fix docs build
We do some evil things in this doc comment by closing a <para> tag further up.
Make sure we reopen it at the end so that gtk-doc's attempt to close it again
doesn't result in an imbalance.
2014-02-05 08:40:38 -05:00
Bryce Harrington
39b7d5138e cairo-script: Compare status with CSI enums
CSI_STATUS_SUCCESS is defined as equivalent to CAIRO_STATUS_SUCCESS.
We should prefer the former when comparing against csi_status_t
variables, else we'll get a warning:

cairo-script-interpreter.c:637:23: warning: comparison between
‘csi_status_t’ and ‘enum _cairo_status’ [-Wenum-compare]

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 11:26:02 -08:00
Bryce Harrington
18d66c88a2 cairo-script: Error if asked to decompress with missing compression lib
This quells the following warning:

warning: enumeration value ‘LZO’ not handled in switch [-Wswitch-enum]

The LZO enum value is defined and used elsewhere, even if lzo support
isn't available.

This situation might arise if cairo scripts were generated on one system
with lzo, and then replayed on a system without it.  For now simply
error out if this occurs.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 11:25:57 -08:00
Bryce Harrington
1ce452db4c cairo-trace: Stringify CAIRO_STATUS_JBIG2_GLOBAL_MISSING
This error enum was added last September when JBIG2 support was added.
Support it as well in the tracing code.  This fixes this warning:

trace.c:1544:5: warning: enumeration value
‘CAIRO_STATUS_JBIG2_GLOBAL_MISSING’ not handled in switch [-Wswitch]

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 11:25:53 -08:00
Bryce Harrington
9a29805f4e test: Drop unused path variable in two recently added tests
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 11:25:48 -08:00
Bryce Harrington
0723290a6f test: Handle error in fgets call in ps-eps test
Most likely this is just a theoretical problem since we just checked
feof, but this quells the following warning:

ps-eps.c:216:8: warning: ignoring return value of ‘fgets’, declared with
attribute warn_unused_result [-Wunused-result]

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 11:25:43 -08:00
Bryce Harrington
1b522f81e2 test: Replace deprecated rsvg_init() in any2ppm test
As of libsvg 2.35 calling g_type_init() is sufficient.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 11:25:32 -08:00
Behdad Esfahbod
5de25951a4 Preserve current-point in copy_path()/append_path() sequence
Fixes path-currentpoint test.
2014-01-27 17:34:00 -05:00
Behdad Esfahbod
8d2e24479a [tests] Add path-currentpoint
Checks whether copy_path()/append_path() preserves current-point.
Currently failing.
2014-01-27 17:32:58 -05:00
Uli Schlachter
2a7f133639 cairo svg: Use \n instead of /n in bitmap fonts
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-01-19 20:06:25 +01:00
Adrian Johnson
b56b971141 type1: strip space from end of font name 2014-01-11 21:03:58 +10:30
Adrian Johnson
ee0e2b9272 ps: add font DSC comments 2014-01-11 21:03:58 +10:30
Adrian Johnson
2d3ee70ed3 ps: cairo_set_page_size does not need to be in eps output 2014-01-11 20:57:34 +10:30
Adrian Johnson
26d0edbc35 ps: use setpagedevice to set page size
https://bugs.freedesktop.org/show_bug.cgi?id=73452
2014-01-11 10:46:46 +10:30
Marek Kasik
97f6e2005d font: Generate PDFs with correct font names
Escape PostScript names of loaded fonts. These can not
contain white spaces and delimiter characters when saving
them to a PostScript file or a PDF file.
2014-01-10 20:51:08 +10:30
Adrian Johnson
f81b140675 ps: fix imagemask with pattern source failure on some printers
When /PaintProc is invoked the pattern dict is pushed onto the stack.
Ensure this dict is removed.

https://bugs.freedesktop.org/show_bug.cgi?id=69485
2014-01-08 07:45:20 +10:30
Adrian Johnson
2afc941d7f ps: remove duplicate /Interpolate from image dictionary
http://lists.freedesktop.org/archives/poppler/2014-January/010748.html
2014-01-03 22:19:40 +10:30
Adrian Johnson
2974416dfc Add test for paint with alpha and clipping bug
Add test case for https://bugs.freedesktop.org/show_bug.cgi?id=68382

Something has regressed in the recording surface. All the recording
surface based backends lose the alpha from the paint_With_alpha.
2013-12-26 17:18:41 +10:30
Adrian Johnson
5cafaa7b3b pdf: fix rectangle stroke with non rectilinear pen 2013-12-26 15:28:29 +10:30
Adrian Johnson
acd78d721e Add test for rectangle path optimization with non rectilinear pen
This fails on pdf/ps.
2013-12-26 15:27:30 +10:30
Behdad Esfahbod
040a9f678b Check for XRenderSolidFill() 2013-12-16 19:27:38 -05:00
Adrian Johnson
dcbe16eb40 pdf/ps: avoid outputting excess decimal places in matrices
Sometimes as a result of rounding errors in matrix transformations the
matrices in ps/pdf output look like:

    0.000000000000000061 1 1 -0.000000000000000061 0 842 cm

This patch rounds to zero matrix elements that are very small compared to
other elements in the same matrix.
2013-12-07 15:54:49 +10:30
Uli Schlachter
31eff5c6eb Correct usage of CAIRO_STACK_ARRAY_LENGTH
This macro wants the array type as its argument and calls sizeof() on it
internally.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-11-16 19:05:35 +01:00
Henry Song
8c73949e44 gl: Fix one off issue in context cleanup
ctx->vertex_shaders is only CAIRO_GL_VAR_TYPE_MAX large, so we should
abort the loop before the index is equal to CAIRO_GL_VAR_TYPE_MAX.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2013-11-13 17:09:29 -08:00
Bryce Harrington
56a195a765 Fix SSIZE_T definition problem when making with MSYS on Windows7
Patch provided by Martin Schlemmer <Martin.Schlemmer@nwu.ac.za> on the
mailing list.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2013-10-31 20:34:15 -07:00
Kouhei Sutou
66f4140e73 cairo_create(): Add finished surface check
Without this change, the following program crashes:

    #include <cairo.h>
    #include <cairo-svg.h>

    int
    main(int argc, char **argv)
    {
      cairo_t *cr;
      cairo_surface_t *finished_surface;

      finished_surface = cairo_svg_surface_create ("/tmp/xxx.svg", 1.0, 1.0);
      cairo_surface_finish (finished_surface);

      cr = cairo_create (finished_surface);
      cairo_destroy (cr);

      cairo_surface_destroy (finished_surface);

      return 0;
    }

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2013-10-31 20:34:04 -07:00
egag
b9263fea14 Fixes stroke-clipped, i.c. of a dashed stroke
Similar to 1f4d05b55c
 'Fix calling '_cairo_spline_intersect' for in-bounds checking of splines'

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2013-10-31 20:33:33 -07:00
Søren Sandmann Pedersen
98fef3cef2 _cairo_color_double_to_short(): Use standard rounding algorithm
The _cairo_color_double_to_short() function converts a double
precision floating point value in the range of [0.0, 1.0] to a
uint16_t integer by dividing the [0.0, 1.0] range into 65536
equal-sized intervals and then associating each interval with an
integer.

Under the assumption that an integer i corresponds to the real value i
/ 65535.0 this algorithm introduces more error than necessary as can
be seen from the following picture showing the analogous
transformation for two-bit integers:

    +-----------+-----------+-----------+-----------+
   0b00         |  0b01     |      0b10 |          0b11
    +-----------+-----------+-----------+-----------+

which shows that some floating point values are not converted to the
integer that would minimize the error in value that that integer
corresponds to.

Instead, this patch uses standard rounding, which makes the diagram
look like this:

    +-------+---------------+---------------+-------+
   0b00     |      0b01     |      0b10     |      0b11
    +-------+---------------+---------------+-------+

It's clear that if the values corresponding to the given integers are
fixed, then it's not possible to decrease the resulting error by
moving any of the interval boundaries.

See this thread for more information:

    http://lists.freedesktop.org/archives/cairo/2013-October/024691.html

Reference images updated:

  pthread-similar.ref.png
  record-paint-alpha.ref.png
  record90-paint-alpha.argb32.ref
  record90-paint-alpha.rgb24.ref.png
  xcb-huge-image-shm.ref.png
  xcb-huge-subimage.ref.png

All of these have only one-step differences to the old images.
2013-10-22 14:27:43 -04:00
Adrian Johnson
6f05ecf488 type1-subset: don't rename glyphs used by seac operator
Bug 70364
2013-10-11 19:59:50 +10:30
Chris Wilson
f1eefee985 win32: Reorder font declarations to be in natural order
Reported-by: John Emmas <johne53@tiscali.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-06 09:57:44 +01:00
Uli Schlachter
49366c5e9e cairo-xlib: Fix out of bounds array access in format cache
The cairo-xlib backend maintains a mapping form cairo_format_t to xrender
formats. This is done via an array. The size of this array is
CAIRO_FORMAT_RGB16_565 + 1 which evaluates to 5.

However, CAIRO_FORMAT_RGB30 has the numeric value 5, too. Thus, using this value
as an index into the array would actually read the following force_precision
field from cairo_xlib_display_t.

This could be triggered by passing CAIRO_FORMAT_RGB30 to
_cairo_xlib_display_get_xrender_format(). From a quick look, I didn't find any
code which would allow doing this, but neither did I find anything allowing
CAIRO_FORMAT_RGB16_565, so it's better to handle this correctly than assert()ing
for this to never happen.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-03 17:53:34 +02:00
Uli Schlachter
217bed84dd Revert "[xlib] Fast-path the likely case of retrieving a known xrender_format"
This reverts commit 09a2b2ed31.

Back in 2009, _cairo_xlib_display_get_xrender_format() had to acquire a lock to
do its job. The above commit added a fast-path which avoided the lock in most
cases.

However, in 2010 commit f74ad37e66 modified the
locking in the cairo-xlib backend and now this function never takes any locks.

Thus, the fast-path that was added a year earlier now just does the same thing
that the regular code does and the list of cached formats was checked twice.
Reverting the earlier commit fixes this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-03 17:44:27 +02:00
Uli Schlachter
592e6a9803 README: Don't mention XFAIL_TESTS anymore
The variable XFAIL_TESTS is not used anymore since commit e90073f7dd.

Instead, we now have special reference images that show the wrong output and the
test suite fails a test if it does not match the expected, wrong output.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-03 16:59:11 +02:00
Uli Schlachter
bc89be2fff Remove XFAIL_TESTS from Makefile.am
The variable XFAIL_TESTS is not used anymore since commit e90073f7dd.

The description for the known failures are moved into the respective tests as
comments.

The following descriptions were dropped:

- surface-pattern-big: Didn't really explain the failure
- big-line: Test isn't failing any more
- self-intersecting: Only XFAIL on quartz, but description doesn't match this

The following tests don't have a xfail reference image and seem to fail just
because of not having a reference image at all (I kept their description for
now):

big-trap, long-lines, self-copy-overlap

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-03 16:58:52 +02:00
Adrian Johnson
5e6e453671 pdf: stencil masks may be opaque 2013-09-29 22:23:31 +09:30
Adrian Johnson
d3a8d5a9c2 pdf: Support stencil masks with jpeg/jpx/jbig2 embedding 2013-09-29 22:18:06 +09:30
Adrian Johnson
07940ecd60 pdf: combine source and mask images into single image
Since PDF stores the alpha component of images in a separate stream
which can have a different resolution and encoding to the color
components we can optimize the case where the source and mask are both images.

If the source and mask are both images with the same extents and the
source is opaque, combine the images into a single PDF image (ie the
source is written the the image stream and the mask is written to the
smask stream).
2013-09-29 13:08:02 +09:30
Chris Wilson
c1ac8db7e6 trace: Fix operand emission
Recent updates (in the past couple of years) to firefox have exposed
numerous bugs in the way we emit the operands. A few off-by-ones,
missing surfaces and outright bugs all of which are intermixed into
producing a corrupt stack.

Reported-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-27 16:37:24 +01:00
Uli Schlachter
0c2faf6621 fill_reduces_to_source(): Handle failure of color_to_pixel()
The function color_to_pixel() can fail for unsupported pixman image formats, but
fill_reduces_to_source() ignored this possibility.

Fix this by using the return value of color_to_pixel():

Fixes the following compiler warnings:

cairo-image-compositor.c: In function 'fill_boxes':
cairo-image-compositor.c:349:15: warning: 'pixel' may be used uninitialized in this function [-Wmaybe-uninitialized]
cairo-image-compositor.c: In function 'fill_rectangles':
cairo-image-compositor.c:304:18: warning: 'pixel' may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-27 15:42:24 +02:00
Bryce Harrington
38a925460b test: Drop unnecessary math.h include
Commit 0ac81988 refactored away fmin; nothing else from math.h is
needed.
2013-09-26 10:59:14 -07:00
Chris Wilson
337ab1f8d9 font: Push the last reference dec into the backend->destroy() callback
In order to close a race between locking the backend and resurrecting a
font via the cache, we need to keep the font face alive until after we
take the backend lock. Once we have that lock, we can drop our reference
and test if that was the last. Otherwise we must abort the destroy().

This fixes the double-free exposed by multithreaded applications trying
to create and destroy the same font concurrently.

Reported-by: Weeble <clockworksaint@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69470
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-17 16:37:47 +01:00