Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

weex-gcanvas

Package Overview
Dependencies
Maintainers
5
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

weex-gcanvas - npm Package Compare versions

Comparing version 0.5.16 to 0.5.18

1

gcanvas.js

@@ -218,3 +218,2 @@ /**

GCanvas.prototype.render = function(){
GLog.d("gcanvas.render");
if(GCanvasPlatform !== 0 && this.context)

@@ -221,0 +220,0 @@ {

66

gcontext2d.js

@@ -92,3 +92,3 @@ var GBridge = require("./gutil").GBridge;

this._globalAlpha = value;
this._drawCommands = this._drawCommands.concat("a" + value.toFixed(6)
this._drawCommands = this._drawCommands.concat("a" + value.toFixed(2)
+ ";");

@@ -145,4 +145,4 @@ // }

else if (value instanceof FillStyleRadialGradient) {
var command = "H" + value._start_pos._x + "," + value._start_pos._y + "," + value._start_pos._r + ","
+ value._end_pos._x + "," + value._end_pos._y + "," + value._end_pos._r + "," + value._stop_count;
var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r + ","
+ value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + value._end_pos._r + "," + value._stop_count;

@@ -530,6 +530,6 @@ for (var i = 0; i < value._stop_count; ++i) {

this._drawCommands = this._drawCommands.concat("t"
+ (a === 1 ? "1" : a.toFixed(6)) + ","
+ (b === 0 ? "0" : b.toFixed(6)) + ","
+ (c === 0 ? "0" : c.toFixed(6)) + ","
+ (d === 1 ? "1" : d.toFixed(6)) + "," + tx + "," + ty + ";");
+ (a === 1 ? "1" : a.toFixed(2)) + ","
+ (b === 0 ? "0" : b.toFixed(2)) + ","
+ (c === 0 ? "0" : c.toFixed(2)) + ","
+ (d === 1 ? "1" : d.toFixed(2)) + "," + tx.toFixed(2) + "," + ty.toFixed(2) + ";");
};

@@ -562,6 +562,6 @@

this._drawCommands = this._drawCommands.concat("f"
+ (a === 1 ? "1" : a.toFixed(6)) + ","
+ (b === 0 ? "0" : b.toFixed(6)) + ","
+ (c === 0 ? "0" : c.toFixed(6)) + ","
+ (d === 1 ? "1" : d.toFixed(6)) + "," + tx + "," + ty + ";");
+ (a === 1 ? "1" : a.toFixed(2)) + ","
+ (b === 0 ? "0" : b.toFixed(2)) + ","
+ (c === 0 ? "0" : c.toFixed(2)) + ","
+ (d === 1 ? "1" : d.toFixed(2)) + "," + tx + "," + ty + ";");
};

@@ -588,4 +588,4 @@

GContext2D.prototype.scale = function(a, d) {
this._drawCommands = this._drawCommands.concat("k" + a.toFixed(6) + ","
+ d.toFixed(6) + ";");
this._drawCommands = this._drawCommands.concat("k" + a.toFixed(2) + ","
+ d.toFixed(2) + ";");
};

@@ -615,3 +615,3 @@

GContext2D.prototype.translate = function(tx, ty) {
this._drawCommands = this._drawCommands.concat("l" + tx + "," + ty + ";");
this._drawCommands = this._drawCommands.concat("l" + tx.toFixed(2) + "," + ty.toFixed(2) + ";");
};

@@ -652,4 +652,4 @@

if(numArgs === 3){
var x = parseFloat(sx) || 0;
var y = parseFloat(sy) || 0;
var x = parseFloat(sx) || 0.0;
var y = parseFloat(sy) || 0.0;

@@ -660,4 +660,4 @@ this._drawCommands += ("d" + imageInfo.id + ",0,0,"

}else if(numArgs === 5){
var x = parseFloat(sx) || 0;
var y = parseFloat(sy) || 0;
var x = parseFloat(sx) || 0.0;
var y = parseFloat(sy) || 0.0;
var width = parseInt(sw) || imageInfo.width;

@@ -670,8 +670,8 @@ var height = parseInt(sh) || imageInfo.height;

}else if(numArgs === 9){
var sx = parseFloat(sx) || 0;
var sy = parseFloat(sy) || 0;
var sx = parseFloat(sx) || 0.0;
var sy = parseFloat(sy) || 0.0;
var sw = parseInt(sw) || imageInfo.width;
var sh = parseInt(sh) || imageInfo.height;
var dx = parseFloat(dx) || 0;
var dy = parseFloat(dy) || 0;
var dx = parseFloat(dx) || 0.0;
var dy = parseFloat(dy) || 0.0;
var dw = parseInt(dw) || imageInfo.width;

@@ -686,3 +686,3 @@ var dh = parseInt(dh) || imageInfo.height;

//-------------------------------------------------

@@ -739,3 +739,3 @@ // iOS bindImageTexture 增加版本检测

var imageCache = this._getImageTexture(cacheKey);
if (imageCache) {

@@ -747,3 +747,3 @@ this._concatDrawCmd(numArgs, image, sx, sy, sw, sh, dx, dy, dw, dh);

if( GBridge.isIOS() )
{
{
if( !that._checkVersionFlag )

@@ -914,9 +914,9 @@ {

GContext2D.prototype.moveTo = function(x, y, successCallback, errorCallback) {
this._drawCommands = this._drawCommands.concat("g" + x.toFixed(6) + ","
+ y.toFixed(6) + ";");
this._drawCommands = this._drawCommands.concat("g" + x.toFixed(2) + ","
+ y.toFixed(2) + ";");
}
GContext2D.prototype.lineTo = function(x, y, successCallback, errorCallback) {
this._drawCommands = this._drawCommands.concat("i" + x.toFixed(6) + ","
+ y.toFixed(6) + ";");
this._drawCommands = this._drawCommands.concat("i" + x.toFixed(2) + ","
+ y.toFixed(2) + ";");
}

@@ -932,4 +932,4 @@

successCallback, errorCallback) {
this._drawCommands = this._drawCommands.concat("z" + cp1x + "," + cp1y
+ "," + cp2x + "," + cp2y + "," + x + "," + y + ";");
this._drawCommands = this._drawCommands.concat("z" + cp1x.toFixed(2) + "," + cp1y.toFixed(2)
+ "," + cp2x.toFixed(2) + "," + cp2y.toFixed(2) + "," + x.toFixed(2) + "," + y.toFixed(2) + ";");
}

@@ -1036,4 +1036,4 @@

this._drawCommands = this._drawCommands.concat("y" + x + "," + y + ","
+ radius + "," + startAngle + "," + endAngle + "," + ianticlockwise
this._drawCommands = this._drawCommands.concat("y" + x.toFixed(2) + "," + y.toFixed(2) + ","
+ radius.toFixed(2) + "," + startAngle + "," + endAngle + "," + ianticlockwise
+ ";");

@@ -1040,0 +1040,0 @@ };

@@ -52,8 +52,10 @@ /////////////////////////////////////////////////////////////////

if(this.isIOS() || this.isBrowser()){
GLog.d('bridge#callrender in iOS');
canvasModule.render && canvasModule.render( commands, componentId );
}else{
if(typeof callGCanvasLinkNative != 'undefined') {
GLog.d('bridge#callRender()');
if(typeof callGCanvasLinkNative !== 'undefined') {
GLog.d('bridge#callGCanvasLinkNative()');
callGCanvasLinkNative(componentId, 0x20000001, commands);
} else {
GLog.d('bridge#callRender()');
canvasModule.render && canvasModule.render( commands, componentId );

@@ -60,0 +62,0 @@ }

@@ -45,3 +45,3 @@ var GBridge = require("./gutil").GBridge;

//GLog.d("WebGLCallNative command: " + cmdArgs);
if(GBridge.isIOS()) {

@@ -51,3 +51,3 @@ var result = GBridge.callExtendCallNative({"contextId": componentId, "type":type, "args":cmdArgs});

{
GLog.d("WebGLCallNative result: " + result["result"]);
GLog.d("WebGLCallNative result: " + result["result"]);
return result["result"];

@@ -73,7 +73,7 @@ }

GInitWebGLEnum(this);
GInitWebGLFuncIdExt(this);
GInitWebGLEnumExt(this);
this.componentId = null;
this.componentId = null;
}

@@ -563,4 +563,8 @@

function GarrToBase64(array)
{
function GarrToBase64(array)
{
if(!array){
return '';
}
var str = '';

@@ -573,3 +577,3 @@ if( array.join === 'function' )

{
for (var i = 0; i < array.length; i++)
for (var i = 0; i < array.length; i++)
{

@@ -603,4 +607,7 @@ if( i < array.length - 1 )

//2 - uint16 array
//4 - uint32 array
//4 - uint32 array
//14 - float32 array
if(!array){
return 2;
}
var bytes = array.BYTES_PER_ELEMENT;

@@ -661,3 +668,3 @@ if( bytes == 4 && (array instanceof Float32Array) )

GContextWebGL.prototype.render = function()
GContextWebGL.prototype.render = function()
{

@@ -667,3 +674,3 @@ if( G_NeedRender )

var type = 0x60000001; //ContextType.ContextWebGL << 30 | MethodType.Sync << 29 | CmdType.Render
if(GBridge.isIOS()) {

@@ -805,3 +812,3 @@ var result = GBridge.callExtendCallNative({"className":"WXGCanvasCallNative", "contextId": this.componentId, "type":type});

GContextWebGL.prototype.compressedTexImage2D = function(target, level, internalformat, width, height, border, array) {
var cmd = (this.compressedTexImage2DId + target + "," + level + "," + internalformat + "," + width + "," +
var cmd = (this.compressedTexImage2DId + target + "," + level + "," + internalformat + "," + width + "," +
height + "," + border + "," + GetArrayType(array) + "," + GarrToBase64(array) + ";");

@@ -813,3 +820,3 @@ WebGLCallNative(this.componentId, cmd);

GContextWebGL.prototype.compressedTexSubImage2D = function(target, level, xoffset, yoffset, width, height, format, array){
var cmd = (this.compressedTexSubImage2DId + target + "," + level + "," + xoffset + "," + yoffset + "," + width + "," +
var cmd = (this.compressedTexSubImage2DId + target + "," + level + "," + xoffset + "," + yoffset + "," + width + "," +
height + "," + format + "," + GetArrayType(array) + "," + GarrToBase64(array) + ";");

@@ -820,3 +827,3 @@ WebGLCallNative(this.componentId, cmd);

GContextWebGL.prototype.copyTexImage2D = function(target, level, internalformat, x, y, width, height, border){
var cmd = (this.copyTexImage2DId + target + "," + level + "," + internalformat + "," + x + "," + y + "," +
var cmd = (this.copyTexImage2DId + target + "," + level + "," + internalformat + "," + x + "," + y + "," +
width + "," + height + "," + border + ";");

@@ -828,3 +835,3 @@ WebGLCallNative(this.componentId, cmd);

GContextWebGL.prototype.copyTexSubImage2D = function(target, level, xoffset, yoffset, x, y, width, height){
var cmd = (this.copyTexSubImage2DId + target + "," + level + "," + xoffset + "," + yoffset + "," + x + "," + y + "," +
var cmd = (this.copyTexSubImage2DId + target + "," + level + "," + xoffset + "," + yoffset + "," + x + "," + y + "," +
width + "," + height + ";");

@@ -1041,3 +1048,3 @@ WebGLCallNative(this.componentId, cmd);

GContextWebGL.prototype.getExtension = function(name)
GContextWebGL.prototype.getExtension = function(name)
{

@@ -1052,3 +1059,3 @@ var ext = null;

ext.vertexAttribDivisorANGLE = gl.vertexAttribDivisorANGLE;
ext.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88FE;

@@ -1243,3 +1250,3 @@ }

//new
//new
GContextWebGL.prototype.isEnabled = function(cap) {

@@ -1250,3 +1257,3 @@ var cmd = (this.isEnabledId + cap + ";");

//new
//new
GContextWebGL.prototype.isFramebuffer = function(framebuffer) {

@@ -1258,3 +1265,3 @@ var framebufferId = framebuffer instanceof GBuffer ? framebuffer.bufferId : framebuffer;

//new
//new
GContextWebGL.prototype.isProgram = function(program) {

@@ -1266,3 +1273,3 @@ var programId = program instanceof GProgram ? program.programId : program;

//new
//new
GContextWebGL.prototype.isRenderbuffer = function(renderbuffer) {

@@ -1274,3 +1281,3 @@ var renderbufferId = renderbuffer instanceof GBuffer ? renderbuffer.bufferId : renderbuffer;

//new
//new
GContextWebGL.prototype.isShader = function(shader) {

@@ -1281,3 +1288,3 @@ var cmd = (this.isShaderId + shader + ";");

//new
//new
GContextWebGL.prototype.isTexture = function(texture) {

@@ -1386,3 +1393,3 @@ var textureId = texture instanceof GTexture ? texture.textureId : texture;

// GLenum format, GLenum type, TexImageSource source); // May throw DOMException
//texImage2D(webgl.TEXTURE_2D, 0, webgl.RGB, webgl.RGB, webgl.UNSIGNED_BYTE, img);
//texImage2D(webgl.TEXTURE_2D, 0, webgl.RGB, webgl.RGB, webgl.UNSIGNED_BYTE, img);
//texImage2D(target, level, internalformat, format, type, img);

@@ -1402,3 +1409,3 @@ //texImage2D(target, level, internalformat, width, height, border, format, type, pixels);

{
var cmd = (this.texImage2DId + argc + "," + target + "," + level + "," + internalformat + "," +
var cmd = (this.texImage2DId + argc + "," + target + "," + level + "," + internalformat + "," +
format + "," + type + "," + imageData.src + ";");

@@ -1409,3 +1416,3 @@ if(!GBridge.isIOS()) {

WebGLCallNative(this.componentId, cmd);
}
}
}

@@ -1422,4 +1429,4 @@ }

var cmd = (this.texImage2DId + argc + "," + target + "," + level + "," + internalformat + "," +
width + "," + height + "," + border + "," + format + "," + type + "," +
var cmd = (this.texImage2DId + argc + "," + target + "," + level + "," + internalformat + "," +
width + "," + height + "," + border + "," + format + "," + type + "," +
GetArrayType(array) + "," + GarrToBase64(array) + ";");

@@ -1458,3 +1465,3 @@ WebGLCallNative(this.componentId, cmd);

}else {
var cmd = (this.texSubImage2DId + argc + "," + target + "," + level + "," + xoffset + "," +
var cmd = (this.texSubImage2DId + argc + "," + target + "," + level + "," + xoffset + "," +
yoffset + "," + type + "," + imageData.src + ";");

@@ -1473,3 +1480,3 @@ WebGLCallNative(this.componentId, cmd);

var cmd = (this.texSubImage2DId + argc + "," + target + "," + level + "," + xoffset + "," + yoffset + "," +
var cmd = (this.texSubImage2DId + argc + "," + target + "," + level + "," + xoffset + "," + yoffset + "," +
width + "," + height + "," + format + "," + type + "," + GetArrayType(array) + "," + GarrToBase64(array) + ";");

@@ -1661,9 +1668,9 @@ WebGLCallNative(this.componentId, cmd);

// cmd += ";";
// WebGLCallNative(this.componentId, cmd);
// WebGLCallNative(this.componentId, cmd);
// };
GContextWebGL.prototype.vertexAttribPointer = function(index, size, type, normalized, stride, offset){
var cmd = (this.vertexAttribPointerId + index + "," + size + ","+ type + "," + (normalized?1:0) + "," +
var cmd = (this.vertexAttribPointerId + index + "," + size + ","+ type + "," + (normalized?1:0) + "," +
stride + "," + offset + ";");
WebGLCallNative(this.componentId, cmd);
WebGLCallNative(this.componentId, cmd);
};

@@ -1673,3 +1680,3 @@

var cmd = (this.viewportId + x + "," + y + ","+ width + "," + height + ";");
WebGLCallNative(this.componentId, cmd);
WebGLCallNative(this.componentId, cmd);
};

@@ -1686,3 +1693,3 @@

GContextWebGL.prototype.drawArraysInstancedANGLE = function(mode, first, count, primcount) {
var gl = this;
var gl = this;
if( this instanceof GContextWebGLExtension ){

@@ -1692,7 +1699,7 @@ gl = this.gl;

var cmd = (gl.drawArraysInstancedANGLEId + mode + "," + first + "," + count + "," + primcount + ";");
WebGLCallNative(gl.componentId, cmd);
WebGLCallNative(gl.componentId, cmd);
}
GContextWebGL.prototype.drawElementsInstancedANGLE = function(mode, count, type, offset, primcount) {
var gl = this;
var gl = this;
if( this instanceof GContextWebGLExtension ){

@@ -1702,7 +1709,7 @@ gl = this.gl;

var cmd = (gl.drawElementsInstancedANGLEId + mode + "," + count + "," + type + "," + offset + "," + primcount + ";");
WebGLCallNative(gl.componentId, cmd);
WebGLCallNative(gl.componentId, cmd);
}
GContextWebGL.prototype.vertexAttribDivisorANGLE = function(index, divisor) {
var gl = this;
var gl = this;
if( this instanceof GContextWebGLExtension ){

@@ -1712,3 +1719,3 @@ gl = this.gl;

var cmd = (gl.vertexAttribDivisorANGLEId + index + "," + divisor + ";");
WebGLCallNative(gl.componentId, cmd);
WebGLCallNative(gl.componentId, cmd);
}

@@ -1718,3 +1725,3 @@

GContextWebGL.prototype.deleteVertexArrayOES = function(array) {
var gl = this;
var gl = this;
if( this instanceof GContextWebGLExtension ){

@@ -1724,7 +1731,7 @@ gl = this.gl;

var cmd = (gl.deleteVertexArrayOESId + array + ";");
WebGLCallNative(gl.componentId, cmd);
WebGLCallNative(gl.componentId, cmd);
};
GContextWebGL.prototype.createVertexArrayOES = function() {
var gl = this;
var gl = this;
if( this instanceof GContextWebGLExtension ){

@@ -1734,7 +1741,7 @@ gl = this.gl;

var cmd = (gl.createVertexArrayOESId + ";");
return WebGLCallNative(gl.componentId, cmd);
return WebGLCallNative(gl.componentId, cmd);
};
GContextWebGL.prototype.isVertexArrayOES = function(array) {
var gl = this;
var gl = this;
if( this instanceof GContextWebGLExtension ){

@@ -1744,7 +1751,7 @@ gl = this.gl;

var cmd = (gl.isVertexArrayOESId + array + ";")
return WebGLCallNative(gl.componentId, cmd);
return WebGLCallNative(gl.componentId, cmd);
};
GContextWebGL.prototype.bindVertexArrayOES = function(array) {
var gl = this;
var gl = this;
if( this instanceof GContextWebGLExtension ){

@@ -1754,5 +1761,5 @@ gl = this.gl;

var cmd = (gl.bindVertexArrayOESId + array + ";");
WebGLCallNative(gl.componentId, cmd);
WebGLCallNative(gl.componentId, cmd);
};
module.exports = GContextWebGL;
{
"name": "weex-gcanvas",
"version": "0.5.16",
"version": "0.5.18",
"main":"gcanvas.js",

@@ -5,0 +5,0 @@ "platform": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc