[gs-commits] ghostpdl branch, pdfi, updated. jbig2dec-0.14-2188-g8253dc8

[email protected] (Nancy Durgin)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, pdfi has been updated
       via  8253dc8102e2438a30f7c585fc716846645afb56 (commit)
      from  8b53d58373f259025551bceb49534be0429523cd (commit)

----------------------------------------------------------------------
commit 8253dc8102e2438a30f7c585fc716846645afb56
Author: Nancy Durgin <[email protected]>
Date:   Tue Aug 27 08:58:53 2019 -0700

    Correctly set the color for SMask
    
    Use "getalphaisshape" to decide which colorindex to use (fill or stroke)

diff --git a/pdf/pdf_trans.c b/pdf/pdf_trans.c
index 4d3421d..853c585 100644
--- a/pdf/pdf_trans.c
+++ b/pdf/pdf_trans.c
@@ -26,7 +26,7 @@
 
 #include "gstparam.h"
 
-static int pdfi_trans_set_mask(pdf_context *ctx, pdfi_int_gstate *igs)
+static int pdfi_trans_set_mask(pdf_context *ctx, pdfi_int_gstate *igs, int colorindex)
 {
     int code;
     pdf_dict *SMask = igs->SMask;
@@ -109,13 +109,13 @@ static int pdfi_trans_set_mask(pdf_context *ctx, pdfi_int_gstate *igs)
                         goto exit;
                 } else {
                     /* Inherit current colorspace */
-                    params.ColorSpace = ctx->pgs->color[0].color_space; /* 0 or 1 ? */
+                    params.ColorSpace = ctx->pgs->color[colorindex].color_space;
                 }
             } else {
                 /* TODO: Is this an error or what?
                    Inherit current colorspace
                 */
-                params.ColorSpace = ctx->pgs->color[0].color_space; /* 0 or 1 ? */
+                params.ColorSpace = ctx->pgs->color[colorindex].color_space;
             }
 
             code = gs_begin_transparency_mask(ctx->pgs, &params, &bbox, true);
@@ -323,17 +323,20 @@ int pdfi_trans_end_smask_notify(pdf_context *ctx)
 int pdfi_trans_set_params(pdf_context *ctx, double alpha)
 {
     pdfi_int_gstate *igs = (pdfi_int_gstate *)ctx->pgs->client_data;
+    int colorindex;
 
     if (ctx->page_has_transparency) {
         if (gs_getalphaisshape(ctx->pgs)) {
             gs_setshapealpha(ctx->pgs, alpha);
             gs_setopacityalpha(ctx->pgs, 1.0);
+            colorindex = 1;
         } else {
             gs_setshapealpha(ctx->pgs, 1.0);
             gs_setopacityalpha(ctx->pgs, alpha);
+            colorindex = 0;
         }
         if (igs->SMask) {
-            pdfi_trans_set_mask(ctx, igs);
+            pdfi_trans_set_mask(ctx, igs, colorindex);
         }
     }
 


Summary of changes:
 pdf/pdf_trans.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 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.