Commit graph

7112 commits

Author SHA1 Message Date
Ravi Nanjundappa
f574fec8d2 src : Fix warn_unused_result warnings from gcc
Fix 'unused-result' warning messages by
- replacing cairo_private to cairo_private_no_warn in the
  declaration of the cairo private apis '_cairo_surface_unmap_image',
  '_cairo_polygon_add_line', '_cairo_polygon_add_external_edge' and
  '_cairo_polygon_add_contour'
- removing cairo_warn for 'render_rows' member function pointer in
  'struct _cairo_span_renderer'

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
2014-06-05 16:12:30 -07:00
Uli Schlachter
3d94269bd4 Revert "image: Use convolution filters for sample reconstruction when downscaling"
This reverts commit fb57ea13e0.

When running cairo-test-suite with the parameter "-a", it also runs each test
with a non-zero device-offset and device-scaling. The above commit influenced
the device-scaling results badly. E.g. some test results ended up with a black
border at the top-most and left-most row that looked like there was an offset of
"0.5" in drawing the image and thus pixels outside of the image were sampled.

This can be seen by the influence that this revert has on the results from
running CAIRO_TEST_TARGET=image ./cairo-test-suite -a:

Before: 31 Passed, 489 Failed [1 crashed, 8 expected], 31 Skipped
After: 225 Passed, 295 Failed [1 crashed, 8 expected], 31 Skipped

Most of the failures that disappeared are from the device-scaling tests.

With such disastrous results on the test suite, this cannot really be usable for
real-world applications.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-06-05 13:16:24 -07:00
jimmyfrasche
2d89cbb30e Add more info to cairo_surface_set_mime_data docs.
Explains how to use cairo_surface_set_mime_data so that the image always
gets used even if the MIME data cannot be.

Signed-off-by: jimmyfrasche <soapboxcicero@gmail.com>
2014-06-05 13:14:11 -07:00
Sylvestre Ledru
247cfaaa25 Fix some memory leaks found by scan-build, the LLVM/Clang static analyzer
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
2014-05-16 11:11:34 -07:00
Sylvestre Ledru
5e7b724dd3 Remove some potential double free
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
2014-05-16 11:11:30 -07:00
jimmyfrasche
85b05e84ac Pattern document clarification
Replaces documentation of the form "range 0 to 1 less than the number"
with "ranges from 0 to n-1 where n is the number", which is idiomatic
mathematical writing and less ambiguous.

Signed-off-by: jimmyfrasche <soapboxcicero@gmail.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-05-12 10:19:33 -07:00
Bryce Harrington
18b3cce2f5 Fix segfault in firefox when scrolling on certain pages
Bug discovered by thorsten <fly_a320@gmx.de>

Patch from Chris Wilson <chris@chris-wilson.co.uk>
2014-05-06 10:18:19 -07:00
Sylvestre Ledru
da9ef97372 Remove some useless declarations found by scan-build, the LLVM/clang static analyzer
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-05-06 10:14:53 -07:00
Uli Schlachter
bb17403622 mesh-rasterize: Fix number of iterations
Commit 44a09f462c fixed a compiler warning, but changed the result of this code.
This is because the old 'for' loop did one more iteration than the new 'while'
loop. Fix this by incrementing the loop counter once before the loop.

Fixes: mesh-pattern mesh-pattern-accuracy mesh-pattern-conical
mesh-pattern-control-points mesh-pattern-fold mesh-pattern-overlap
mesh-pattern-transformed record-mesh

Signed-off-by: Uli Schlachter <psychon@znc.in>
Tested-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-21 14:10:19 +01:00
Uli Schlachter
372c8c314a mask compositor: Set a check_composite method
Commit 503b6b9e2e added a check_composite method to the mask compositor, but
only added it to one of the existing implementations. This commit fixes that.

In cairo-image-compositor.c, there is already a check_composite method which
just returns success for the traps compositor. This commit makes the mask
compositor use that one.

I don't want to say much about cairo-image-mask-compositor.c except that I
wondered why this file and the file above both define a non-static function
called _cairo_image_mask_compositor_get(). In my opinion, that file should just
be deleted, since it confuses e.g. ctags, but I'll let someone else clean this
up.

Fixes 493 crashes in the test suite for the test-mask target.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Tested-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-21 14:09:37 +01:00
Uli Schlachter
bc05dbccd7 Fix warnings from check-doc-syntax.sh
$ ./check-doc-syntax.sh
Checking documentation for incorrect syntax
./cairo-types-private.h (148): WARNING: cairo_hash_entry_t: missing 'Since' field (is it a private type?)
./cairo-types-private.h (161): WARNING: cairo_hash_entry_t: not found
./cairo-types-private.h (175): WARNING: cairo_lcd_filter_t: missing 'Since' field (is it a private type?)
./cairo-cache-private.h (85): WARNING: cairo_cache_entry_t: missing 'Since' field (is it a private type?)
./cairo-region.c (857): WARNING: cairo_region_overlap_t: not found
./cairo-raster-source-pattern.c (62): WARNING: SECTION:cairo-raster-source 'Since' field in non-public element

The warnings about missing 'Since' fields are fixed by changing the
documentation comment so that the script can see that these are private types.

The documentation for cairo_region_overlap_t gets moved to cairo.h, just like
e.g. the documentation for cairo_status_t.

The 'Since' field from the SECTION:cairo-raster-source is removed, because this
kind of field is needed on the individual functions and structs, not on the
section.

Thanks to Bryce Harrington for bringing this up!

Signed-off-by: Uli Schlachter <psychon@znc.in>
Tested-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-13 17:12:43 -07:00
Bryce Harrington
0c18991053 skia: Add section definitions and code docs for skia backend
This fixes several distcheck errors regarding missing code docs.

The skia backend was added in commit d7faec02, which was included in the
1.10 release.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-13 17:12:37 -07:00
Bryce Harrington
8d0abb4a94 surface: Make parameter naming consistent between header and impl
This fixes this set of distcheck errors generating docs:

  src/cairo-surface.c:1668: warning: Parameter described in source code
  comment block but does not exist. FUNCTION:
  cairo_surface_set_device_scale Parameter: sx.

  src/cairo-surface.c:1668: warning: Parameter described in source code
  comment block but does not exist. FUNCTION:
  cairo_surface_set_device_scale Parameter: sy.

  src/cairo-surface.c:1668: warning: Parameter description for
  cairo_surface_set_device_scale::x_scale is missing in source code
  comment block.

  src/cairo-surface.c:1668: warning: Parameter description for
  cairo_surface_set_device_scale::y_scale is missing in source code
  comment block.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-13 15:13:34 -07:00
Bryce Harrington
4450af4f03 Mark recently added _cairo_output_stream_print_matrix private symbol
This fixes a distcheck error about a local PLT entry.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-13 15:13:04 -07:00
Bryce Harrington
f4a1a75078 doc: Add missing sections and symbols for public docs
This adds a number of items to the documentation for which code docs
exist, and also adds sections for cairo-skia and cairo-surface-observer.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48784

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-13 15:12:50 -07:00
Uli Schlachter
ed175b2a2b clip: Fix handling of special all-clipped cairo_clip_t
_cairo_clip_intersect_box() wasn't checking if it was called with the special,
read-only all-clipped clip and thus could have ended up writing to read-only
memory.

References: https://bugs.freedesktop.org/show_bug.cgi?id=75819
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-06 09:51:56 +01:00
Chris Wilson
3b261bea7d clip: Do not modify the special all-clipped cairo_clip_t
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75819
2014-03-06 08:35:20 +00:00
Behdad Esfahbod
f88bd92e8b Revert "[ft] Fix memory bug in copying bitmaps"
This reverts commit a0f556f37f.

The change was clearly wrong now that I read.  I was probably
tricked by what was fixed in the follow-up commit
e738079302.
2014-03-05 01:13:59 -08:00
Koji Egashira
5c9fdcb4aa image: Add NULL checks for return value of _pixman_image_for_color()
This fixes crash in pixman_image_composite32().

Originally fixed by Yoshitaro Makise.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-03-03 17:21:37 -08:00
Benjamin Otte
6a03ae5859 xlib: Fix typo in documentation 2014-03-03 01:16:25 +01:00
Bryce Harrington
f1709c298c Correct spelling of "tessellator" throughout code
Based on patch suggested by Homer Hsing

Bugzilla:  https://bugs.freedesktop.org/show_bug.cgi?id=50411
2014-02-26 18:55:25 -08:00
Bryce Harrington
273210683f Add comment to explain _cairo_edge_compute_intersection_*
Patch by Homer Hsing

Bugzilla:  https://bugs.freedesktop.org/show_bug.cgi?id=50412
2014-02-26 18:44:46 -08:00
Bryce Harrington
e555dfc717 Add explanation to _cairo_surface_create_in_error
Patch by Homer Hsing

Bugzilla:  https://bugs.freedesktop.org/show_bug.cgi?id=50413
2014-02-26 18:42:41 -08:00
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
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
Behdad Esfahbod
5de25951a4 Preserve current-point in copy_path()/append_path() sequence
Fixes path-currentpoint test.
2014-01-27 17:34:00 -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
5cafaa7b3b pdf: fix rectangle stroke with non rectilinear pen 2013-12-26 15:28:29 +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
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