summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2011-12-09 23:52:00 +1030
committerAdrian Johnson <ajohnson@redneon.com>2011-12-10 00:39:29 +1030
commitc7ea92907a7eaaf62136755d0b6c60da913d1057 (patch)
tree7af6daf93e276ee19414632d6e5d6d93adb11a81
parentf446e57f350190f3ecc4758fe5cc2c6e949ff7b9 (diff)
ps: simplify the EPS save and restore
userdict is not permitted in EPS files. Since the PS surface does not leave extra operators or dictionaries on the stack the EPS prolog and trailer can be reduced to: save 50 dict begin .... end restore The save/restore pair is required to remove fonts and restore the graphics state. As "restore" does not restore the dictionary stack, using a new current dictionary for the EPS file allows the cairo dict entries to be cleaned up at the end the EPS. Bug 43634
-rw-r--r--src/cairo-ps-surface.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index f206adcf..9dfd9d0e 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -268,10 +268,8 @@ _cairo_ps_surface_emit_header (cairo_ps_surface_t *surface)
if (surface->eps) {
_cairo_output_stream_printf (surface->final_stream,
- "/cairo_eps_state save def\n"
- "/dict_count countdictstack def\n"
- "/op_count count 1 sub def\n"
- "userdict begin\n");
+ "save\n"
+ "50 dict begin\n");
} else {
_cairo_output_stream_printf (surface->final_stream,
"/languagelevel where\n"
@@ -807,9 +805,7 @@ _cairo_ps_surface_emit_footer (cairo_ps_surface_t *surface)
if (surface->eps) {
_cairo_output_stream_printf (surface->final_stream,
- "count op_count sub {pop} repeat\n"
- "countdictstack dict_count sub {end} repeat\n"
- "cairo_eps_state restore\n");
+ "end restore\n");
}
_cairo_output_stream_printf (surface->final_stream,