wok annotate jwm/stuff/resize-backgound.u @ rev 15974

libgpg-error: add to ARM arch
author Christophe Lincoln <pankso@slitaz.org>
date Fri Feb 28 18:49:26 2014 +0100 (2014-02-28)
parents
children
rev   line source
pascal@416 1 --- jwm-2.0.1/src/icon.c
pascal@416 2 +++ jwm-2.0.1/src/icon.c
pascal@416 3 @@ -55,3 +55,3 @@
pascal@416 4
pascal@416 5 -static ScaledIconNode *GetScaledIcon(IconNode *icon, int width, int height);
pascal@416 6 +static ScaledIconNode *_GetScaledIcon(IconNode *icon, int width, int height);
pascal@416 7
pascal@416 8 @@ -194,8 +194,26 @@
pascal@416 9 int ix, iy;
pascal@416 10 + int nwidth = width, nheight = height;
pascal@416 11
pascal@416 12 Assert(icon);
pascal@416 13 + Assert(icon->image);
pascal@416 14
pascal@416 15 - /* Scale the icon. */
pascal@416 16 - node = GetScaledIcon(icon, width, height);
pascal@416 17 + if(nwidth == 0) {
pascal@416 18 + nwidth = icon->image->width;
pascal@416 19 + }
pascal@416 20 + if(nheight == 0) {
pascal@416 21 + nheight = icon->image->height;
pascal@416 22 + }
pascal@416 23
pascal@416 24 + /* respect ratio if not background */
pascal@416 25 + if (x || y) {
pascal@416 26 + double ratio;
pascal@416 27 +
pascal@416 28 + ratio = (double)icon->image->width / icon->image->height;
pascal@416 29 + nwidth = Min(nwidth, nheight * ratio);
pascal@416 30 + nheight = Min(nheight, nwidth / ratio);
pascal@416 31 + nwidth = nheight * ratio;
pascal@416 32 + }
pascal@416 33 +
pascal@416 34 + node = _GetScaledIcon(icon, nwidth, nheight);
pascal@416 35 +
pascal@416 36 if(node) {
pascal@416 37 @@ -450,3 +468,3 @@
pascal@416 38 /** Get a scaled icon. */
pascal@416 39 -ScaledIconNode *GetScaledIcon(IconNode *icon, int rwidth, int rheight) {
pascal@416 40 +ScaledIconNode *_GetScaledIcon(IconNode *icon, int nwidth, int nheight) {
pascal@416 41
pascal@416 42 @@ -460,4 +478,2 @@
pascal@416 43 double srcx, srcy;
pascal@416 44 - double ratio;
pascal@416 45 - int nwidth, nheight;
pascal@416 46 int usesMask;
pascal@416 47 @@ -465,16 +481,2 @@
pascal@416 48
pascal@416 49 - Assert(icon);
pascal@416 50 - Assert(icon->image);
pascal@416 51 -
pascal@416 52 - if(rwidth == 0) {
pascal@416 53 - rwidth = icon->image->width;
pascal@416 54 - }
pascal@416 55 - if(rheight == 0) {
pascal@416 56 - rheight = icon->image->height;
pascal@416 57 - }
pascal@416 58 -
pascal@416 59 - ratio = (double)icon->image->width / icon->image->height;
pascal@416 60 - nwidth = Min(rwidth, rheight * ratio);
pascal@416 61 - nheight = Min(rheight, nwidth / ratio);
pascal@416 62 - nwidth = nheight * ratio;
pascal@416 63 if(nwidth < 1) {