<commit_before>package flash.__native 
{
	import flash.display.BitmapData;
	import flash.display.BlendMode;
	import flash.display.GraphicsPath;
	import flash.display.Stage;
	import flash.display3D.Context3D;
	import flash.display3D.Context3DBlendFactor;
	import flash.display3D.Context3DProgramType;
	import flash.display3D.Context3DTextureFormat;
	import flash.display3D.Context3DTriangleFace;
	import flash.display3D.Context3DVertexBufferFormat;
	import flash.display3D.IndexBuffer3D;
	import flash.display3D.Program3D;
	import flash.display3D.VertexBuffer3D;
	import flash.display3D.textures.Texture;
	import flash.display3D.textures.TextureBase;
	import flash.events.Event;
	import flash.geom.ColorTransform;
	import flash.geom.Matrix;
	import flash.geom.Matrix3D;
	import flash.utils.ByteArray;
	/**
	 * ...
	 * @author lizhi http://matrix3d.github.io/
	 */
	public class GLCanvasRenderingContext2D
	{
		public var canvas : HTMLCanvasElement;
		public var fillColor : String;
		public var fillStyle : String;
		public var fillStyleIsImage:Boolean;
		public var font : String;
		public var getLineDash : Object;
		public var globalAlpha : Number=1;
		//public var globalRed : Number=1;
		//public var globalGreen : Number=1;
		//public var globalBlue : Number=1;
		public var colorTransform:ColorTransform;
		public var globalCompositeOperation : String;
		public var lineCap : String;
		public var lineJoin : String;
		public var lineWidth : Number;
		public var miterLimit : Number;
		public var setFillColor : Object;
		public var setLineDash : Object;
		public var setStrokeColor : Object;
		public var shadowBlur : Number;
		public var shadowColor : String;
		public var shadowOffsetX : Number;
		public var shadowOffsetY : Number;
		public var strokeColor : String;
		public var strokeStyle : String;
		public var textAlign : String;
		public var textBaseline : String;
		public var ctx:Context3D;
		public var currentPath:GLPath2D;
		private var text2img:Object = { };
		public var bitmapDrawable:GLDrawable;
		private var bitmapProg:Program3D;
		private var colorProg:Program3D;
		private var matr3d:Matrix3D = new Matrix3D;
		private var uvmatr3d:Matrix3D = new Matrix3D;
		public var matr:Matrix = new Matrix;
		private var matrhelp:Matrix = new Matrix;
		private var stage:Stage;
		public var isBatch:Boolean;
		private var batchs:Array = [];
		private var batchsLen:int = 0;
		private var states:Array = [];
		private var statesPos:int = -1;
		private var posPool:Object = {};
		private var uvPool:Object = {};
		private var colorPool:Object = {};
		private var indexPool:Object = {};
		private var newDrawable:GLDrawable;
		
		private var lastImage:Object;
		private var lastImageIsImage:Object;
		private var numPos:int = 0;
		private var numIndex:int = 0;
		private var updateColor:Boolean = true;
		public function GLCanvasRenderingContext2D(stage:Stage,isBatch:Boolean=false) 
		{
			this.isBatch = isBatch;
			this.stage = stage;
			this.canvas = stage.canvas;
			ctx = new Context3D;
			ctx.canvas = canvas;
			ctx.gl = (canvas.getContext("webgl", {alpha:false,antialias:true}) || canvas.getContext("experimental-webgl", {alpha:false,antialias:true})) as WebGLRenderingContext;
			newDrawable = new GLDrawable(null, null, null,ctx.gl.DYNAMIC_DRAW);
			stage_resize(null);
			ctx.setBlendFactors(Context3DBlendFactor.ONE, Context3DBlendFactor.ONE_MINUS_SOURCE_ALPHA);
			ctx.setCulling(Context3DTriangleFace.NONE);
			
			var posData:Float32Array = new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]);
			var iData:Uint16Array = new Uint16Array([0, 2, 1, 2, 1, 3]);
			bitmapDrawable = new GLDrawable(posData, posData,iData,ctx.gl.STATIC_DRAW);
			
			var vcode:String = 
				"attribute vec2 va0;" +
				"attribute vec4 va1;" +
				"attribute vec2 va2;" +
				"varying vec4 vColor;"+
				"varying vec2 vUV;" +
				"uniform mat4 vc0;"+
				"uniform mat4 vc4;"+
				"void main(void) {" +
					"vColor=va1;"+
					"vUV=(vc4*vec4(va2,0.0,1.0)).xy;"+
					"gl_Position =vc0*vec4(va0, 0.0,1.0);"+
				"}";
			var fcode:String = "precision lowp float;" +
				"varying vec4 vColor;"+
				"varying vec2 vUV;"+
				"uniform sampler2D fs0;"+
			   "void main(void) {" +
					"vec4 c=texture2D(fs0,vUV);" + 
					//"c.xyz*=vColor.a;" + 
					"gl_FragColor = c*vColor;"+
				"}";
			bitmapProg = ctx.createProgram();
			var vb:ByteArray = new ByteArray;
			vb.writeUTFBytes( vcode);
			var fb:ByteArray = new ByteArray;
			fb.writeUTFBytes( fcode);<commit_msg>fixed webgl render color with alpha<commit_after>package flash.__native 
{
	import flash.display.BitmapData;
	import flash.display.BlendMode;
	import flash.display.GraphicsPath;
	import flash.display.Stage;
	import flash.display3D.Context3D;
	import flash.display3D.Context3DBlendFactor;
	import flash.display3D.Context3DProgramType;
	import flash.display3D.Context3DTextureFormat;
	import flash.display3D.Context3DTriangleFace;
	import flash.display3D.Context3DVertexBufferFormat;
	import flash.display3D.IndexBuffer3D;
	import flash.display3D.Program3D;
	import flash.display3D.VertexBuffer3D;
	import flash.display3D.textures.Texture;
	import flash.display3D.textures.TextureBase;
	import flash.events.Event;
	import flash.geom.ColorTransform;
	import flash.geom.Matrix;
	import flash.geom.Matrix3D;
	import flash.utils.ByteArray;
	/**
	 * ...
	 * @author lizhi http://matrix3d.github.io/
	 */
	public class GLCanvasRenderingContext2D
	{
		public var canvas : HTMLCanvasElement;
		public var fillColor : String;
		public var fillStyle : String;
		public var fillStyleIsImage:Boolean;
		public var font : String;
		public var getLineDash : Object;
		public var globalAlpha : Number=1;
		//public var globalRed : Number=1;
		//public var globalGreen : Number=1;
		//public var globalBlue : Number=1;
		public var colorTransform:ColorTransform;
		public var globalCompositeOperation : String;
		public var lineCap : String;
		public var lineJoin : String;
		public var lineWidth : Number;
		public var miterLimit : Number;
		public var setFillColor : Object;
		public var setLineDash : Object;
		public var setStrokeColor : Object;
		public var shadowBlur : Number;
		public var shadowColor : String;
		public var shadowOffsetX : Number;
		public var shadowOffsetY : Number;
		public var strokeColor : String;
		public var strokeStyle : String;
		public var textAlign : String;
		public var textBaseline : String;
		public var ctx:Context3D;
		public var currentPath:GLPath2D;
		private var text2img:Object = { };
		public var bitmapDrawable:GLDrawable;
		private var bitmapProg:Program3D;
		private var colorProg:Program3D;
		private var matr3d:Matrix3D = new Matrix3D;
		private var uvmatr3d:Matrix3D = new Matrix3D;
		public var matr:Matrix = new Matrix;
		private var matrhelp:Matrix = new Matrix;
		private var stage:Stage;
		public var isBatch:Boolean;
		private var batchs:Array = [];
		private var batchsLen:int = 0;
		private var states:Array = [];
		private var statesPos:int = -1;
		private var posPool:Object = {};
		private var uvPool:Object = {};
		private var colorPool:Object = {};
		private var indexPool:Object = {};
		private var newDrawable:GLDrawable;
		
		private var lastImage:Object;
		private var lastImageIsImage:Object;
		private var numPos:int = 0;
		private var numIndex:int = 0;
		private var updateColor:Boolean = true;
		public function GLCanvasRenderingContext2D(stage:Stage,isBatch:Boolean=false) 
		{
			this.isBatch = isBatch;
			this.stage = stage;
			this.canvas = stage.canvas;
			ctx = new Context3D;
			ctx.canvas = canvas;
			ctx.gl = (canvas.getContext("webgl", {alpha:false,antialias:true}) || canvas.getContext("experimental-webgl", {alpha:false,antialias:true})) as WebGLRenderingContext;
			newDrawable = new GLDrawable(null, null, null,ctx.gl.DYNAMIC_DRAW);
			stage_resize(null);
			ctx.setBlendFactors(Context3DBlendFactor.ONE, Context3DBlendFactor.ONE_MINUS_SOURCE_ALPHA);
			ctx.setCulling(Context3DTriangleFace.NONE);
			
			var posData:Float32Array = new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]);
			var iData:Uint16Array = new Uint16Array([0, 2, 1, 2, 1, 3]);
			bitmapDrawable = new GLDrawable(posData, posData,iData,ctx.gl.STATIC_DRAW);
			
			var vcode:String = 
				"attribute vec2 va0;" +
				"attribute vec4 va1;" +
				"attribute vec2 va2;" +
				"varying vec4 vColor;"+
				"varying vec2 vUV;" +
				"uniform mat4 vc0;"+
				"uniform mat4 vc4;"+
				"void main(void) {" +
					"vColor=va1;"+
					"vUV=(vc4*vec4(va2,0.0,1.0)).xy;"+
					"gl_Position =vc0*vec4(va0, 0.0,1.0);"+
				"}";
			var fcode:String = "precision lowp float;" +
				"varying vec4 vColor;"+
				"varying vec2 vUV;"+
				"uniform sampler2D fs0;"+
			   "void main(void) {" +
					"vec4 c=texture2D(fs0,vUV);" + 
					"c.xyz*=vColor.a;" + 
					"gl_FragColor = c*vColor;"+
				"}";
			bitmapProg = ctx.createProgram();
			var vb:ByteArray = new ByteArray;
			vb.writeUTFBytes( vcode);
			var fb:ByteArray = new ByteArray;
			fb.writeUTFBytes( fcode);
{'fraction_non_alphanumeric': 0.10850111856823266, 'fraction_numerical': 0.023042505592841163, 'mean_word_length': 4.290532544378698, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '927897', 'n_tokens_mistral': 3416, 'n_tokens_neox': 3027, 'n_words': 732}