/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import e from"../../ViewState.js";import{Container as t}from"../../engine/Container.js";class r extends t{constructor(t){super(),this.layerView=t,this._childrenRenderParameters={context:null,pixelRatio:1,state:new e,stationary:!0,painter:null},this._name=this.constructor.name,this.requestRender=this.requestRender.bind(this)}doRender(e){if(1!==e.drawPhase)return;e.painter.setPipelineState(null);const t=window.devicePixelRatio,{stationary:r,context:i,painter:a,profiler:n}=e,s=this._childrenRenderParameters;s.context=i.gl,s.state.copy(e.state),s.state.pixelRatio=t,s.stationary=r,s.painter=a;const o=this.createRenderParams(e);a.beforeRenderLayer(o,this.clips?255:0,o.globalOpacity),n.recordContainerStart(this._name);const d=i.boundFramebuffer,l=i.getViewport();i.resetState(),i.bindFramebuffer(d),i.setViewport(l.x,l.y,l.width,l.height),this.layerView._renderTarget.framebuffer=d?.glName,this.layerView._renderTarget.viewport[0]=l.x,this.layerView._renderTarget.viewport[1]=l.y,this.layerView._renderTarget.viewport[2]=l.width,this.layerView._renderTarget.viewport[3]=l.height,this.layerView.render(s),i.enforceState(),a.afterRenderLayer(o,o.globalOpacity),n.recordContainerEnd()}createRenderParams(e){return{...e,blendMode:this.blendMode,effects:this.computedEffects,globalOpacity:e.globalOpacity*this.opacity,inFadeTransition:this.inFadeTransition}}}export{r as default};
