[gs-commits] ghostpdl branch, pdfi, updated. jbig2dec-0.14-2322-g07dee17
[email protected] (Nancy Durgin) Wed, 2 Oct 2019 16:17:33 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, pdfi has been updated
via 07dee17077539c223b589f86899828881bb7801b (commit)
via 62d98a4d470d570ae40be012b410869e1b929398 (commit)
from ba1bb9302c4304b2914f179592cc02c324bf9538 (commit)
----------------------------------------------------------------------
commit 07dee17077539c223b589f86899828881bb7801b
Author: Nancy Durgin <[email protected]>
Date: Tue Oct 1 13:24:49 2019 -0700
Handle BBox in Form
This was just not being handled at all... oops?
The fix should now properly clip a bunch of stuff that wasn't being
clipped before.
diff --git a/pdf/pdf_image.c b/pdf/pdf_image.c
index 5c72118..d314db7 100644
--- a/pdf/pdf_image.c
+++ b/pdf/pdf_image.c
@@ -30,6 +30,7 @@
#include "pdf_optcontent.h"
#include "stream.h" /* for stell() */
+#include "gspath2.h"
#include "gsiparm4.h"
#include "gsiparm3.h"
@@ -1386,6 +1387,8 @@ static int pdfi_do_form(pdf_context *ctx, pdf_dict *page_dict, pdf_dict *form_di
bool do_group = false;
pdf_array *FormMatrix = NULL;
gs_matrix m;
+ gs_rect bbox;
+ pdf_array *BBox;
dbgmprintf(ctx->memory, "pdfi_do_form BEGIN\n");
code = pdfi_dict_known(form_dict, "Group", &group_known);
@@ -1416,6 +1419,13 @@ static int pdfi_do_form(pdf_context *ctx, pdf_dict *page_dict, pdf_dict *form_di
if (code < 0)
goto exit1;
+ code = pdfi_dict_knownget_type(ctx, form_dict, "BBox", PDF_ARRAY, (pdf_obj **)&BBox);
+ if (code < 0)
+ goto exit1;
+ code = pdfi_array_to_gs_rect(ctx, BBox, &bbox);
+ if (code < 0)
+ goto exit1;
+
code = pdfi_gsave(ctx);
if (code < 0)
goto exit1;
@@ -1425,6 +1435,10 @@ static int pdfi_do_form(pdf_context *ctx, pdf_dict *page_dict, pdf_dict *form_di
goto exit2;
}
+ code = gs_rectclip(ctx->pgs, &bbox, 1);
+ if (code < 0)
+ goto exit1;
+
if (do_group) {
code = pdfi_form_execgroup(ctx, page_dict, form_dict, NULL);
} else {
@@ -1452,10 +1466,10 @@ static int pdfi_do_form(pdf_context *ctx, pdf_dict *page_dict, pdf_dict *form_di
exit:
pdfi_countdown(FormMatrix);
- if (code < 0) {
- return code;
- }
+ pdfi_countdown(BBox);
dbgmprintf(ctx->memory, "pdfi_do_form END\n");
+ if (code < 0)
+ return code;
return 0;
}
----------------------------------------------------------------------
commit 62d98a4d470d570ae40be012b410869e1b929398
Author: Nancy Durgin <[email protected]>
Date: Tue Oct 1 13:01:41 2019 -0700
Cleanup, comment, error-handling
(Shouldn't have any effects)
diff --git a/pdf/pdf_trans.c b/pdf/pdf_trans.c
index 706d043..8599404 100644
--- a/pdf/pdf_trans.c
+++ b/pdf/pdf_trans.c
@@ -31,7 +31,7 @@
/* (see pdf_draw.ps/execmaskgroup) */
static int pdfi_trans_set_mask(pdf_context *ctx, pdfi_int_gstate *igs, int colorindex)
{
- int code;
+ int code = 0, code1 = 0;
pdf_dict *SMask = igs->SMask;
gs_color_space *pcs = NULL;
gs_rect bbox;
@@ -63,13 +63,20 @@ static int pdfi_trans_set_mask(pdf_context *ctx, pdfi_int_gstate *igs, int color
}
/* If /Processed not in the dict, put it there */
if (code == 0) {
+ /* the cleanup at end of this routine assumes both Key and Processed have a ref */
code = pdfi_alloc_object(ctx, PDF_BOOL, 0, (pdf_obj **)&Processed);
if (code < 0)
goto exit;
Processed->value = false;
+ /* pdfi_alloc_object() doesn't grab a ref */
pdfi_countup(Processed);
+ /* pdfi_make_name() does grab a ref, so no need to countup */
code = pdfi_make_name(ctx, (byte *)"Processed", strlen("Processed"), &Key);
+ if (code < 0)
+ goto exit;
code = pdfi_dict_put(SMask, Key, (pdf_obj *)Processed);
+ if (code < 0)
+ goto exit;
}
/* See pdf1.7 pg 553 (pain in the butt to find this!) */
@@ -198,9 +205,11 @@ static int pdfi_trans_set_mask(pdf_context *ctx, pdfi_int_gstate *igs, int color
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);
+ code1 = gs_end_transparency_mask(ctx->pgs, colorindex);
+ if (code != 0)
+ code = code1;
+
/* Put back the matrix (we couldn't just rely on gsave/grestore for whatever reason,
* according to PS code anyway...
*/
Summary of changes:
pdf/pdf_image.c | 20 +++++++++++++++++---
pdf/pdf_trans.c | 15 ++++++++++++---
2 files changed, 29 insertions(+), 6 deletions(-)