mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-21 02:30:47 +01:00
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@chris-wilson.co.uk>
This commit is contained in:
parent
a3f97d1d2e
commit
25abe58298
3 changed files with 32 additions and 13 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue