README:  Update required dependencies
test : build fix when --enable-pdf=no

Though --enable-pdf=yes by default, when --enable-pdf=no, the cairo build
fails due to unavailability of cairo-pdf.h and related cairo pdf's apis.
The current changes fixes this issue by conditionally checking if PDF
surface is enabled or not.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Tested-by: Bryce Harrington <bryce@osg.samsung.com>
cairo-wideint:  Fix typo in two cairo_uint128 functions

_cairo_int128_negate and _cairo_int128_not are #defines of
_cairo_uint128_negate and _cairo_uint128_not respectively.  The function
implementations should use the actual function name not the aliases.  On
systems without a uint128 type, these could lead to build issues.

Credit for finding this go to Dr. Peter Barnes, LLNL.
configure.ac: Fix broken build for Qt backend

When --enable-qt is specified, the build will break due to missing
libstdc++:

  CCLD     cairo-test-suite
/usr/bin/ld: ../boilerplate/.libs/libcairoboilerplate.a(libcairoboilerplate_cxx_la-cairo-boilerplate-qt.o): undefined reference to symbol '__gxx_personality_v0@@CXXABI_1.3'
//usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

When using g++ to compile and link code, g++ automatically links
libstdc++.  However, in cairo we're using g++ only to compile, so need
to explicitly link against libstdc++ for backends that need iostream,
stl, or other stdc++ features.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=59038
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
configure.ac: Quell warnings about AM_PROG_AR when using automake 1.12

Without this, autogen.sh issues warnings like:

  /usr/share/automake-1.14/am/ltlibrary.am: warning: 'libcairoboilerplate_cxx.la': linking libtool libraries using a non-POSIX
  /usr/share/automake-1.14/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
  boilerplate/Makefile.am:18:   while processing Libtool library 'libcairoboilerplate_cxx.la'

AM_PROG_AR was introduced in automake 1.11.2.  As per the docs for
AM_PROG_AR, it is supposed to be included when the archiver ('ar') is
used, but prior to automake 1.12 the warning was only shown iff
-Wextra-portability was specified.  automake 1.12 introduced a change
that includes -Wextra-portability when -Wall is specified.

For further discussion of the issue, see:

  http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11401
  http://lists.gnu.org/archive/html/automake/2012-05/msg00014.html

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
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>
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>
doc: Drop a couple quartz routines which distcheck claims don't exist

These routines actually do exist in the source code, and have proper
documentation, so I'm not sure why distcheck dislikes them, but it's
happier without these listed.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.