wok-next diff jwm/stuff/resize-backgound.u @ rev 968

Add intltool (new build dep for PCmanFM)
author Christophe Lincoln <pankso@slitaz.org>
date Mon Jun 30 12:14:42 2008 +0200 (2008-06-30)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/jwm/stuff/resize-backgound.u	Mon Jun 30 12:14:42 2008 +0200
     1.3 @@ -0,0 +1,63 @@
     1.4 +--- jwm-2.0.1/src/icon.c
     1.5 ++++ jwm-2.0.1/src/icon.c
     1.6 +@@ -55,3 +55,3 @@
     1.7 + 
     1.8 +-static ScaledIconNode *GetScaledIcon(IconNode *icon, int width, int height);
     1.9 ++static ScaledIconNode *_GetScaledIcon(IconNode *icon, int width, int height);
    1.10 + 
    1.11 +@@ -194,8 +194,26 @@
    1.12 +    int ix, iy;
    1.13 ++   int nwidth = width, nheight = height;
    1.14 + 
    1.15 +    Assert(icon);
    1.16 ++   Assert(icon->image);
    1.17 + 
    1.18 +-   /* Scale the icon. */
    1.19 +-   node = GetScaledIcon(icon, width, height);
    1.20 ++   if(nwidth == 0) {
    1.21 ++      nwidth = icon->image->width;
    1.22 ++   }
    1.23 ++   if(nheight == 0) {
    1.24 ++      nheight = icon->image->height;
    1.25 ++   }
    1.26 + 
    1.27 ++   /* respect ratio if not background */
    1.28 ++   if (x || y) { 
    1.29 ++      double ratio;
    1.30 ++
    1.31 ++      ratio = (double)icon->image->width / icon->image->height;
    1.32 ++      nwidth = Min(nwidth, nheight * ratio);
    1.33 ++      nheight = Min(nheight, nwidth / ratio);
    1.34 ++      nwidth = nheight * ratio;
    1.35 ++   }
    1.36 ++   
    1.37 ++   node = _GetScaledIcon(icon, nwidth, nheight);
    1.38 ++
    1.39 +    if(node) {
    1.40 +@@ -450,3 +468,3 @@
    1.41 + /** Get a scaled icon. */
    1.42 +-ScaledIconNode *GetScaledIcon(IconNode *icon, int rwidth, int rheight) {
    1.43 ++ScaledIconNode *_GetScaledIcon(IconNode *icon, int nwidth, int nheight) {
    1.44 + 
    1.45 +@@ -460,4 +478,2 @@
    1.46 +    double srcx, srcy;
    1.47 +-   double ratio;
    1.48 +-   int nwidth, nheight;
    1.49 +    int usesMask;
    1.50 +@@ -465,16 +481,2 @@
    1.51 + 
    1.52 +-   Assert(icon);
    1.53 +-   Assert(icon->image);
    1.54 +-
    1.55 +-   if(rwidth == 0) {
    1.56 +-      rwidth = icon->image->width;
    1.57 +-   }
    1.58 +-   if(rheight == 0) {
    1.59 +-      rheight = icon->image->height;
    1.60 +-   }
    1.61 +-
    1.62 +-   ratio = (double)icon->image->width / icon->image->height;
    1.63 +-   nwidth = Min(rwidth, rheight * ratio);
    1.64 +-   nheight = Min(rheight, nwidth / ratio);
    1.65 +-   nwidth = nheight * ratio;
    1.66 +    if(nwidth < 1) {