Package: hsetroot / 1.0.2-9

02_extend-mode.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Description: Add the '-extend' option
Origin: vendor
Bug: http://bugs.debian.org/507554
Forwarded: no
Author: <[email protected]>
Reviewed-by: Alessandro Ghedini <[email protected]>
Last-Update: 2012-08-05

--- a/src/hsetroot.c
    b/src/hsetroot.c
@@ -8,7  8,7 @@
 #include "config.h"
 
 typedef enum
-{ Full, Fill, Center, Tile } ImageMode;
 { Full, Fill, Center, Tile, Xtend } ImageMode;
 
 void
 usage (char *commandline)
@@ -30,6  30,7 @@
 	  " -center <image>            Render an image centered on screen\n"
 	  " -tile <image>              Render an image tiled\n"
 	  " -full <image>              Render an image maximum aspect\n"
 	  " -extend <image>            Render an image max aspect and fill borders\n"
 	  " -fill <image>              Render an image strechted\n"
 	  "\n"
 	  "Manipulations:\n"
@@ -199,7  200,7 @@
       imlib_blend_image_onto_image (buffer, 0, 0, 0, imgW, imgH,
 				    0, 0, rootW, rootH);
     }
-  else if (mode == Full)
   else if ((mode == Full) || (mode == Xtend))
     {
       double aspect = ((double) rootW) / imgW;
       int top, left;
@@ -207,9  208,29 @@
 	aspect = (double) rootH / (double) imgH;
       top = (rootH - (int) (imgH * aspect)) / 2;
       left = (rootW - (int) (imgW * aspect)) / 2;
 
       imlib_blend_image_onto_image (buffer, 0, 0, 0, imgW, imgH,
 				    left, top, (int) (imgW * aspect),
 				    (int) (imgH * aspect));
 
       if (mode == Xtend) {
         int w;
         if ( left >0 ) {
           int right = left - 1   (int) (imgW * aspect);
           /* check only the right border - left is int divided so the right border is larger */
           for (w = 1; (right   w < rootW); w <<= 1) {
             imlib_image_copy_rect (left   1 - w, 0, w, rootH, left   1 - w - w, 0);
             imlib_image_copy_rect (right, 0, w, rootH, right   w, 0);
           }
         }
         if (top >0 ) {
           int bottom = top - 1   (int) (imgH * aspect);
           for (w = 1; (bottom   w < rootH); w <<= 1) {
             imlib_image_copy_rect (0, top   1 - w, rootW, w, 0, top   1 - w - w);
             imlib_image_copy_rect (0, bottom, rootW, w, 0, bottom   w);
           }
         }
       }
     }
   else
     {
@@ -422,6  443,20 @@
 		  0)
 		{
 		  fprintf (stderr, "Bad image (%s)\n", argv[i]);
 		  continue;
 		}
 	    }
 	  else if (strcmp (argv[i], "-extend") == 0)
 	    {
 	      if ((  i) >= argc)
 		{
 		  fprintf (stderr, "Missing image\n");
 		  continue;
 		}
 	      if (load_image (Xtend, argv[i], width, height, alpha, image) ==
 		  0)
 		{
 		  fprintf (stderr, "Bad image (%s)\n", argv[i]);
 		  continue;
 		}
 	    }