浏览代码

Cleanup antialising.

/main
Yuncong Zhang 6 年前
当前提交
cf207255
共有 4 个文件被更改,包括 27 次插入19 次删除
  1. 2
      Runtime/editor/editor_window.cs
  2. 4
      Runtime/editor/rasterizer.cs
  3. 34
      Runtime/editor/surface.cs
  4. 6
      Runtime/flow/compositor_context.cs

2
Runtime/editor/editor_window.cs


D.assert(this._surface == null);
this._surface = this.createSurface();
this._rasterizer.setup(this._surface, this.antiAliasing);
this._rasterizer.setup(this._surface);
_windowAdapters.Add(this);
this._alive = true;
}

4
Runtime/editor/rasterizer.cs


this._compositorContext = new CompositorContext();
}
public void setup(Surface surface, int antiAliasing = Window.DefaultAntiAliasing) {
public void setup(Surface surface) {
this._compositorContext.onGrContextCreated(this._surface, antiAliasing);
this._compositorContext.onGrContextCreated(this._surface);
}
public void teardown() {

34
Runtime/editor/surface.cs


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,

6
Runtime/flow/compositor_context.cs


readonly RasterCache _rasterCache;
readonly Stopwatch _frameTime;
int _antiAliasing;
public CompositorContext() {
this._rasterCache = new RasterCache();

return new ScopedFrame(this, canvas, instrumentation_enabled);
}
public void onGrContextCreated(Surface surface, int antiAliasing) {
public void onGrContextCreated(Surface surface) {
this._antiAliasing = antiAliasing;
this._rasterCache.antiAliasing = this._antiAliasing;
this._rasterCache.antiAliasing = surface.getAntiAliasing();
}
public void onGrContextDestroyed() {

正在加载...
取消
保存