From 5076902214e18dda122d89d9f2243ce7cb983573 Mon Sep 17 00:00:00 2001 From: Alexander Xia Date: Sat, 19 Mar 2016 23:27:19 +0800 Subject: [PATCH 1/2] Double Layer Skin Support test? --- libs/three.msp.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/three.msp.js b/libs/three.msp.js index 723e9287..6bf4b776 100755 --- a/libs/three.msp.js +++ b/libs/three.msp.js @@ -476,11 +476,16 @@ var MSP = (function (global, undefined) { /* 高清皮肤支持 */ skincanvas.width = skin.width; - skincanvas.height = skin.height; + skincanvas.height = skin.width/2; skinc.clearRect(0, 0, 64, 32); - skinc.drawImage(skin, 0, 0); + if(skin.width==skin.height){ + skinc.drawImage(skin, 0, 0, skin.width, skin.height/2, 0, 0, skin.width, skin.height/2); + skinc.drawImage(skin, 0, skin.height/2, skin.width, skin.height/4, 0, skin.height/4, skin.width, skin.height/2); + }else{ + skinc.drawImage(skin, 0, 0); + } var imgdata = skinc.getImageData(0, 0, 64, 32); var pixels = imgdata.data; From a18170ff1e1ef4fc9588297bdde4f0cfeac7284d Mon Sep 17 00:00:00 2001 From: Alexander Xia Date: Sat, 19 Mar 2016 23:44:56 +0800 Subject: [PATCH 2/2] Fix Double Layer Skin Fix HD Skin --- libs/three.msp.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/three.msp.js b/libs/three.msp.js index 6bf4b776..901ded0a 100755 --- a/libs/three.msp.js +++ b/libs/three.msp.js @@ -473,21 +473,24 @@ var MSP = (function (global, undefined) { var skin = new Image(); skin.onload = function () { - /* 高清皮肤支持 */ skincanvas.width = skin.width; skincanvas.height = skin.width/2; - skinc.clearRect(0, 0, 64, 32); + skinc.clearRect(0, 0, skincanvas.width, skincanvas.height); + //DEBUG + //console.log(skin.width+" "+skin.height); + if(skin.width==skin.height){ - skinc.drawImage(skin, 0, 0, skin.width, skin.height/2, 0, 0, skin.width, skin.height/2); - skinc.drawImage(skin, 0, skin.height/2, skin.width, skin.height/4, 0, skin.height/4, skin.width, skin.height/2); + var ratio=skin.width/64; + skinc.drawImage(skin, 0 *ratio, 0 *ratio, 64*ratio, 32*ratio, 0 *ratio, 0 *ratio, 64*ratio, 32*ratio); + skinc.drawImage(skin, 0 *ratio, 32*ratio, 64*ratio, 16*ratio, 0 *ratio, 16*ratio, 64*ratio, 16*ratio); }else{ skinc.drawImage(skin, 0, 0); } - var imgdata = skinc.getImageData(0, 0, 64, 32); + var imgdata = skinc.getImageData(0, 0, skincanvas.width, skincanvas.height); var pixels = imgdata.data;