[cairo-commit] 4 commits - boilerplate/cairo-boilerplate-pdf.c boilerplate/cairo-boilerplate-ps.c build/configure.ac.warnings src/cairo-pdf.h src/cairo-pdf-surface.c src/cairo-ps.h src/cairo-ps-surface.c
Chris Wilson
ickle at kemper.freedesktop.org
Sat Apr 14 06:49:59 PDT 2012
boilerplate/cairo-boilerplate-pdf.c | 19 ++++----------
boilerplate/cairo-boilerplate-ps.c | 40 +++++-------------------------
build/configure.ac.warnings | 13 +++++++++
src/cairo-pdf-surface.c | 21 +++++++++++++++
src/cairo-pdf.h | 5 +++
src/cairo-ps-surface.c | 48 ++++++++++++++++++++++++++++++++++++
src/cairo-ps.h | 10 +++++++
7 files changed, 109 insertions(+), 47 deletions(-)
New commits:
commit d486ea30f1a58640a1178de74f705a73845b1cda
Author: Marcus Meissner <meissner at suse.de>
Date: Sat Apr 14 14:47:02 2012 +0100
configure: Conditionally include -flto
As some systems fail to create working binaries with when linked with
lto, perform a check during configure.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=39114
diff --git a/build/configure.ac.warnings b/build/configure.ac.warnings
index 3b2c6f3..9b9c742 100644
--- a/build/configure.ac.warnings
+++ b/build/configure.ac.warnings
@@ -32,7 +32,18 @@ MAYBE_WARN="$MAYBE_WARN -erroff=E_ENUM_TYPE_MISMATCH_ARG \
dnl We also abuse the warning-flag facility to enable other compiler
dnl options. Namely, the following:
-MAYBE_WARN="$MAYBE_WARN -fno-strict-aliasing -fno-common -flto"
+
+dnl -flto working really needs a test link, not just a compile
+
+safe_MAYBE_WARN="$MAYBE_WARN"
+MAYBE_WARN="$MAYBE_WARN -flto"
+AC_TRY_LINK([],[
+ int main(int argc, char **argv) { return 0; }
+],[],[
+ MAYBE_WARN="$safe_MAYBE_WARN"
+])
+
+MAYBE_WARN="$MAYBE_WARN -fno-strict-aliasing -fno-common"
dnl Also to turn various gcc/glibc-specific preprocessor checks
MAYBE_WARN="$MAYBE_WARN -Wp,-D_FORTIFY_SOURCE=2"
commit 25abe582982caeb07d1e0af4acca53bb110a33bf
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Apr 12 10:51:38 2012 +0100
pdf (debug API): Export the ability to force fallbacks
We need to occasionally force fallbacks whilst testing the PDF
output, so export a debug interface to do so in order to avoid poking
around inside cairo internals.
References: https://bugs.freedesktop.org/show_bug.cgi?id=48577
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/boilerplate/cairo-boilerplate-pdf.c b/boilerplate/cairo-boilerplate-pdf.c
index d76d139..985540b 100644
--- a/boilerplate/cairo-boilerplate-pdf.c
+++ b/boilerplate/cairo-boilerplate-pdf.c
@@ -29,8 +29,6 @@
#if CAIRO_CAN_TEST_PDF_SURFACE
#include <cairo-pdf.h>
-#include <cairo-pdf-surface-private.h>
-#include <cairo-paginated-surface-private.h>
#if HAVE_SIGNAL_H
#include <signal.h>
@@ -221,23 +219,18 @@ _cairo_boilerplate_pdf_cleanup (void *closure)
}
static void
-_cairo_boilerplate_pdf_force_fallbacks (cairo_surface_t *abstract_surface,
+_cairo_boilerplate_pdf_force_fallbacks (cairo_surface_t *surface,
double x_pixels_per_inch,
double y_pixels_per_inch)
{
- pdf_target_closure_t *ptc = cairo_surface_get_user_data (abstract_surface,
- &pdf_closure_key);
-
- cairo_paginated_surface_t *paginated;
- cairo_pdf_surface_t *surface;
+ pdf_target_closure_t *ptc =
+ cairo_surface_get_user_data (surface, &pdf_closure_key);
if (ptc->target)
- abstract_surface = ptc->target;
+ surface = ptc->target;
- paginated = (cairo_paginated_surface_t*) abstract_surface;
- surface = (cairo_pdf_surface_t*) paginated->target;
- surface->force_fallbacks = TRUE;
- cairo_surface_set_fallback_resolution (&paginated->base,
+ cairo_pdf_surface_debug_force_fallbacks (surface);
+ cairo_surface_set_fallback_resolution (surface,
x_pixels_per_inch,
y_pixels_per_inch);
}
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 78537ce..15b7da5 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -683,6 +683,27 @@ cairo_pdf_surface_set_size (cairo_surface_t *surface,
status = _cairo_surface_set_error (surface, status);
}
+/**
+ * cairo_pdf_surface_debug_force_fallbacks:
+ * @surface: a PDF #cairo_surface_t
+ *
+ * This is purely a debugging interface, intended only to be used in
+ * conformation testing, to force the surface to contain only rasterised
+ * graphics and no native PDF drawing.
+ *
+ * Since: 1.12.2
+ **/
+void
+cairo_pdf_surface_debug_force_fallbacks (cairo_surface_t *abstract_surface)
+{
+ cairo_pdf_surface_t *surface = NULL;
+
+ if (! _extract_pdf_surface (abstract_surface, &surface))
+ return;
+
+ surface->force_fallbacks = TRUE;
+}
+
static void
_cairo_pdf_surface_clear (cairo_pdf_surface_t *surface)
{
diff --git a/src/cairo-pdf.h b/src/cairo-pdf.h
index 1bc8524..91ee3f1 100644
--- a/src/cairo-pdf.h
+++ b/src/cairo-pdf.h
@@ -85,6 +85,11 @@ cairo_pdf_surface_set_size (cairo_surface_t *surface,
double width_in_points,
double height_in_points);
+/* debug interface */
+
+cairo_public void
+cairo_pdf_surface_debug_force_fallbacks (cairo_surface_t *abstract_surface);
+
CAIRO_END_DECLS
#else /* CAIRO_HAS_PDF_SURFACE */
commit a3f97d1d2e77a0fee4ca03d5dc9968952a440561
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Apr 12 10:51:38 2012 +0100
ps (debug API): Export the ability to force fallbacks
We need to occasionally force fallbacks whilst testing the PostScript
output, so export a debug interface to do so in order to avoid poking
around inside cairo internals.
References: https://bugs.freedesktop.org/show_bug.cgi?id=48577
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/boilerplate/cairo-boilerplate-ps.c b/boilerplate/cairo-boilerplate-ps.c
index 938e40a..a4897fd 100644
--- a/boilerplate/cairo-boilerplate-ps.c
+++ b/boilerplate/cairo-boilerplate-ps.c
@@ -30,9 +30,6 @@
#include <cairo-ps.h>
-#include <cairo-ps-surface-private.h>
-#include <cairo-paginated-surface-private.h>
-
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
@@ -265,23 +262,18 @@ _cairo_boilerplate_ps_cleanup (void *closure)
}
static void
-_cairo_boilerplate_ps_force_fallbacks (cairo_surface_t *abstract_surface,
+_cairo_boilerplate_ps_force_fallbacks (cairo_surface_t *surface,
double x_pixels_per_inch,
double y_pixels_per_inch)
{
- ps_target_closure_t *ptc = cairo_surface_get_user_data (abstract_surface,
- &ps_closure_key);
-
- cairo_paginated_surface_t *paginated;
- cairo_ps_surface_t *surface;
+ ps_target_closure_t *ptc =
+ cairo_surface_get_user_data (surface, &ps_closure_key);
if (ptc->target)
- abstract_surface = ptc->target;
+ surface = ptc->target;
- paginated = (cairo_paginated_surface_t*) abstract_surface;
- surface = (cairo_ps_surface_t*) paginated->target;
- surface->force_fallbacks = TRUE;
- cairo_surface_set_fallback_resolution (&paginated->base,
+ cairo_ps_surface_debug_force_fallbacks (surface);
+ cairo_surface_set_fallback_resolution (surface,
x_pixels_per_inch,
y_pixels_per_inch);
}
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index d20d541..867bec3 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1386,6 +1386,27 @@ cairo_ps_surface_debug_set_creation_date (cairo_surface_t *abstract_surface,
}
/**
+ * cairo_ps_surface_debug_force_fallbacks:
+ * @surface: a PostScript #cairo_surface_t
+ *
+ * This is purely a debugging interface, intended only to be used in
+ * conformation testing, to force the surface to contain only rasterised
+ * graphics and no native PostScript drawing.
+ *
+ * Since: 1.12.2
+ **/
+void
+cairo_ps_surface_debug_force_fallbacks (cairo_surface_t *abstract_surface)
+{
+ cairo_ps_surface_t *surface = NULL;
+
+ if (! _extract_ps_surface (abstract_surface, TRUE, &surface))
+ return;
+
+ surface->force_fallbacks = TRUE;
+}
+
+/**
* cairo_ps_surface_dsc_comment:
* @surface: a PostScript #cairo_surface_t
* @comment: a comment string to be emitted into the PostScript output
diff --git a/src/cairo-ps.h b/src/cairo-ps.h
index ab0bb26..ca40e19 100644
--- a/src/cairo-ps.h
+++ b/src/cairo-ps.h
@@ -114,6 +114,9 @@ cairo_public void
cairo_ps_surface_debug_set_creation_date (cairo_surface_t *abstract_surface,
time_t date);
+cairo_public void
+cairo_ps_surface_debug_force_fallbacks (cairo_surface_t *abstract_surface);
+
CAIRO_END_DECLS
#else /* CAIRO_HAS_PS_SURFACE */
commit 6ad8c96fd81e06cea6ada4a83e7c5614f150f914
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Apr 12 10:51:38 2012 +0100
ps (API): Export the ability to set the creation date of the surface
A PostScript surface embeds a CreationDate comment into its document
description pre-amble. Normally this is set to the time the surface is
written out, except we set this to a constant value in the boilerplate
for the purposes of mimicking a reference file. It may also be useful
for external applications, so make it a public export.
References: https://bugs.freedesktop.org/show_bug.cgi?id=48577
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/boilerplate/cairo-boilerplate-ps.c b/boilerplate/cairo-boilerplate-ps.c
index ae61239..938e40a 100644
--- a/boilerplate/cairo-boilerplate-ps.c
+++ b/boilerplate/cairo-boilerplate-ps.c
@@ -55,24 +55,6 @@ typedef struct _ps_target_closure {
cairo_ps_level_t level;
} ps_target_closure_t;
-static cairo_status_t
-_cairo_boilerplate_ps_surface_set_creation_date (cairo_surface_t *abstract_surface,
- time_t date)
-{
- cairo_paginated_surface_t *paginated = (cairo_paginated_surface_t*) abstract_surface;
- cairo_ps_surface_t *surface;
-
- if (cairo_surface_get_type (abstract_surface) != CAIRO_SURFACE_TYPE_PS)
- return CAIRO_STATUS_SURFACE_TYPE_MISMATCH;
-
- surface = (cairo_ps_surface_t*) paginated->target;
-
- surface->has_creation_date = TRUE;
- surface->creation_date = date;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
static cairo_surface_t *
_cairo_boilerplate_ps_create_surface (const char *name,
cairo_content_t content,
@@ -106,7 +88,7 @@ _cairo_boilerplate_ps_create_surface (const char *name,
goto CLEANUP_FILENAME;
cairo_ps_surface_restrict_to_level (surface, level);
- _cairo_boilerplate_ps_surface_set_creation_date (surface, 0);
+ cairo_ps_surface_debug_set_creation_date (surface, 0);
cairo_surface_set_fallback_resolution (surface, 72., 72.);
if (content == CAIRO_CONTENT_COLOR) {
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index c5ea680..d20d541 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1359,6 +1359,33 @@ cairo_ps_surface_set_size (cairo_surface_t *surface,
}
/**
+ * cairo_ps_surface_debug_set_creation_data:
+ * @surface: a PostScript #cairo_surface_t
+ * @date: A time_t
+ *
+ * Changes the embedded creation date of a PostScript surface.
+ *
+ * This function is only intended to be used by conformance test suites which
+ * require complete control over embedded strings.
+ *
+ * This function can be called at any point before the surface is finished,
+ *
+ * Since: 1.12.2
+ **/
+void
+cairo_ps_surface_debug_set_creation_date (cairo_surface_t *abstract_surface,
+ time_t date)
+{
+ cairo_ps_surface_t *surface = NULL;
+
+ if (! _extract_ps_surface (abstract_surface, TRUE, &surface))
+ return;
+
+ surface->has_creation_date = TRUE;
+ surface->creation_date = date;
+}
+
+/**
* cairo_ps_surface_dsc_comment:
* @surface: a PostScript #cairo_surface_t
* @comment: a comment string to be emitted into the PostScript output
diff --git a/src/cairo-ps.h b/src/cairo-ps.h
index 33d0e0d..ab0bb26 100644
--- a/src/cairo-ps.h
+++ b/src/cairo-ps.h
@@ -42,6 +42,7 @@
#if CAIRO_HAS_PS_SURFACE
#include <stdio.h>
+#include <time.h>
CAIRO_BEGIN_DECLS
@@ -107,6 +108,12 @@ cairo_ps_surface_dsc_begin_setup (cairo_surface_t *surface);
cairo_public void
cairo_ps_surface_dsc_begin_page_setup (cairo_surface_t *surface);
+/* debug interface */
+
+cairo_public void
+cairo_ps_surface_debug_set_creation_date (cairo_surface_t *abstract_surface,
+ time_t date);
+
CAIRO_END_DECLS
#else /* CAIRO_HAS_PS_SURFACE */
More information about the cairo-commit
mailing list