[gs-commits] ghostpdl branch, pdfi, updated. jbig2dec-0.14-2105-gb3ca6b3

[email protected] (Nancy Durgin)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, pdfi has been updated
       via  b3ca6b3af2561752cee7dafff27eefb9ce4df7af (commit)
       via  1ac4ccf045b8db289fea5e71e952c86834946e35 (commit)
      from  92f996b3942fcf1075a074a26beee49dfae20f12 (commit)

----------------------------------------------------------------------
commit b3ca6b3af2561752cee7dafff27eefb9ce4df7af
Author: Nancy Durgin <[email protected]>
Date:   Thu Aug 8 13:37:06 2019 -0700

    Change order of operations in pdfi_op_Q
    
    Should undo the transparency in reverse order of how it was done in op_q.
    (Meaning, do the pop first, then the grestore)

diff --git a/pdf/pdf_gstate.c b/pdf/pdf_gstate.c
index 101fd0c..1a6aafa 100644
--- a/pdf/pdf_gstate.c
+++ b/pdf/pdf_gstate.c
@@ -152,14 +152,13 @@ int pdfi_op_Q(pdf_context *ctx)
 {
     int code;
 
-    code = pdfi_grestore(ctx);
+    if (ctx->page_has_transparency)
+        code = gs_pop_transparency_state(ctx->pgs, false);
 
     if (code < 0 && ctx->pdfstoponerror)
         return code;
-    else {
-        if (ctx->page_has_transparency)
-            return gs_pop_transparency_state(ctx->pgs, false);
-    }
+    else
+        return pdfi_grestore(ctx);
     return 0;
 }
 

----------------------------------------------------------------------
commit 1ac4ccf045b8db289fea5e71e952c86834946e35
Author: Nancy Durgin <[email protected]>
Date:   Tue Aug 6 15:05:40 2019 -0700

    Fixes for patterns with transparency, etc.
    
    Force xstate_change flag to match what happens in PS code
    
    Put q/Q in the right spot for patterns
    
    (Also the gsave/grestore in this function might be redundant, but it
    should be harmless)

diff --git a/pdf/pdf_pattern.c b/pdf/pdf_pattern.c
index 04d3450..69a30bf 100644
--- a/pdf/pdf_pattern.c
+++ b/pdf/pdf_pattern.c
@@ -161,21 +161,39 @@ pdfi_pattern_paint(const gs_client_color *pcc, gs_gstate *pgs)
     pdf_context *ctx = context->ctx;
     int code = 0;
 
-    code = pdfi_op_q(ctx);
+    dbgmprintf(ctx->memory, "BEGIN PATTERN PaintProc\n");
+    code = pdfi_gsave(ctx); /* TODO: This might be redundant? */
     if (code < 0)
         return code;
     code = gs_setgstate(ctx->pgs, pgs);
     if (code < 0)
         goto exit;
 
+    /* TODO: This hack here is to emulate some stuff that happens in the PS code.
+     * Basically gx_pattern_load() gets called twice in PS code path, which causes this
+     * flag to end up being set, which changes some transparency stuff that might matter, to happen.
+     * By forcing this flag here, it makes the trace more closely follow what the PS code
+     * does.  It could turn out to be a meaningless side-effect, or it might be important.
+     * (sometime in the future, try taking this out and see what happens :)
+     */
+    if (pinst->templat.uses_transparency) {
+        dbgmprintf(ctx->memory, "pdfi_pattern_paint forcing trans_flags.xtate_change = TRUE\n");
+        ctx->pgs->trans_flags.xstate_change = true;
+    }
+    code = pdfi_op_q(ctx);
+    if (code < 0)
+        goto exit;
+
     code = pdfi_pattern_paint_stream(ctx, pcc);
-    if (code < 0) {
-        dbgmprintf1(ctx->memory, "ERROR: pdfi_pattern_paint: code %d when rendering pattern\n", code);
-        goto exit;
-    }
-
- exit:
     pdfi_op_Q(ctx);
+    if (code < 0) {
+        dbgmprintf1(ctx->memory, "ERROR: pdfi_pattern_paint: code %d when rendering pattern\n", code);
+        goto exit;
+    }
+
+ exit:
+    pdfi_grestore(ctx);
+    dbgmprintf(ctx->memory, "END PATTERN PaintProc\n");
     return code;
 }
 


Summary of changes:
 pdf/pdf_gstate.c  |  9 ++++-----
 pdf/pdf_pattern.c | 22 ++++++++++++++++++++--
 2 files changed, 24 insertions(+), 7 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.