[gimp] plug-ins: babl_init|exit() needs to be run for "file-pdf-load-thumb".



commit e0a24a27de42f3f809dd5ef86e4c925b9608ec52
Author: Jehan <jehan girinstud io>
Date:   Mon Jul 22 12:07:04 2019 +0200

    plug-ins: babl_init|exit() needs to be run for "file-pdf-load-thumb".
    
    This is run as part of gimp_ui_init() in the normal "file-pdf-load"
    calls, but such calls have been forgotten for the thumbnail load
    procedure.
    
    Also the GimpRunMode is only a parameter in "file-pdf-load". For
    "file-pdf-load-thumb", the first parameter is directly the filename. The
    fact it might have used to work is chance as it were only tested against
    GIMP_RUN_INTERACTIVE, which is 0, so the test would end up FALSE, which
    is what we want for thumbnail loading. Anyway now we get a proper call
    (thumbnail loading always considered non-interactive).

 plug-ins/common/file-pdf-load.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/common/file-pdf-load.c b/plug-ins/common/file-pdf-load.c
index 24f5f9f71e..1ce6933eee 100644
--- a/plug-ins/common/file-pdf-load.c
+++ b/plug-ins/common/file-pdf-load.c
@@ -376,14 +376,11 @@ run (const gchar      *name,
      GimpParam       **return_vals)
 {
   static GimpParam  values[7];
-  GimpRunMode       run_mode;
   GimpPDBStatusType status   = GIMP_PDB_SUCCESS;
   gint32            image_ID = -1;
   PopplerDocument  *doc      = NULL;
   GError           *error    = NULL;
 
-  run_mode = param[0].data.d_int32;
-
   INIT_I18N ();
 
   *nreturn_vals = 1;
@@ -395,7 +392,9 @@ run (const gchar      *name,
   if (strcmp (name, LOAD_PROC) == 0 || strcmp (name, LOAD2_PROC) == 0)
     {
       PdfSelectedPages pages = { 0, NULL };
+      GimpRunMode      run_mode;
 
+      run_mode = param[0].data.d_int32;
       switch (run_mode)
         {
         case GIMP_RUN_INTERACTIVE:
@@ -584,7 +583,8 @@ run (const gchar      *name,
 
           doc = open_document (param[0].data.d_string,
                                loadvals.PDF_password,
-                               run_mode, &error);
+                               GIMP_RUN_NONINTERACTIVE,
+                               &error);
 
           if (doc)
             {
@@ -612,7 +612,10 @@ run (const gchar      *name,
 
               gimp_image_undo_disable (image);
 
+
+              babl_init ();
               layer_from_surface (image, "thumbnail", 0, surface, 0.0, 1.0);
+              babl_exit ();
               cairo_surface_destroy (surface);
 
               gimp_image_undo_enable (image);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]