[gs-commits] ghostpdl branch, pdfi, updated. jbig2dec-0.14-2193-gc92628e

[email protected] (Nancy Durgin)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, pdfi has been updated
       via  c92628ee17130682263d39cbe3a8901c16f52117 (commit)
       via  af85c8336ee7a5f2bf034d969609cbb50ba1f4ad (commit)
      from  32a11ee798e3c0bb7c33c9a8286dada7be9e1232 (commit)

----------------------------------------------------------------------
commit c92628ee17130682263d39cbe3a8901c16f52117
Author: Nancy Durgin <[email protected]>
Date:   Wed Aug 28 14:13:35 2019 -0700

    Re-enable the font pdfi_countdown()
    
    This may have been a red herring caused by other memory issues that
    have been fixed.  Left in a comment in case it comes up again....

diff --git a/pdf/pdf_gstate.c b/pdf/pdf_gstate.c
index 8f19609..19cc6a6 100644
--- a/pdf/pdf_gstate.c
+++ b/pdf/pdf_gstate.c
@@ -222,15 +222,17 @@ int pdfi_grestore(pdf_context *ctx)
 
         font1 = pdfi_get_current_pdf_font(ctx);
         if (font != NULL && (font != font1 || ((pdf_obj *)font)->refcnt > 1)) {
+            /* TODO: This countdown might have been causing memory corruption (dangling pointer)
+             * but seems to be okay now.  Maybe was fixed by other memory issue. 8-28-19
+             * If you come upon this comment in the future and it all seems fine, feel free to
+             * clean this up... (delete comment, remove the commented out warning message, etc)
+             */
 #if REFCNT_DEBUG
             dbgmprintf2(ctx->memory, "pdfi_grestore() counting down font UID %ld, refcnt %d\n",
                         font->UID, font->refcnt);
 #endif
-            /* TODO: Disabling this countdown because it causes dangling pointer and segfault in
-             * some cases.  This needs to be addressed properly.
-             */
-            dbgmprintf(ctx->memory, "WARNING pdfi_grestore() DISABLED pdfi_countdown (FIXME!)\n");
-            //pdfi_countdown(font);
+            //            dbgmprintf(ctx->memory, "WARNING pdfi_grestore() DISABLED pdfi_countdown (FIXME!)\n");
+            pdfi_countdown(font);
         }
 
         if(code < 0 && ctx->pdfstoponerror)

----------------------------------------------------------------------
commit af85c8336ee7a5f2bf034d969609cbb50ba1f4ad
Author: Nancy Durgin <[email protected]>
Date:   Wed Aug 28 13:44:23 2019 -0700

    Fixes for SMask (changes to match PS code)
    
    - set strokeconstantalpha and fillconstantalpha to 1 when setting up
      pdfi_form_execgroup()
    - extra call to setup transparency params during images.  May be extraneous,
      but seems to be in PS code...
    
    The paths through the code are a bit confusing because there are recursive
    calls but the pdfi function boundaries aren't in same places as the PS code.

diff --git a/pdf/pdf_image.c b/pdf/pdf_image.c
index 63ce6fc..41b3e1d 100644
--- a/pdf/pdf_image.c
+++ b/pdf/pdf_image.c
@@ -1221,6 +1221,11 @@ pdfi_do_image(pdf_context *ctx, pdf_dict *page_dict, pdf_dict *stream_dict, pdf_
     if (code < 0)
         goto cleanupExit;
 
+    /* Setup the fill state (pdf_draw.ps/doimage, setfillstate) */
+    code = pdfi_trans_set_params(ctx, gs_getfillconstantalpha(ctx->pgs));
+    if (code < 0)
+        return code;
+
     /* Render the image */
     code = pdfi_render_image(ctx, pim, new_stream,
                              mask_buffer, mask_size,
@@ -1326,6 +1331,8 @@ int pdfi_form_execgroup(pdf_context *ctx, pdf_dict *page_dict, pdf_dict *xobject
     gs_setopacityalpha(ctx->pgs, 1.0);
     gs_setshapealpha(ctx->pgs, 1.0);
     gs_setblendmode(ctx->pgs, BLEND_MODE_Compatible);
+    gs_setstrokeconstantalpha(ctx->pgs, 1.0);
+    gs_setfillconstantalpha(ctx->pgs, 1.0);
 
     code = gs_concat(ctx->pgs, &m);
     if (code < 0) {
diff --git a/pdf/pdf_int.c b/pdf/pdf_int.c
index 2cb8aeb..77344d0 100644
--- a/pdf/pdf_int.c
+++ b/pdf/pdf_int.c
@@ -3400,10 +3400,12 @@ int pdfi_run_context(pdf_context *ctx, pdf_dict *stream_dict,
     int code;
     gs_gstate *DefaultQState;
 
+    dbgmprintf(ctx->memory, "pdfi_run_context BEGIN\n");
     pdfi_copy_DefaultQState(ctx, &DefaultQState);
     pdfi_set_DefaultQState(ctx, ctx->pgs);
     code = pdfi_interpret_inner_content_stream(ctx, stream_dict, page_dict, stoponerror, desc);
     pdfi_restore_DefaultQState(ctx, &DefaultQState);
+    dbgmprintf(ctx->memory, "pdfi_run_context END\n");
     return code;
 }
 


Summary of changes:
 pdf/pdf_gstate.c | 12 +++++++-----
 pdf/pdf_image.c  |  7 +++++++
 pdf/pdf_int.c    |  2 ++
 3 files changed, 16 insertions(+), 5 deletions(-)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.