[gs-commits] ghostpdl branch, pdfi, updated. jbig2dec-0.14-2216-g3eb0029

[email protected] (Nancy Durgin)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, pdfi has been updated
       via  3eb0029e1044fa72f5c221ffe69b25c15f12d3fb (commit)
      from  519be80e188ad5a4bbb9dfb721f078b170193d9f (commit)

----------------------------------------------------------------------
commit 3eb0029e1044fa72f5c221ffe69b25c15f12d3fb
Author: Nancy Durgin <[email protected]>
Date:   Thu Sep 19 10:30:34 2019 -0700

    Clean up handling of spots for Patterns
    
    I think the important part was already implemented in
    pdfi_check_Pattern() and these base cases don't really do anything
    interesting.
    
    But at least now it makes a rational decision instead of spamming warnings.

diff --git a/pdf/pdf_colour.c b/pdf/pdf_colour.c
index 04381f8..43535dd 100644
--- a/pdf/pdf_colour.c
+++ b/pdf/pdf_colour.c
@@ -66,7 +66,7 @@ static int pdfi_check_for_spots_by_name(pdf_context *ctx, pdf_name *name,
     } else if (pdfi_name_is(name, "DeviceCMYK")) {
         return 0;
     } else if (pdfi_name_is(name, "Pattern")) {
-        dbgmprintf(ctx->memory, "WARNING: pdfi_check_for_spots_by_name: Pattern is not supported\n");
+        /* TODO: I think this is fine... */
         return 0;
     } else {
         code = pdfi_find_resource(ctx, (unsigned char *)"ColorSpace", name, parent_dict, page_dict, &ref_space);
@@ -102,6 +102,27 @@ static int pdfi_check_for_spots_by_array(pdf_context *ctx, pdf_array *color_arra
             (void)pdfi_countdown(base_space);
         }
         goto exit;
+    } else if (pdfi_name_is(space, "Pattern")) {
+        pdf_obj *base_space = NULL;
+        uint64_t size = pdfi_array_size(color_array);
+
+        /* Array of size 1 "[ /Pattern ]" is okay, just do nothing. */
+        if (size == 1)
+            goto exit;
+        /* Array of size > 2 we don't handle (shouldn't happen?) */
+        if (size != 2) {
+            dbgmprintf1(ctx->memory,
+                        "WARNING: checking Pattern for spots, expected array size 2, got %lu\n",
+                        size);
+            goto exit;
+        }
+        /* "[/Pattern base_space]" */
+        code = pdfi_array_get(ctx, color_array, 1, &base_space);
+        if (code == 0) {
+            code = pdfi_check_ColorSpace_for_spots(ctx, base_space, parent_dict, page_dict, num_spots);
+            (void)pdfi_countdown(base_space);
+        }
+        goto exit;
     } else if (pdfi_name_is(space, "Lab")) {
         goto exit;
     } else if (pdfi_name_is(space, "RGB")) {
@@ -112,9 +133,6 @@ static int pdfi_check_for_spots_by_array(pdf_context *ctx, pdf_array *color_arra
         goto exit;
     } else if (pdfi_name_is(space, "CalGray")) {
         goto exit;
-    } else if (pdfi_name_is(space, "Pattern")) {
-        dbgmprintf(ctx->memory, "WARNING: pdfi_check_for_spots_by_array: Pattern is not supported\n");
-        goto exit;
     } else if (pdfi_name_is(space, "ICCBased")) {
         goto exit;
     } else if (pdfi_name_is(space, "DeviceRGB")) {


Summary of changes:
 pdf/pdf_colour.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 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.