blob: c046c22a28f4acb287771dafe441a8a0826255fd (
plain)
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
|
function wscale(_width,_height,_defaultwidth,_defaultheight){
if((_width > _defaultwidth)&&(_height < _defaultheight))
{
_height = _height*_defaultwidth/_width;
_width = _defaultwidth;
}
else if((_height > _defaultheight)&&(_width < _defaultwidth))
{
_width = (_width*(_defaultheight/_height));
_height = _defaultheight;
}
else if((_height > _defaultheight)&&(_width > _defaultwidth))
{
if(_defaultwidth/_width < _defaultheight/_height)
{
_height = _height*_defaultwidth/_width;
_width = _defaultwidth;
}
else
{
_width = _width*_defaultheight/_height;
_height = _defaultheight;
}
}
else
{
_height = _height;
_width = _width;
}
return _width;
}
|