| 11724 | //class laya.renders.RenderContext |
| 11725 | var RenderContext=(function(){ |
| 11726 | function RenderContext(width,height,canvas){ |
| 11727 | /**全局x坐标 */ |
| 11728 | this.x=0; |
| 11729 | /**全局y坐标 */ |
| 11730 | this.y=0; |
| 11731 | /**当前使用的画布 */ |
| 11732 | //this.canvas=null; |
| 11733 | /**当前使用的画布上下文 */ |
| 11734 | //this.ctx=null; |
| 11735 | //if (tex._loaded)this.ctx.drawTexture(tex,x,y,width,height,this.x,this.y); |
| 11736 | this._drawTexture=function(x,y,args){} |
| 11737 | this._fillTexture=function(x,y,args){ |
| 11738 | if (args[0]._loaded)this.ctx.fillTexture(args[0],args[1]+x,args[2]+y,args[3],args[4],args[5],args[6],args[7]); |
| 11739 | } |
| 11740 | this._drawTextureWithTransform=function(x,y,args){ |
| 11741 | if (args[0]._loaded)this.ctx.drawTextureWithTransform(args[0],args[1],args[2],args[3],args[4],args[5],x,y,args[6],args[7]); |
| 11742 | } |
| 11743 | this._fillQuadrangle=function(x,y,args){ |
| 11744 | this.ctx.fillQuadrangle(args[0],args[1],args[2],args[3],args[4]); |
| 11745 | } |
| 11746 | //矢量方法 |
| 11747 | this._drawPie=function(x,y,args){ |
| 11748 | var ctx=this.ctx; |
| 11749 | Render.isWebGL && ctx.setPathId(args[8]); |
| 11750 | ctx.beginPath(); |
| 11751 | if (Render.isWebGL){ |
| 11752 | ctx.movePath(args[0]+x,args[1]+y); |
| 11753 | ctx.moveTo(0,0); |
| 11754 | }else { |
| 11755 | ctx.moveTo(x+args[0],y+args[1]); |
| 11756 | } |
| 11757 | ctx.arc(x+args[0],y+args[1],args[2],args[3],args[4]); |
| 11758 | ctx.closePath(); |
| 11759 | this._fillAndStroke(args[5],args[6],args[7],true); |
| 11760 | } |
| 11761 | this._clipRect=function(x,y,args){ |
| 11762 | this.ctx.clipRect(x+args[0],y+args[1],args[2],args[3]); |
| 11763 | } |
| 11764 | this._fillRect=function(x,y,args){ |
| 11765 | this.ctx._drawRect(x+args[0],y+args[1],args[2],args[3],args[4]); |
| 11766 | } |
| 11767 | this._setShader=function(x,y,args){ |
| 11768 | this.ctx.setShader(args[0]); |
| 11769 | } |
| 11770 | this._drawLine=function(x,y,args){ |
| 11771 | var ctx=this.ctx; |
| 11772 | Render.isWebGL && ctx.setPathId(args[6]); |
| 11773 | ctx.beginPath(); |
| 11774 | ctx.strokeStyle=args[4]; |
| 11775 | ctx.lineWidth=args[5]; |
| 11776 | if (Render.isWebGL){ |
| 11777 | ctx.movePath(x,y); |
| 11778 | ctx.moveTo(args[0],args[1]); |
| 11779 | ctx.lineTo(args[2],args[3]); |
| 11780 | }else { |
| 11781 | ctx.moveTo(x+args[0],y+args[1]); |
| 11782 | ctx.lineTo(x+args[2],y+args[3]); |
| 11783 | } |