[gs-commits] ghostpdl branch, pdfi, updated. jbig2dec-0.14-2320-gba1bb93
[email protected] (Nancy Durgin) Tue, 1 Oct 2019 18:19:16 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, pdfi has been updated
via ba1bb9302c4304b2914f179592cc02c324bf9538 (commit)
via 5dec603ea73bec0b6be8e921ed592395b4bfe4cf (commit)
from 9f62f2331fb72777aa980c1fd2abbef39c05aa61 (commit)
----------------------------------------------------------------------
commit ba1bb9302c4304b2914f179592cc02c324bf9538
Author: Nancy Durgin <[email protected]>
Date: Tue Oct 1 09:56:13 2019 -0700
Use /Processed key to track whether smask is processed
Following the ps code, this key is put into the actual SMask dictionary.
Seems hacky, but putting it in the pdfi_int_gstate separately doesn't do
the right thing on gsave/grestore.
I didn't expect this to have any effect, but it actually causes some
progressions (see tests_private/comparefiles/Bug693115.pdf).
diff --git a/pdf/pdf_trans.c b/pdf/pdf_trans.c
index f712e6a..706d043 100644
--- a/pdf/pdf_trans.c
+++ b/pdf/pdf_trans.c
@@ -48,9 +48,30 @@ static int pdfi_trans_set_mask(pdf_context *ctx, pdfi_int_gstate *igs, int color
double f;
gs_matrix save_matrix, GroupMat, group_Matrix;
gs_transparency_mask_subtype_t subtype = TRANSPARENCY_MASK_Luminosity;
+ pdf_bool *Processed = NULL;
+ pdf_obj *Key = NULL;
dbgmprintf(ctx->memory, "pdfi_trans_set_mask (.execmaskgroup) BEGIN\n");
+ /* Following the logic of the ps code, cram a /Processed key in the SMask dict to
+ * track whether it's already been processed.
+ */
+ code = pdfi_dict_knownget_type(ctx, SMask, "Processed", PDF_BOOL, (pdf_obj **)&Processed);
+ if (code > 0 && Processed->value) {
+ dbgmprintf(ctx->memory, "SMask already built, skipping\n");
+ goto exit;
+ }
+ /* If /Processed not in the dict, put it there */
+ if (code == 0) {
+ code = pdfi_alloc_object(ctx, PDF_BOOL, 0, (pdf_obj **)&Processed);
+ if (code < 0)
+ goto exit;
+ Processed->value = false;
+ pdfi_countup(Processed);
+ code = pdfi_make_name(ctx, (byte *)"Processed", strlen("Processed"), &Key);
+ code = pdfi_dict_put(SMask, Key, (pdf_obj *)Processed);
+ }
+
/* See pdf1.7 pg 553 (pain in the butt to find this!) */
code = pdfi_dict_knownget_type(ctx, SMask, "Type", PDF_NAME, (pdf_obj **)&n);
if (code == 0 || (code > 0 && pdfi_name_is(n, "Mask"))) {
@@ -176,12 +197,15 @@ static int pdfi_trans_set_mask(pdf_context *ctx, pdfi_int_gstate *igs, int color
code = gs_begin_transparency_mask(ctx->pgs, ¶ms, &bbox, true);
if (code < 0)
goto exit;
+
/* TODO: Error handling... */
code = pdfi_form_execgroup(ctx, ctx->CurrentPageDict, G_dict, igs->GroupGState);
code = gs_end_transparency_mask(ctx->pgs, colorindex);
/* Put back the matrix (we couldn't just rely on gsave/grestore for whatever reason,
* according to PS code anyway...
*/
+ if (Processed)
+ Processed->value = true;
gs_setmatrix(ctx->pgs, &save_matrix);
} else {
/* take action on a non-/Mask entry. What does this mean ? What do we need to do */
@@ -200,6 +224,8 @@ static int pdfi_trans_set_mask(pdf_context *ctx, pdfi_int_gstate *igs, int color
pdfi_countdown(BBox);
pdfi_countdown(Matrix);
pdfi_countdown(CS);
+ pdfi_countdown(Processed);
+ pdfi_countdown(Key);
dbgmprintf(ctx->memory, "pdfi_trans_set_mask (.execmaskgroup) END\n");
return code;
}
----------------------------------------------------------------------
commit 5dec603ea73bec0b6be8e921ed592395b4bfe4cf
Author: Nancy Durgin <[email protected]>
Date: Tue Oct 1 08:53:03 2019 -0700
Set transparency params before building shading
This can cause the smask to be built twice, but it seems necessary.
Change is coming to avoid building same mask multiple times.
diff --git a/pdf/pdf_shading.c b/pdf/pdf_shading.c
index 3ce5c4c..6216203 100644
--- a/pdf/pdf_shading.c
+++ b/pdf/pdf_shading.c
@@ -775,6 +775,10 @@ int pdfi_shading(pdf_context *ctx, pdf_dict *stream_dict, pdf_dict *page_dict)
goto exit2;
}
+ code = pdfi_trans_set_params(ctx, gs_getfillconstantalpha(ctx->pgs));
+ if (code < 0)
+ goto exit2;
+
code = pdfi_shading_build(ctx, stream_dict, page_dict, Shading, &psh);
if (code < 0)
goto exit2;
Summary of changes:
pdf/pdf_shading.c | 4 ++++
pdf/pdf_trans.c | 26 ++++++++++++++++++++++++++
2 files changed, 30 insertions(+)