/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import e from"../../../Color.js";import{ManagedCanvas as r}from"./ManagedCanvas.js";import{Stage as s}from"./Stage.js";import t from"./webgl/VideoScreenRenderer.js";class n extends s{constructor(e,s,n){super(null,s={...s,renderFrame:e=>{}},new r(null,{canvas:e})),this._requestRender=n,this.viewIsReady=!1,this.videoScreenRenderer=new t(this,s),this.videoScreenRenderer.visible=!0}requestRender(){this._requestRender()}processRender(r){this.videoScreenRenderer.bind(r),r.backgroundColor=e.fromArray([0,0,0,0]),super.processRender(r),this.videoScreenRenderer.unbind(r)}}class i extends s{constructor(e,r,s){super(e,r={...r,renderFrame:e=>{this.render(e)}},s),this._childStage=new n(s.canvas,r,()=>this.requestRender())}get childStage(){return this._childStage}render(e){this._childStage.viewIsReady?(this._childStage.context.enforceState(),this._childStage.renderFrame(e)):this.requestRender(),this.context.enforceState(),super.renderFrame(e)}processRender(e){super.processRender(e),this._childStage.viewIsReady&&this._childStage.visible&&this._childStage.videoScreenRenderer.processRender(e)}}export{n as ChildStage,i as ParentStage};
