Hello community,

here is the log from the commit of package simple-scan for openSUSE:Factory 
checked in at 2020-05-08 23:03:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/simple-scan (Old)
 and      /work/SRC/openSUSE:Factory/.simple-scan.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "simple-scan"

Fri May  8 23:03:45 2020 rev:70 rq:800799 version:3.36.2.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/simple-scan/simple-scan.changes  2020-05-01 
11:08:12.291175668 +0200
+++ /work/SRC/openSUSE:Factory/.simple-scan.new.2738/simple-scan.changes        
2020-05-08 23:03:46.657669321 +0200
@@ -1,0 +2,7 @@
+Wed May  6 08:30:47 UTC 2020 - Bjørn Lie <[email protected]>
+
+- Update to version 3.36.2.1:
+  + Revert the higher bit depth text scans changes - they aren't
+    working with PDF saving.
+
+-------------------------------------------------------------------

Old:
----
  simple-scan-3.36.2.tar.xz

New:
----
  simple-scan-3.36.2.1.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ simple-scan.spec ++++++
--- /var/tmp/diff_new_pack.SnZg7T/_old  2020-05-08 23:03:47.177670383 +0200
+++ /var/tmp/diff_new_pack.SnZg7T/_new  2020-05-08 23:03:47.181670390 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           simple-scan
-Version:        3.36.2
+Version:        3.36.2.1
 Release:        0
 Summary:        Simple Scanning Utility
 License:        GPL-3.0-or-later

++++++ simple-scan-3.36.2.tar.xz -> simple-scan-3.36.2.1.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/simple-scan-3.36.2/NEWS new/simple-scan-3.36.2.1/NEWS
--- old/simple-scan-3.36.2/NEWS 2020-04-28 23:44:33.210037500 +0200
+++ new/simple-scan-3.36.2.1/NEWS       2020-05-06 05:38:48.421531700 +0200
@@ -1,3 +1,8 @@
+Overview of changes in simple-scan 3.36.2.1
+
+  * Revert the higher bit depth text scans changes - they aren't working with
+    PDF saving.
+
 Overview of changes in simple-scan 3.36.2
 
   * Use higher bit depth on text scans.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/simple-scan-3.36.2/meson.build 
new/simple-scan-3.36.2.1/meson.build
--- old/simple-scan-3.36.2/meson.build  2020-04-28 23:44:33.226037700 +0200
+++ new/simple-scan-3.36.2.1/meson.build        2020-05-06 05:38:48.437532000 
+0200
@@ -1,5 +1,5 @@
 project ('simple-scan', ['vala', 'c'],
-         version: '3.36.2',
+         version: '3.36.2.1',
          license: 'GPLv3+',
          default_options: [
              'warning_level=1',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/simple-scan-3.36.2/src/app-window.vala 
new/simple-scan-3.36.2.1/src/app-window.vala
--- old/simple-scan-3.36.2/src/app-window.vala  2020-04-28 23:44:33.246038000 
+0200
+++ new/simple-scan-3.36.2.1/src/app-window.vala        2020-05-06 
05:38:48.453532200 +0200
@@ -919,13 +919,14 @@
         {
             options.scan_mode = ScanMode.GRAY;
             options.dpi = preferences_dialog.get_text_dpi ();
+            options.depth = 2;
         }
         else
         {
             options.scan_mode = ScanMode.COLOR;
             options.dpi = preferences_dialog.get_photo_dpi ();
+            options.depth = 8;
         }
-        options.depth = 8;
         preferences_dialog.get_paper_size (out options.paper_width, out 
options.paper_height);
         options.brightness = brightness;
         options.contrast = contrast;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/simple-scan-3.36.2/src/scanner.vala 
new/simple-scan-3.36.2.1/src/scanner.vala
--- old/simple-scan-3.36.2/src/scanner.vala     2020-04-28 23:44:33.246038000 
+0200
+++ new/simple-scan-3.36.2.1/src/scanner.vala   2020-05-06 05:38:48.457532400 
+0200
@@ -1333,6 +1333,10 @@
         info.width = parameters.pixels_per_line;
         info.height = parameters.lines;
         info.depth = parameters.depth;
+        /* Reduce bit depth if requested lower than received */
+        // FIXME: This a hack and only works on 8 bit gray to 2 bit gray
+        if (parameters.depth == 8 && parameters.format == Sane.Frame.GRAY && 
job.depth == 2 && job.scan_mode == ScanMode.GRAY)
+            info.depth = job.depth;
         info.n_channels = parameters.format == Sane.Frame.GRAY ? 1 : 3;
         info.dpi = job.dpi; // FIXME: This is the requested DPI, not the 
actual DPI
         info.device = current_device;
@@ -1472,6 +1476,56 @@
                 n_used++;
             }
 
+            /* Reduce bit depth if requested lower than received */
+            // FIXME: This a hack and only works on 8 bit gray to 2 bit gray
+            if (parameters.depth == 8 && parameters.format == Sane.Frame.GRAY 
&&
+                job.depth == 2 && job.scan_mode == ScanMode.GRAY)
+            {
+                uchar block = 0;
+                var write_offset = 0;
+                var block_shift = 6;
+                for (var i = 0; i < line.n_lines; i++)
+                {
+                    var offset = i * line.data_length;
+                    for (var x = 0; x < line.width; x++)
+                    {
+                         var p = line.data[offset + x];
+
+                         uchar sample;
+                         if (p >= 192)
+                             sample = 3;
+                         else if (p >= 128)
+                             sample = 2;
+                         else if (p >= 64)
+                             sample = 1;
+                         else
+                             sample = 0;
+
+                         block |= sample << block_shift;
+                         if (block_shift == 0)
+                         {
+                             line.data[write_offset] = block;
+                             write_offset++;
+                             block = 0;
+                             block_shift = 6;
+                         }
+                         else
+                             block_shift -= 2;
+                    }
+
+                    /* Finish each line on a byte boundary */
+                    if (block_shift != 6)
+                    {
+                        line.data[write_offset] = block;
+                        write_offset++;
+                        block = 0;
+                        block_shift = 6;
+                    }
+                }
+
+                line.data_length = (line.width * 2 + 7) / 8;
+            }
+
             notify_event (new NotifyGotLine (job.id, line));
         }
     }


Reply via email to