[gimp] Bug 720711 - gimpressionist: Background paper is not aligned...



commit 3afc53d866282a4fa8adda31c2adb3734eceb53b
Author: Mark Schmitz <renegat nospam gmail com>
Date:   Wed Dec 18 18:35:06 2013 +0100

    Bug 720711 - gimpressionist: Background paper is not aligned...
    
    ...with the painted image
    
    gimpressionist: fix alignment of image and background paper.
    Additionally the resize function is now skipped for a scale of 100%.

 plug-ins/gimpressionist/repaint.c |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/plug-ins/gimpressionist/repaint.c b/plug-ins/gimpressionist/repaint.c
index ca7cbe2..5b0bf70 100644
--- a/plug-ins/gimpressionist/repaint.c
+++ b/plug-ins/gimpressionist/repaint.c
@@ -553,22 +553,37 @@ repaint (ppm_t *p, ppm_t *a)
     }
   else
     {
-      scale = runningvals.paper_scale / 100.0;
+      int dx, dy;
+
       ppm_new (&tmp, p->width, p->height);
       ppm_load (runningvals.selected_paper, &paper_ppm);
-      resize (&paper_ppm, paper_ppm.width * scale, paper_ppm.height * scale);
+
+      if (runningvals.paper_scale != 100.0)
+        {
+          scale = runningvals.paper_scale / 100.0;
+          resize (&paper_ppm, paper_ppm.width * scale, paper_ppm.height * scale);
+        }
+
       if (runningvals.paper_invert)
         ppm_apply_gamma (&paper_ppm, -1.0, 1, 1, 1);
-      for (x = 0; x < tmp.width; x++)
+
+      dx = runningvals.general_paint_edges ? paper_ppm.width - maxbrushwidth : 0;
+      dy = runningvals.general_paint_edges ? paper_ppm.height - maxbrushheight : 0;
+
+      for (y = 0; y < tmp.height; y++)
         {
-          int rx = x % paper_ppm.width;
+          int lx;
+          int ry = (y + dy) % paper_ppm.height;
 
-          for (y = 0; y < tmp.height; y++)
+          for (x = 0; x < tmp.width; x+=lx)
             {
-              int ry = y % paper_ppm.height;
+              int rx = (x + dx) % paper_ppm.width;
+
+              lx = MIN (tmp.width - x, paper_ppm.width - rx);
+
               memcpy (&tmp.col[y * tmp.width * 3 + x * 3],
-                      &paper_ppm.col[ry*paper_ppm.width*3+rx*3],
-                      3);
+                      &paper_ppm.col[ry * paper_ppm.width * 3 + rx * 3],
+                      3 * lx);
             }
         }
     }


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