30
30
31
31
#include <cairo-ps.h>
32
32
33
+ #include <cairo-ps-surface-private.h>
34
+ #include <cairo-paginated-surface-private.h>
35
+
33
36
#if HAVE_SIGNAL_H
34
37
#include <signal.h>
35
38
#endif
@@ -52,6 +55,24 @@ typedef struct _ps_target_closure {
52
55
cairo_ps_level_t level ;
53
56
} ps_target_closure_t ;
54
57
58
+ static cairo_status_t
59
+ _cairo_boilerplate_ps_surface_set_creation_date (cairo_surface_t * abstract_surface ,
60
+ time_t date )
61
+ {
62
+ cairo_paginated_surface_t * paginated = (cairo_paginated_surface_t * ) abstract_surface ;
63
+ cairo_ps_surface_t * surface ;
64
+
65
+ if (cairo_surface_get_type (abstract_surface ) != CAIRO_SURFACE_TYPE_PS )
66
+ return CAIRO_STATUS_SURFACE_TYPE_MISMATCH ;
67
+
68
+ surface = (cairo_ps_surface_t * ) paginated -> target ;
69
+
70
+ surface -> has_creation_date = TRUE;
71
+ surface -> creation_date = date ;
72
+
73
+ return CAIRO_STATUS_SUCCESS ;
74
+ }
75
+
55
76
static cairo_surface_t *
56
77
_cairo_boilerplate_ps_create_surface (const char * name ,
57
78
cairo_content_t content ,
@@ -85,7 +106,7 @@ _cairo_boilerplate_ps_create_surface (const char *name,
85
106
goto CLEANUP_FILENAME ;
86
107
87
108
cairo_ps_surface_restrict_to_level (surface , level );
88
- cairo_ps_surface_debug_set_creation_date (surface , 0 );
109
+ _cairo_boilerplate_ps_surface_set_creation_date (surface , 0 );
89
110
cairo_surface_set_fallback_resolution (surface , 72. , 72. );
90
111
91
112
if (content == CAIRO_CONTENT_COLOR ) {
@@ -262,18 +283,23 @@ _cairo_boilerplate_ps_cleanup (void *closure)
262
283
}
263
284
264
285
static void
265
- _cairo_boilerplate_ps_force_fallbacks (cairo_surface_t * surface ,
286
+ _cairo_boilerplate_ps_force_fallbacks (cairo_surface_t * abstract_surface ,
266
287
double x_pixels_per_inch ,
267
288
double y_pixels_per_inch )
268
289
{
269
- ps_target_closure_t * ptc =
270
- cairo_surface_get_user_data (surface , & ps_closure_key );
290
+ ps_target_closure_t * ptc = cairo_surface_get_user_data (abstract_surface ,
291
+ & ps_closure_key );
292
+
293
+ cairo_paginated_surface_t * paginated ;
294
+ cairo_ps_surface_t * surface ;
271
295
272
296
if (ptc -> target )
273
- surface = ptc -> target ;
297
+ abstract_surface = ptc -> target ;
274
298
275
- cairo_ps_surface_debug_force_fallbacks (surface );
276
- cairo_surface_set_fallback_resolution (surface ,
299
+ paginated = (cairo_paginated_surface_t * ) abstract_surface ;
300
+ surface = (cairo_ps_surface_t * ) paginated -> target ;
301
+ surface -> force_fallbacks = TRUE;
302
+ cairo_surface_set_fallback_resolution (& paginated -> base ,
277
303
x_pixels_per_inch ,
278
304
y_pixels_per_inch );
279
305
}
0 commit comments