This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository legacy-imlib2.

View the commit online.

commit c47e18d5712e69868561a20055efb5b9839df991
Author: Kim Woelders <[email protected]>
AuthorDate: Thu Feb 23 19:06:51 2023 +0100

    imlib2_view: Add option to set background checkerboard field size
---
 src/bin/imlib2_view.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/bin/imlib2_view.c b/src/bin/imlib2_view.c
index ec3710b..a36151f 100644
--- a/src/bin/imlib2_view.c
+++ b/src/bin/imlib2_view.c
@@ -38,6 +38,7 @@ static double       opt_scale_x = 1.;
 static double       opt_scale_y = 1.;
 static double       opt_sgrab_x = 1.;
 static double       opt_sgrab_y = 1.;
+static int          opt_cbfs = 8;       /* Background checkerboard field size */
 static char         opt_progress_granularity = 10;
 static char         opt_progress_print = 0;
 static int          opt_progress_delay = 0;
@@ -70,6 +71,7 @@ static int          animloop = 0;       /* Animation loop count          */
    "  -p         : Print info in progress callback (default no)\n" \
    "  -s Sx[,Sy] : Set render x/y scaling factors to Sx,Sy (default 1.0)\n" \
    "  -S Sx[,Sy] : Set grab x/y scaling factors to Sx,Sy (default 1.0)\n" \
+   "  -t N       : Set background checkerboard field size (default 8)\n" \
    "  -v         : Increase verbosity\n"
 
 static void
@@ -92,16 +94,16 @@ bg_im_init(int w, int h)
    bg_im = imlib_create_image(w, h);
 
    imlib_context_set_image(bg_im);
-   for (y = 0; y < h; y += 8)
+   for (y = 0; y < h; y += opt_cbfs)
      {
-        _onoff_ = (y / 8) & 0x1;
-        for (x = 0; x < w; x += 8)
+        _onoff_ = (y / opt_cbfs) & 0x1;
+        for (x = 0; x < w; x += opt_cbfs)
           {
              if (onoff)
                 imlib_context_set_color(144, 144, 144, 255);
              else
                 imlib_context_set_color(100, 100, 100, 255);
-             imlib_image_fill_rectangle(x, y, 8, 8);
+             imlib_image_fill_rectangle(x, y, opt_cbfs, opt_cbfs);
              onoff++;
              if (_onoff_ == 2)
                 _onoff_ = 0;
@@ -593,7 +595,7 @@ main(int argc, char **argv)
 
    verbose = 0;
 
-   while ((opt = getopt(argc, argv, "cdeg:l:ps:S:v")) != -1)
+   while ((opt = getopt(argc, argv, "cdeg:l:ps:S:t:v")) != -1)
      {
         switch (opt)
           {
@@ -629,6 +631,11 @@ main(int argc, char **argv)
              if (opt_sgrab_y == 0.f)
                 opt_sgrab_y = opt_sgrab_x;
              break;
+          case 't':
+             no = atoi(optarg);
+             if (no > 0)
+                opt_cbfs = no;
+             break;
           case 'v':
              verbose += 1;
              break;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to