summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'pdf/pdf_path.c')
-rw-r--r--pdf/pdf_path.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/pdf/pdf_path.c b/pdf/pdf_path.c
index ef6f1328..a9724def 100644
--- a/pdf/pdf_path.c
+++ b/pdf/pdf_path.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018-2021 Artifex Software, Inc.
+/* Copyright (C) 2018-2022 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -16,6 +16,7 @@
/* Path operations for the PDF interpreter */
#include "pdf_int.h"
+#include "pdf_font_types.h"
#include "pdf_gstate.h"
#include "pdf_path.h"
#include "pdf_stack.h"
@@ -120,22 +121,28 @@ static int pdfi_fill_inner(pdf_context *ctx, bool use_eofill)
if (pdfi_oc_is_off(ctx))
goto exit;
- code = pdfi_gsave(ctx);
- if (code < 0) goto exit;
-
code = pdfi_trans_setup(ctx, &state, NULL, TRANSPARENCY_Caller_Fill);
if (code == 0) {
+ /* If we don't gsave/grestore round the fill, then the file
+ * /tests_private/pdf/sumatra/954_-_dashed_lines_hardly_visible.pdf renders
+ * incorrectly. However we must not gsave/grestore round the trans_setup
+ * trans_teardown, because that might set pgs->soft_mask_id and if we restore
+ * back to a point where that is not set then pdfwrite doesn't work properly.
+ */
+ code = pdfi_gsave(ctx);
+ if (code < 0) goto exit;
+
if (use_eofill)
code = gs_eofill(ctx->pgs);
else
code = gs_fill(ctx->pgs);
+ code1 = pdfi_grestore(ctx);
+ if (code == 0) code = code1;
+
code1 = pdfi_trans_teardown(ctx, &state);
if (code == 0) code = code1;
}
- code1 = pdfi_grestore(ctx);
- if (code == 0) code = code1;
-
exit:
code1 = pdfi_newpath(ctx);
if (code == 0) code = code1;
@@ -164,20 +171,27 @@ int pdfi_stroke(pdf_context *ctx)
if (pdfi_oc_is_off(ctx))
goto exit;
- code = pdfi_gsave(ctx);
- if (code < 0) goto exit;
+/* code = pdfi_gsave(ctx);
+ if (code < 0) goto exit;*/
gs_swapcolors_quick(ctx->pgs);
code = pdfi_trans_setup(ctx, &state, NULL, TRANSPARENCY_Caller_Stroke);
if (code == 0) {
+ code = pdfi_gsave(ctx);
+ if (code < 0) goto exit;
+
code = gs_stroke(ctx->pgs);
+
+ code1 = pdfi_grestore(ctx);
+ if (code == 0) code = code1;
+
code1 = pdfi_trans_teardown(ctx, &state);
if (code == 0) code = code1;
}
gs_swapcolors_quick(ctx->pgs);
- code1 = pdfi_grestore(ctx);
- if (code == 0) code = code1;
+/* code1 = pdfi_grestore(ctx);
+ if (code == 0) code = code1;*/
exit:
code1 = pdfi_newpath(ctx);
@@ -378,22 +392,23 @@ static int pdfi_B_inner(pdf_context *ctx, bool use_eofill)
if (pdfi_oc_is_off(ctx))
goto exit;
- code = pdfi_gsave(ctx);
- if (code < 0) goto exit;
-
code = pdfi_trans_setup(ctx, &state, NULL, TRANSPARENCY_Caller_FillStroke);
if (code == 0) {
+ code = pdfi_gsave(ctx);
+ if (code < 0) goto exit;
+
if (use_eofill)
code = gs_eofillstroke(ctx->pgs, &code1);
else
code = gs_fillstroke(ctx->pgs, &code1);
+
+ code1 = pdfi_grestore(ctx);
+ if (code == 0) code = code1;
+
code1 = pdfi_trans_teardown(ctx, &state);
if (code >= 0) code = code1;
}
- code1 = pdfi_grestore(ctx);
- if (code == 0) code = code1;
-
exit:
code1 = pdfi_newpath(ctx);
if (code == 0) code = code1;