[simple-scan/gnome-3-38] Fix crop size after decreasing page size



commit dfc7db8c1150d398442e22796f1473ecbc4f0bad
Author: Bartosz Kosiorek <gang65 poczta onet pl>
Date:   Tue Oct 6 17:43:46 2020 +0000

    Fix crop size after decreasing page size
    
    If the crop is set, and the page size was decreased,
    it could happen that crop size is bigger than the page itself.
    This patch fixing that issue.
    
    
    (cherry picked from commit b4954e02dccdc1fac3cab54aeb16b11711938727)

 src/page.vala | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/page.vala b/src/page.vala
index c6b532ee..62af7735 100644
--- a/src/page.vala
+++ b/src/page.vala
@@ -216,8 +216,8 @@ public class Page : Object
         this.crop_name = crop_name;
         this.crop_x = crop_x;
         this.crop_y = crop_y;
-        this.crop_width = crop_width;
-        this.crop_height = crop_height;
+        this.crop_width = (crop_x + crop_width > scan_width) ? scan_width : crop_width;
+        this.crop_height = (crop_y + crop_height > scan_height) ? scan_height : crop_height;
     }
 
     public void set_page_info (ScanPageInfo info)


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