[cairo-commit] boilerplate/cairo-boilerplate-pdf.c boilerplate/cairo-boilerplate-ps.c 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:54:22 PDT 2012
boilerplate/cairo-boilerplate-pdf.c | 19 +++++++++-----
boilerplate/cairo-boilerplate-ps.c | 40 ++++++++++++++++++++++++------
src/cairo-pdf-surface.c | 21 ---------------
src/cairo-pdf.h | 5 ---
src/cairo-ps-surface.c | 48 ------------------------------------
src/cairo-ps.h | 10 -------
6 files changed, 46 insertions(+), 97 deletions(-)
New commits:
commit 93d42e82a43a0e2f531331b127ec82d8a3b6eded
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sat Apr 14 14:52:42 2012 +0100
Revert accidental push of ps debugging API.
This reverts commits
6ad8c96fd81e06cea6ada4a83e7c5614f150f914,
a3f97d1d2e77a0fee4ca03d5dc9968952a440561,
25abe582982caeb07d1e0af4acca53bb110a33bf
I should know better by now than to push without checking for outstanding
changes.
diff --git a/boilerplate/cairo-boilerplate-pdf.c b/boilerplate/cairo-boilerplate-pdf.c
index 985540b..d76d139 100644
--- a/boilerplate/cairo-boilerplate-pdf.c
+++ b/boilerplate/cairo-boilerplate-pdf.c
@@ -29,6 +29,8 @@
#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>
@@ -219,18 +221,23 @@ _cairo_boilerplate_pdf_cleanup (void *closure)
}
static void
-_cairo_boilerplate_pdf_force_fallbacks (cairo_surface_t *surface,
+_cairo_boilerplate_pdf_force_fallbacks (cairo_surface_t *abstract_surface,
double x_pixels_per_inch,
double y_pixels_per_inch)
{
- pdf_target_closure_t *ptc =
- cairo_surface_get_user_data (surface, &pdf_closure_key);
+ 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;
if (ptc->target)
- surface = ptc->target;
+ abstract_surface = ptc->target;
- cairo_pdf_surface_debug_force_fallbacks (surface);
- cairo_surface_set_fallback_resolution (surface,
+ 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,
x_pixels_per_inch,
y_pixels_per_inch);
}
diff --git a/boilerplate/cairo-boilerplate-ps.c b/boilerplate/cairo-boilerplate-ps.c
index a4897fd..ae61239 100644
--- a/boilerplate/cairo-boilerplate-ps.c
+++ b/boilerplate/cairo-boilerplate-ps.c
@@ -30,6 +30,9 @@
#include <cairo-ps.h>
+#include <cairo-ps-surface-private.h>
+#include <cairo-paginated-surface-private.h>
+
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
@@ -52,6 +55,24 @@ 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,
@@ -85,7 +106,7 @@ _cairo_boilerplate_ps_create_surface (const char *name,
goto CLEANUP_FILENAME;
cairo_ps_surface_restrict_to_level (surface, level);
- cairo_ps_surface_debug_set_creation_date (surface, 0);
+ _cairo_boilerplate_ps_surface_set_creation_date (surface, 0);
cairo_surface_set_fallback_resolution (surface, 72., 72.);
if (content == CAIRO_CONTENT_COLOR) {
@@ -262,18 +283,23 @@ _cairo_boilerplate_ps_cleanup (void *closure)
}
static void
-_cairo_boilerplate_ps_force_fallbacks (cairo_surface_t *surface,
+_cairo_boilerplate_ps_force_fallbacks (cairo_surface_t *abstract_surface,
double x_pixels_per_inch,
double y_pixels_per_inch)
{
- ps_target_closure_t *ptc =
- cairo_surface_get_user_data (surface, &ps_closure_key);
+ 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;
if (ptc->target)
- surface = ptc->target;
+ abstract_surface = ptc->target;
- cairo_ps_surface_debug_force_fallbacks (surface);
- cairo_surface_set_fallback_resolution (surface,
+ 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,
x_pixels_per_inch,
y_pixels_per_inch);
}
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 15b7da5..78537ce 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -683,27 +683,6 @@ 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 91ee3f1..1bc8524 100644
--- a/src/cairo-pdf.h
+++ b/src/cairo-pdf.h
@@ -85,11 +85,6 @@ 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 */
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 867bec3..c5ea680 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1359,54 +1359,6 @@ 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_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 ca40e19..33d0e0d 100644
--- a/src/cairo-ps.h
+++ b/src/cairo-ps.h
@@ -42,7 +42,6 @@
#if CAIRO_HAS_PS_SURFACE
#include <stdio.h>
-#include <time.h>
CAIRO_BEGIN_DECLS
@@ -108,15 +107,6 @@ 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_public void
-cairo_ps_surface_debug_force_fallbacks (cairo_surface_t *abstract_surface);
-
CAIRO_END_DECLS
#else /* CAIRO_HAS_PS_SURFACE */
More information about the cairo-commit
mailing list