weex-gcanvas
Advanced tools
Comparing version 0.5.8 to 0.5.9
@@ -111,2 +111,3 @@ /** | ||
this.id = ++(GCanvas.idCounter); | ||
this.style = {}; | ||
} | ||
@@ -138,3 +139,3 @@ | ||
} | ||
else | ||
else | ||
{ | ||
@@ -190,3 +191,10 @@ //bind canvas | ||
// if(context_type == 1) { | ||
// GBridge3d.setLogLevel("debug"); | ||
// GBridge3d.callEnable(this.componentId); | ||
// GBridge3d.setContextType(this.componentId, context_type); | ||
// }else { | ||
// GBridge.setLogLevel("debug"); | ||
GBridge.setContextType(this.componentId, context_type); | ||
// } | ||
@@ -199,3 +207,6 @@ context.componentId = this.componentId; | ||
this.context = context; | ||
// if(context_type == 0) { | ||
GBridge.callRegisterReattachJSCallback(this.componentId, context._clearImageTextures); | ||
// } | ||
@@ -211,2 +222,3 @@ this.startLoop(); | ||
GCanvas.prototype.render = function(){ | ||
GLog.d("gcanvas.render"); | ||
if(GCanvasPlatform !== 0 && this.context) | ||
@@ -239,3 +251,3 @@ { | ||
} | ||
fps = parseInt(fps) || 16; | ||
@@ -254,3 +266,3 @@ if(!this.context.timer){ | ||
} | ||
if(this.context.timer){ | ||
@@ -337,13 +349,15 @@ clearInterval(this.context.timer); | ||
} | ||
GCanvas.toDataURL = function(type,options){ | ||
GCanvas.prototype.toDataURL = function(type,options){ | ||
// GLog.d('gcanvas#toDataURL=====>>> ' + type + ',' + options); | ||
var args; | ||
if(typeof(options) == 'undefined'){ | ||
args = type + ';'; | ||
} else { | ||
args = type + ',' + options + ';'; | ||
var args; | ||
if(typeof(options) == 'undefined'){ | ||
args = type + ';'; | ||
} else { | ||
args = type + ',' + options + ';'; | ||
} | ||
return GBridge.exeSyncCmd(this.componentId,'todataurl',args); | ||
} | ||
return GBridge.exeSyncCmd('todataurl',args); | ||
} | ||
@@ -350,0 +364,0 @@ //----------------------------- |
@@ -25,3 +25,3 @@ var GBridge = require('./gutil').GBridge; | ||
*/ | ||
// this.id = (++GCanvasImage.idCounter); | ||
// this.id = (++GCanvasImage.idCounter); | ||
@@ -28,0 +28,0 @@ // this._id = this.id; // public facing "id" but _id used to internally |
@@ -5,2 +5,3 @@ var GBridge = require("./gutil").GBridge; | ||
var GCanvasImage = require("./gcanvasimage"); | ||
var GCodec = require("./gcodec") | ||
@@ -683,3 +684,7 @@ function GContext2D() { | ||
var imageCache = this._getImageTexture(image.src); | ||
var cacheKey = image.id; | ||
// var imageCache = this._getImageTexture(image.src); | ||
var imageCache = this._getImageTexture(cacheKey); | ||
if (imageCache) { | ||
@@ -692,9 +697,11 @@ this._concatDrawCmd(numArgs, image, sx, sy, sw, sh, dx, dy, dw, dh); | ||
{ | ||
GBridge.bindImageTexture(that.componentId, image.src, function(){}); | ||
GBridge.bindImageTexture(that.componentId, [image.src, image.id], function(){}); | ||
that._concatDrawCmd(numArgs, image, sx, sy, sw, sh, dx, dy, dw, dh); | ||
that._saveImageTexture(image.src, image); | ||
// that._saveImageTexture(image.src, image); | ||
that._saveImageTexture(cacheKey, image); | ||
} | ||
else | ||
{ | ||
GBridge.bindImageTexture(that.componentId, image.src, function(e){ | ||
GBridge.bindImageTexture(that.componentId, [image.src, image.id], function(e){ | ||
if( !e.error ) | ||
@@ -710,3 +717,5 @@ { | ||
that._concatDrawCmd(numArgs, image, sx, sy, sw, sh, dx, dy, dw, dh); | ||
that._saveImageTexture(image.src, image); | ||
// that._saveImageTexture(image.src, image); | ||
that._saveImageTexture(cacheKey, image); | ||
} | ||
@@ -1001,49 +1010,4 @@ }); | ||
function GarrToBase64(buffer) { | ||
var binary = '' | ||
var bytes = new Uint8Array( buffer ) | ||
var len = bytes.byteLength; | ||
for (var i = 0; i < len; i++) { | ||
binary += String.fromCharCode( bytes[ i ] ) | ||
} | ||
return btoa( binary ); | ||
} | ||
function _GcharDecode (nChr) { | ||
return nChr > 64 && nChr < 91 ? | ||
nChr - 65 | ||
: nChr > 96 && nChr < 123 ? | ||
nChr - 71 | ||
: nChr > 47 && nChr < 58 ? | ||
nChr + 4 | ||
: nChr === 43 ? | ||
62 | ||
: nChr === 47 ? | ||
63 | ||
: | ||
0; | ||
} | ||
function Gbase64ToArr (sBase64, nBlocksSize) { | ||
var | ||
sB64Enc = sBase64.replace(/[^A-Za-z0-9\+\/]/g, ""), nInLen = sB64Enc.length, | ||
nOutLen = nBlocksSize ? Math.ceil((nInLen * 3 + 1 >> 2) / nBlocksSize) * nBlocksSize : nInLen * 3 + 1 >> 2, taBytes = new Uint8Array(nOutLen); | ||
for (var nMod3, nMod4, nUint24 = 0, nOutIdx = 0, nInIdx = 0; nInIdx < nInLen; nInIdx++) { | ||
nMod4 = nInIdx & 3; | ||
nUint24 |= _GcharDecode(sB64Enc.charCodeAt(nInIdx)) << 18 - 6 * nMod4; | ||
if (nMod4 === 3 || nInLen - nInIdx === 1) { | ||
for (nMod3 = 0; nMod3 < 3 && nOutIdx < nOutLen; nMod3++, nOutIdx++) { | ||
taBytes[nOutIdx] = nUint24 >>> (16 >>> nMod3 & 24) & 255; | ||
} | ||
nUint24 = 0; | ||
} | ||
} | ||
return taBytes; | ||
} | ||
///////////////////////////////////////////////////////////////// | ||
@@ -1073,3 +1037,3 @@ //GCanvasImage | ||
+ dh + "," | ||
+ GarrToBase64(data) + ";"); | ||
+ GCodec.GarrToBase64(data) + ";"); | ||
} | ||
@@ -1103,2 +1067,6 @@ GContext2D.prototype.putImageData = function(imgData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight) { | ||
GContext2D.prototype.getImageData = function(x, y, w, h){ | ||
this.render(); | ||
return GBridge.callGetImageData(this.componentId, x, y, w, h); | ||
} | ||
@@ -1105,0 +1073,0 @@ GContext2D.prototype.getImageDataAsyn = function(x, y, w, h) { |
@@ -92,5 +92,5 @@ ///////////////////////////////////////////////////////////////// | ||
//GLog.setLevel(GLOG_WARN); | ||
GLog.setLevel(GLOG_DEBUG); | ||
// GLog.setLevel(GLOG_WARN); | ||
GLog.setLevel(GLOG_DEBUG); | ||
module.exports.GLog = GLog |
54
gutil.js
@@ -5,2 +5,3 @@ ///////////////////////////////////////////////////////////////// | ||
var GLog = require('./glog').GLog; | ||
var GCodec = require('./gcodec'); | ||
@@ -24,2 +25,12 @@ var inWeex = typeof callNative !== 'undefined'; | ||
/** | ||
* 判断是不是浏览器 | ||
* | ||
**/ | ||
isBrowser: function () { | ||
if(!canvasModule || !canvasModule.getDeviceInfo){ | ||
return true | ||
} | ||
}, | ||
callRegisterReattachJSCallback: function(componentId, cb){ | ||
@@ -42,4 +53,16 @@ if(!inWeex){ | ||
} | ||
if(this.isIOS() || this.isBrowser()){ | ||
canvasModule.render && canvasModule.render( commands, componentId ); | ||
}else{ | ||
callGCanvasLinkNative(componentId, 0x20000001, commands); | ||
} | ||
}, | ||
canvasModule.render && canvasModule.render( commands, componentId ); | ||
callGetImageData: function(componentId, x, y, w, h){ | ||
if(this.isIOS()){ | ||
}else{ | ||
var result = callGCanvasLinkNative(componentId, 0x20000001, "R" + x + "," + y + "," + w + "," + h + ";"); | ||
return {"data": GCodec.Gbase64ToArr(result)}; | ||
} | ||
}, | ||
@@ -70,3 +93,3 @@ | ||
e.id = image[1]; | ||
cb && cb(e); | ||
cb && cb(e); | ||
}); | ||
@@ -76,3 +99,3 @@ }, | ||
/**绑定纹理*/ | ||
bindImageTexture: function (componentId, src, callback) { | ||
bindImageTexture: function (componentId,src, callback) { | ||
if (!inWeex) { | ||
@@ -82,3 +105,3 @@ return; | ||
canvasModule.bindImageTexture && canvasModule.bindImageTexture(src, componentId, callback); | ||
canvasModule.bindImageTexture && canvasModule.bindImageTexture(src,componentId, callback); | ||
}, | ||
@@ -140,14 +163,3 @@ | ||
/** | ||
* 判断是不是浏览器 | ||
* | ||
**/ | ||
isBrowser: function () { | ||
if(!canvasModule||!canvasModule.getDeviceInfo){ | ||
return true | ||
} | ||
}, | ||
/** | ||
* | ||
* 设置context类型,2d或者webgl | ||
@@ -188,3 +200,2 @@ * | ||
resetComponent: function(componentId){ | ||
@@ -197,8 +208,9 @@ GLog.d('bridge#resetComponent(): componentId: ' + componentId); | ||
GLog.d('bridge#exeSyncCmd(): action: ' + action + ',args:' + args); | ||
return canvasModule.execGcanvaSyncCMD(action,args); | ||
return canvasModule.execGcanvaSyncCMD(componentId,action,args); | ||
}, | ||
callExtendCallNative:function(dict){ | ||
return canvasModule && canvasModule.extendCallNative(dict); | ||
return canvasModule && canvasModule.callExtendCallNative && canvasModule.extendCallNative(dict); | ||
}, | ||
texImage2D: function (componentId,target,level,internalformat,format,type,path) { | ||
@@ -211,2 +223,6 @@ GLog.d('bridge#texImage2D(): ' + path); | ||
canvasModule.texSubImage2D && canvasModule.texSubImage2D(componentId,target,level,xoffset,yoffset,format,type,path); | ||
}, | ||
setAlpha: function (componentId,alpha) { | ||
GLog.d('bridge#setAlpha(): ' + alpha); | ||
canvasModule.setAlpha && canvasModule.setAlpha(componentId,alpha); | ||
} | ||
@@ -213,0 +229,0 @@ }; |
138
gwebgl.js
@@ -5,5 +5,7 @@ var GBridge = require("./gutil").GBridge; | ||
var GCanvasImage = require("./gcanvasimage"); | ||
var GTexture = require("./gtexture"); | ||
var GBuffer = require("./gbuffer"); | ||
var GProgram = require("./gprogram"); | ||
/** | ||
@@ -572,3 +574,3 @@ callGCanvasLinkNative中type的定义 | ||
{ | ||
// str = str + array[i] + ','; | ||
// str = str + array[i] + ','; | ||
str = str + array[i].toFixed(3) + ','; | ||
@@ -578,3 +580,3 @@ } | ||
{ | ||
// str = str + array[i]; | ||
// str = str + array[i]; | ||
str = str + array[i].toFixed(3); | ||
@@ -662,3 +664,3 @@ } | ||
if(GBridge.isIOS()) { | ||
if(GBridge.isIOS()) { | ||
var result = GBridge.callExtendCallNative({"className":"WXGCanvasCallNative", "contextId": this.componentId, "type":type}); | ||
@@ -668,4 +670,4 @@ } else{ | ||
G_NeedRender = false; | ||
} | ||
} | ||
} | ||
}; | ||
@@ -680,3 +682,4 @@ | ||
GContextWebGL.prototype.activeTexture = function(texture){ | ||
var cmd = (this.activeTextureId + texture + ";"); | ||
var textureId = texture instanceof GTexture ? texture.textureId : texture; | ||
var cmd = (this.activeTextureId + textureId + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -686,3 +689,4 @@ }; | ||
GContextWebGL.prototype.attachShader = function(program, shader){ | ||
var cmd = (this.attachShaderId + program + "," + shader + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.attachShaderId + programId + "," + shader + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -692,3 +696,4 @@ }; | ||
GContextWebGL.prototype.bindAttribLocation = function(program, index, name){ | ||
var cmd = (this.bindAttribLocationId + program + "," + index + "," + name + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.bindAttribLocationId + programId + "," + index + "," + name + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -698,3 +703,4 @@ }; | ||
GContextWebGL.prototype.bindBuffer = function(target, buffer){ | ||
var cmd = (this.bindBufferId + target + "," + buffer+ ";"); | ||
var bufferId = buffer instanceof GBuffer ? buffer.bufferId : buffer; | ||
var cmd = (this.bindBufferId + target + "," + bufferId+ ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -704,3 +710,4 @@ }; | ||
GContextWebGL.prototype.bindFramebuffer = function(target, framebuffer){ | ||
var cmd = (this.bindFramebufferId + target + "," + framebuffer + ";"); | ||
var framebufferId = framebuffer instanceof GBuffer ? framebuffer.bufferId : framebuffer; | ||
var cmd = (this.bindFramebufferId + target + "," + framebufferId + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -710,3 +717,4 @@ }; | ||
GContextWebGL.prototype.bindRenderbuffer = function(target, renderbuffer){ | ||
var cmd = (this.bindRenderbufferId + target + "," + renderbuffer + ";"); | ||
var renderbufferId = renderbuffer instanceof GBuffer ? renderbuffer.bufferId : renderbuffer; | ||
var cmd = (this.bindRenderbufferId + target + "," + renderbufferId + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -722,3 +730,4 @@ }; | ||
GContextWebGL.prototype.bindTexture = function(target, texture){ | ||
var cmd = (this.bindTextureId + target + "," + texture + ";"); | ||
var textureId = texture instanceof GTexture ? texture.textureId : texture; | ||
var cmd = (this.bindTextureId + target + "," + textureId + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -772,2 +781,5 @@ }; | ||
var cmd = (this.clearColorId + red + "," + green + "," + blue + "," + alpha + ";"); | ||
if(!GBridge.isIOS()) { | ||
GBridge.setAlpha(this.componentId,alpha); | ||
} | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -824,9 +836,13 @@ }; | ||
GContextWebGL.prototype.createBuffer = function(){ | ||
var buffer = new GBuffer(); | ||
var cmd = (this.createBufferId + ";"); | ||
return WebGLCallNative(this.componentId, cmd); | ||
buffer.bufferId = WebGLCallNative(this.componentId, cmd); | ||
return buffer; | ||
}; | ||
GContextWebGL.prototype.createFramebuffer = function(){ | ||
var buffer = new GBuffer(); | ||
var cmd = (this.createFramebufferId + ";"); | ||
return WebGLCallNative(this.componentId, cmd); | ||
buffer.bufferId = WebGLCallNative(this.componentId, cmd); | ||
return buffer; | ||
}; | ||
@@ -836,8 +852,12 @@ | ||
var cmd = (this.createProgramId + ";"); | ||
return WebGLCallNative(this.componentId, cmd); | ||
var program = new GProgram(); | ||
program.programId = WebGLCallNative(this.componentId, cmd); | ||
return program; | ||
}; | ||
GContextWebGL.prototype.createRenderbuffer = function(){ | ||
var buffer = new GBuffer(); | ||
var cmd = (this.createRenderbufferId + ";"); | ||
return WebGLCallNative(this.componentId, cmd); | ||
buffer.bufferId = WebGLCallNative(this.componentId, cmd); | ||
return buffer; | ||
}; | ||
@@ -851,5 +871,7 @@ | ||
GContextWebGL.prototype.createTexture = function() { | ||
var texture = new GTexture(); | ||
var cmd = (this.createTextureId + ";"); | ||
var result = WebGLCallNative(this.componentId, cmd); | ||
return parseInt(result); | ||
texture.textureId = parseInt(result) || result; | ||
return texture; | ||
}; | ||
@@ -863,3 +885,4 @@ | ||
GContextWebGL.prototype.deleteBuffer = function(buffer){ | ||
var cmd = (this.deleteBufferId + buffer + ";"); | ||
var bufferId = buffer instanceof GBuffer ? buffer.bufferId : buffer; | ||
var cmd = (this.deleteBufferId + bufferId + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -869,3 +892,4 @@ }; | ||
GContextWebGL.prototype.deleteFramebuffer = function(framebuffer){ | ||
var cmd = (this.deleteFramebufferId + framebuffer + ";"); | ||
var framebufferId = framebuffer instanceof GBuffer ? framebuffer.bufferId : framebuffer; | ||
var cmd = (this.deleteFramebufferId + framebufferId + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -875,3 +899,4 @@ }; | ||
GContextWebGL.prototype.deleteProgram = function(program){ | ||
var cmd = (this.deleteProgramId + program + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.deleteProgramId + programId + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -881,3 +906,4 @@ }; | ||
GContextWebGL.prototype.deleteRenderbuffer = function(renderbuffer){ | ||
var cmd = (this.deleteRenderbufferId + renderbuffer + ";"); | ||
var renderBufferId = renderbuffer instanceof GBuffer ? renderbuffer.bufferId : renderbuffer; | ||
var cmd = (this.deleteRenderbufferId + renderBufferId + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -892,3 +918,4 @@ }; | ||
GContextWebGL.prototype.deleteTexture = function(texture){ | ||
var cmd = (this.deleteTextureId + texture + ";"); | ||
var textureId = texture instanceof GTexture ? texture.textureId : texture; | ||
var cmd = (this.deleteTextureId + textureId + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -914,3 +941,4 @@ }; | ||
GContextWebGL.prototype.detachShader = function(program, shader){ | ||
var cmd = (this.detachShaderId + program + "," + shader + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.detachShaderId + programId + "," + shader + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -955,3 +983,4 @@ }; | ||
GContextWebGL.prototype.framebufferRenderbuffer = function(target, attachment, renderbuffertarget, renderbuffer){ | ||
var cmd = (this.framebufferRenderbufferId + target + "," + attachment + "," + renderbuffertarget + "," + renderbuffer + ";"); | ||
var renderbufferId = renderbuffer instanceof GBuffer ? renderbuffer.bufferId : renderbuffer; | ||
var cmd = (this.framebufferRenderbufferId + target + "," + attachment + "," + renderbuffertarget + "," + renderbufferId + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -961,3 +990,4 @@ }; | ||
GContextWebGL.prototype.framebufferTexture2D = function(target, attachment, textarget, texture, level){ | ||
var cmd = (this.framebufferTexture2DId + target + "," + attachment + "," + textarget + "," + texture + "," + level + ";"); | ||
var textureId = texture instanceof GTexture ? texture.textureId : texture; | ||
var cmd = (this.framebufferTexture2DId + target + "," + attachment + "," + textarget + "," + textureId + "," + level + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -978,3 +1008,4 @@ }; | ||
GContextWebGL.prototype.getActiveAttrib= function(program, index){ | ||
var cmd = (this.getActiveAttribId + program + "," + index + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.getActiveAttribId + programId + "," + index + ";"); | ||
var resultString = WebGLCallNative(this.componentId, cmd); | ||
@@ -985,3 +1016,4 @@ return GWebGLActiveInfo.convertFormString(resultString); | ||
GContextWebGL.prototype.getActiveUniform= function(program, index){ | ||
var cmd = (this.getActiveUniformId + program + "," + index + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.getActiveUniformId + programId + "," + index + ";"); | ||
var resultString = WebGLCallNative(this.componentId, cmd); | ||
@@ -993,3 +1025,4 @@ return GWebGLActiveInfo.convertFormString(resultString); | ||
GContextWebGL.prototype.getAttachedShaders = function(program){ | ||
var cmd = (this.getAttachedShadersId + program + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.getAttachedShadersId + programId + ";"); | ||
var resultString = WebGLCallNative(this.componentId, cmd); | ||
@@ -1001,3 +1034,4 @@ var resultArray = resultString.split(","); | ||
GContextWebGL.prototype.getAttribLocation = function(program, name) { | ||
var cmd = (this.getAttribLocationId + program + "," + name + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.getAttribLocationId + programId + "," + name + ";"); | ||
return WebGLCallNative(this.componentId, cmd); | ||
@@ -1106,3 +1140,4 @@ }; | ||
GContextWebGL.prototype.getProgramInfoLog = function(program){ | ||
var cmd = (this.getProgramInfoLogId + program + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.getProgramInfoLogId + programId + ";"); | ||
return WebGLCallNative(this.componentId, cmd); | ||
@@ -1112,3 +1147,4 @@ }; | ||
GContextWebGL.prototype.getProgramParameter = function(program, pname){ | ||
var cmd = (this.getProgramParameterId + program + "," + pname + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.getProgramParameterId + programId + "," + pname + ";"); | ||
return WebGLCallNative(this.componentId, cmd); | ||
@@ -1171,3 +1207,4 @@ }; | ||
GContextWebGL.prototype.getUniform = function(program, location){ | ||
var cmd = (this.getUniformId + program + "," + location + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.getUniformId + programId + "," + location + ";"); | ||
var resultString = WebGLCallNative(this.componentId, cmd); | ||
@@ -1178,3 +1215,4 @@ return GetRetrunResultByString(resultString); | ||
GContextWebGL.prototype.getUniformLocation = function(program, name) { | ||
var cmd = (this.getUniformLocationId + program + "," + name + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.getUniformLocationId + programId + "," + name + ";"); | ||
return WebGLCallNative(this.componentId, cmd); | ||
@@ -1213,3 +1251,4 @@ }; | ||
GContextWebGL.prototype.isBuffer = function(buffer) { | ||
var cmd = (this.isBufferId + buffer + ";"); | ||
var bufferId = buffer instanceof GBuffer ? buffer.bufferId : buffer; | ||
var cmd = (this.isBufferId + bufferId + ";"); | ||
return WebGLCallNative(this.componentId, cmd); | ||
@@ -1231,3 +1270,4 @@ }; | ||
GContextWebGL.prototype.isFramebuffer = function(framebuffer) { | ||
var cmd = (this.isFramebufferId + framebuffer + ";"); | ||
var framebufferId = framebuffer instanceof GBuffer ? framebuffer.bufferId : framebuffer; | ||
var cmd = (this.isFramebufferId + framebufferId + ";"); | ||
return WebGLCallNative(this.componentId, cmd); | ||
@@ -1238,3 +1278,4 @@ }; | ||
GContextWebGL.prototype.isProgram = function(program) { | ||
var cmd = (this.isProgramId + program + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.isProgramId + programId + ";"); | ||
return WebGLCallNative(this.componentId, cmd); | ||
@@ -1245,3 +1286,4 @@ }; | ||
GContextWebGL.prototype.isRenderbuffer = function(renderbuffer) { | ||
var cmd = (this.isRenderbufferId + renderbuffer + ";"); | ||
var renderbufferId = renderbuffer instanceof GBuffer ? renderbuffer.bufferId : renderbuffer; | ||
var cmd = (this.isRenderbufferId + renderbufferId + ";"); | ||
return WebGLCallNative(this.componentId, cmd); | ||
@@ -1258,3 +1300,4 @@ }; | ||
GContextWebGL.prototype.isTexture = function(texture) { | ||
var cmd = (this.isTextureId + texture + ";"); | ||
var textureId = texture instanceof GTexture ? texture.textureId : texture; | ||
var cmd = (this.isTextureId + textureId + ";"); | ||
return WebGLCallNative(this.componentId, cmd); | ||
@@ -1269,3 +1312,4 @@ }; | ||
GContextWebGL.prototype.linkProgram = function(program){ | ||
var cmd = (this.linkProgramId + program + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.linkProgramId + programId + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -1377,5 +1421,5 @@ }; | ||
format + "," + type + "," + imageData.src + ";"); | ||
if(!GBridge.isIOS()) { | ||
GBridge.texImage2D(this.componentId,target, level, internalformat, format,type, imageData.src); | ||
} else { | ||
if(!GBridge.isIOS()) { | ||
GBridge.texImage2D(this.componentId,target, level, internalformat, format,type, imageData.src); | ||
} else { | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -1427,4 +1471,4 @@ } | ||
if(!GBridge.isIOS()) { | ||
GBridge.texSubImage2D(this.componentId,target, level, xoffset,yoffset,format,type, imageData.src); | ||
}else { | ||
GBridge.texSubImage2D(this.componentId,target, level, xoffset,yoffset,format,type, imageData.src); | ||
}else { | ||
var cmd = (this.texSubImage2DId + argc + "," + target + "," + level + "," + xoffset + "," + | ||
@@ -1563,3 +1607,4 @@ yoffset + "," + type + "," + imageData.src + ";"); | ||
GContextWebGL.prototype.useProgram = function(program){ | ||
var cmd = (this.useProgramId + program + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.useProgramId + programId + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -1569,3 +1614,4 @@ }; | ||
GContextWebGL.prototype.validateProgram = function(program){ | ||
var cmd = (this.validateProgramId + program + ";"); | ||
var programId = program instanceof GProgram ? program.programId : program; | ||
var cmd = (this.validateProgramId + programId + ";"); | ||
WebGLCallNative(this.componentId, cmd); | ||
@@ -1572,0 +1618,0 @@ }; |
{ | ||
"name": "weex-gcanvas", | ||
"version": "0.5.8", | ||
"version": "0.5.9", | ||
"main":"gcanvas.js", | ||
@@ -5,0 +5,0 @@ "platform": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
164146
14
4482