Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Commit

Permalink
jslib small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Brahim Hadriche committed May 25, 2018
1 parent f56b27f commit 81c9cae
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions Assets/EmojiTexture/Plugins/WebGL/EmojiTexture.jslib
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,8 @@ const EmojiTexturePrefix = "EmojiTexture_";

var EmojiTextureHelper = {
canvas: null,
ToCsString: function (str)
{
if (typeof str === 'object') {
str = JSON.stringify(str);
}
var bufferLength = lengthBytesUTF8(str) + 1;
var buffer = _malloc(bufferLength);
stringToUTF8(str, buffer, bufferLength);
return buffer;
},
ToJsString : function (ptr) {
return Pointer_stringify(ptr);
},
ToJsObject : function (ptr) {
var str = Pointer_stringify(ptr);
try {
return JSON.parse(str);
} catch (e) {
return null;
}
},
FreeMemory : function (ptr) {
_free(ptr);
}
};

Expand Down Expand Up @@ -59,6 +38,7 @@ var EmojiTexturePlugin = {
var imageData = ctx.getImageData(0, 0, width, height);
writeArrayToMemory(imageData.data, buffer);

//TODO: handle 'sanitize'
return emojiText.length;
}
};
Expand Down

0 comments on commit 81c9cae

Please sign in to comment.