【还原图片优化工具】
parent
72c42eb871
commit
104100ad01
|
@ -26,10 +26,10 @@ namespace LJ_OptTools
|
||||||
var oHeight = tex.height;
|
var oHeight = tex.height;
|
||||||
if (oWidth <= 0 || oHeight <= 0) return false;
|
if (oWidth <= 0 || oHeight <= 0) return false;
|
||||||
|
|
||||||
var tarW = (int)Mathf.Pow(2, Mathf.Ceil(Mathf.Log(oWidth, 2)));
|
//var tarW = (int)Mathf.Pow(2, Mathf.Ceil(Mathf.Log(oWidth, 2)));
|
||||||
var tarH = (int)Mathf.Pow(2, Mathf.Ceil(Mathf.Log(oHeight, 2)));
|
//var tarH = (int)Mathf.Pow(2, Mathf.Ceil(Mathf.Log(oHeight, 2)));
|
||||||
//var tarW = (oWidth / 4 + ((oWidth % 4 > 0) ? 1 : 0)) * 4;
|
var tarW = (oWidth / 4 + ((oWidth % 4 > 0) ? 1 : 0)) * 4;
|
||||||
//var tarH = (oHeight / 4 + ((oHeight % 4 > 0) ? 1 : 0)) * 4;
|
var tarH = (oHeight / 4 + ((oHeight % 4 > 0) ? 1 : 0)) * 4;
|
||||||
|
|
||||||
return oWidth != tarW || oHeight != tarH;
|
return oWidth != tarW || oHeight != tarH;
|
||||||
}
|
}
|
||||||
|
@ -62,11 +62,11 @@ namespace LJ_OptTools
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
//图片大小调整为4的整数倍
|
//图片大小调整为4的整数倍
|
||||||
//var tarW = (oWidth / 4 + ((oWidth % 4 > 0) ? 1 : 0)) * 4;
|
var tarW = (oWidth / 4 + ((oWidth % 4 > 0) ? 1 : 0)) * 4;
|
||||||
//var tarH = (oHeight / 4 + ((oHeight % 4 > 0) ? 1 : 0)) * 4;
|
var tarH = (oHeight / 4 + ((oHeight % 4 > 0) ? 1 : 0)) * 4;
|
||||||
|
|
||||||
var tarW = (int) Mathf.Pow(2, Mathf.Ceil(Mathf.Log(oWidth, 2)));
|
//var tarW = (int) Mathf.Pow(2, Mathf.Ceil(Mathf.Log(oWidth, 2)));
|
||||||
var tarH = (int) Mathf.Pow(2, Mathf.Ceil(Mathf.Log(oHeight, 2)));
|
//var tarH = (int) Mathf.Pow(2, Mathf.Ceil(Mathf.Log(oHeight, 2)));
|
||||||
|
|
||||||
ret.width = tarW;
|
ret.width = tarW;
|
||||||
ret.height = tarH;
|
ret.height = tarH;
|
||||||
|
|
Loading…
Reference in New Issue