|
|
|
|
|
|
|
|
|
|
readonly SubmitCallback _submitCallback; |
|
|
|
|
|
|
|
int _antiAliasing; |
|
|
|
|
|
|
|
public SurfaceFrame(GrSurface surface, SubmitCallback submitCallback, int antiAliasing = Window.DefaultAntiAliasing) { |
|
|
|
public SurfaceFrame(GrSurface surface, SubmitCallback submitCallback) { |
|
|
|
this._antiAliasing = antiAliasing; |
|
|
|
} |
|
|
|
|
|
|
|
public void Dispose() { |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public Canvas getCanvas() { |
|
|
|
return this._surface != null ? this._surface.getCanvas(this._antiAliasing) : null; |
|
|
|
return this._surface != null ? this._surface.getCanvas() : null; |
|
|
|
} |
|
|
|
|
|
|
|
public bool submit() { |
|
|
|
|
|
|
SurfaceFrame acquireFrame(Size size, float devicePixelRatio); |
|
|
|
|
|
|
|
MeshPool getMeshPool(); |
|
|
|
|
|
|
|
int getAntiAliasing(); |
|
|
|
} |
|
|
|
|
|
|
|
public class EditorWindowSurface : Surface { |
|
|
|
|
|
|
MeshPool _meshPool = new MeshPool(); |
|
|
|
int _antiAliasing; |
|
|
|
|
|
|
|
public int getAntiAliasing() { |
|
|
|
return this._antiAliasing; |
|
|
|
} |
|
|
|
|
|
|
|
public EditorWindowSurface(DrawToTargetFunc drawToTargetFunc = null, int antiAliasing = Window.DefaultAntiAliasing) { |
|
|
|
this._drawToTargetFunc = drawToTargetFunc; |
|
|
|
this._antiAliasing = antiAliasing; |
|
|
|
|
|
|
this._createOrUpdateRenderTexture(size, devicePixelRatio); |
|
|
|
|
|
|
|
return new SurfaceFrame(this._surface, |
|
|
|
(frame, canvas) => this._presentSurface(canvas, this._antiAliasing)); |
|
|
|
(frame, canvas) => this._presentSurface(canvas)); |
|
|
|
} |
|
|
|
|
|
|
|
public MeshPool getMeshPool() { |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected bool _presentSurface(Canvas canvas, int antiAliasing) { |
|
|
|
protected bool _presentSurface(Canvas canvas) { |
|
|
|
this._surface.getCanvas(antiAliasing).flush(); |
|
|
|
this._surface.getCanvas(antiAliasing).reset(); |
|
|
|
this._surface.getCanvas().flush(); |
|
|
|
this._surface.getCanvas().reset(); |
|
|
|
|
|
|
|
var screenRect = new Rect(0, 0, |
|
|
|
this._surface.size.width / this._surface.devicePixelRatio, |
|
|
|
|
|
|
|
|
|
|
CommandBufferCanvas _canvas; |
|
|
|
|
|
|
|
int _antiAliasing; |
|
|
|
|
|
|
|
public int getAntiAliasing() { |
|
|
|
return this._antiAliasing; |
|
|
|
} |
|
|
|
|
|
|
|
public Canvas getCanvas(int antiAliasing) { |
|
|
|
public Canvas getCanvas() { |
|
|
|
this._renderTexture, this.devicePixelRatio, this._meshPool, antiAliasing); |
|
|
|
this._renderTexture, this.devicePixelRatio, this._meshPool, this._antiAliasing); |
|
|
|
public GrSurface(Size size, float devicePixelRatio, MeshPool meshPool, int antiAliasing) { |
|
|
|
public GrSurface(Size size, float devicePixelRatio, MeshPool meshPool, int antiAliasing = Window.DefaultAntiAliasing) { |
|
|
|
this._antiAliasing = antiAliasing; |
|
|
|
|
|
|
|
var desc = new RenderTextureDescriptor( |
|
|
|
(int) this.size.width, (int) this.size.height, |
|
|
|