mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 06:28:01 +02:00
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@chris-wilson.co.uk>
This commit is contained in:
parent
6ad8c96fd8
commit
a3f97d1d2e
3 changed files with 30 additions and 14 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1385,6 +1385,27 @@ cairo_ps_surface_debug_set_creation_date (cairo_surface_t *abstract_surface,
|
|||
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
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue