您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
66 行
1.7 KiB
66 行
1.7 KiB
using System;
|
|
using Unity.UIWidgets.editor;
|
|
using Unity.UIWidgets.ui;
|
|
|
|
namespace Unity.UIWidgets.flow {
|
|
public class CompositorContext {
|
|
public class ScopedFrame : IDisposable {
|
|
readonly CompositorContext _context;
|
|
readonly Canvas _canvas;
|
|
|
|
public ScopedFrame(CompositorContext context, Canvas canvas) {
|
|
this._context = context;
|
|
this._canvas = canvas;
|
|
|
|
this._context._beginFrame(this);
|
|
}
|
|
|
|
public CompositorContext context() {
|
|
return this._context;
|
|
}
|
|
|
|
public Canvas canvas() {
|
|
return this._canvas;
|
|
}
|
|
|
|
public bool raster(LayerTree layerTree, bool ignoreRasterCache) {
|
|
layerTree.preroll(this, ignoreRasterCache);
|
|
layerTree.paint(this);
|
|
return true;
|
|
}
|
|
|
|
public void Dispose() {
|
|
this._context._endFrame(this);
|
|
}
|
|
}
|
|
|
|
readonly RasterCache _rasterCache;
|
|
|
|
public CompositorContext() {
|
|
this._rasterCache = new RasterCache();
|
|
}
|
|
|
|
public ScopedFrame acquireFrame(Canvas canvas) {
|
|
return new ScopedFrame(this, canvas);
|
|
}
|
|
|
|
public void onGrContextCreated() {
|
|
this._rasterCache.clear();
|
|
}
|
|
|
|
public void onGrContextDestroyed() {
|
|
this._rasterCache.clear();
|
|
}
|
|
|
|
public RasterCache rasterCache() {
|
|
return this._rasterCache;
|
|
}
|
|
|
|
void _beginFrame(ScopedFrame frame) {
|
|
}
|
|
|
|
void _endFrame(ScopedFrame frame) {
|
|
this._rasterCache.sweepAfterFrame();
|
|
}
|
|
}
|
|
}
|