您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
58 行
2.3 KiB
58 行
2.3 KiB
using Unity.UIWidgets.foundation;
|
|
using Unity.UIWidgets.rendering;
|
|
|
|
namespace Unity.UIWidgets.widgets {
|
|
public class PerformanceOverlay : LeafRenderObjectWidget {
|
|
public PerformanceOverlay(
|
|
Key key = null,
|
|
int optionsMask = 0,
|
|
int rasterizerThreshold = 0,
|
|
bool checkerboardRasterCacheImages = false,
|
|
bool checkerboardOffscreenLayers = false
|
|
|
|
) : base(key: key) {
|
|
this.optionsMask = optionsMask;
|
|
this.rasterizerThreshold = rasterizerThreshold;
|
|
this.checkerboardOffscreenLayers = checkerboardOffscreenLayers;
|
|
this.checkerboardRasterCacheImages = checkerboardRasterCacheImages;
|
|
}
|
|
|
|
public readonly int optionsMask;
|
|
public readonly int rasterizerThreshold;
|
|
public readonly bool checkerboardRasterCacheImages;
|
|
public readonly bool checkerboardOffscreenLayers;
|
|
|
|
|
|
|
|
public static PerformanceOverlay allEnabled(
|
|
Key key = null,
|
|
int rasterizerThreshold = 0,
|
|
bool checkerboardRasterCacheImages = false,
|
|
bool checkerboardOffscreenLayers = false
|
|
) {
|
|
|
|
return new PerformanceOverlay(
|
|
optionsMask :
|
|
1 << (int) PerformanceOverlayOption.displayRasterizerStatistics |
|
|
1 << (int) PerformanceOverlayOption.visualizeRasterizerStatistics |
|
|
1 << (int) PerformanceOverlayOption.displayEngineStatistics |
|
|
1 << (int) PerformanceOverlayOption.visualizeEngineStatistics
|
|
);
|
|
}
|
|
|
|
public override RenderObject createRenderObject(BuildContext context) {
|
|
return new RenderPerformanceOverlay(
|
|
optionsMask: optionsMask,
|
|
rasterizerThreshold: rasterizerThreshold,
|
|
checkerboardRasterCacheImages: checkerboardRasterCacheImages,
|
|
checkerboardOffscreenLayers: checkerboardOffscreenLayers
|
|
);
|
|
}
|
|
|
|
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
|
|
RenderPerformanceOverlay _renderObject = (RenderPerformanceOverlay) renderObject;
|
|
_renderObject.optionsMask = optionsMask;
|
|
_renderObject.rasterizerThreshold = rasterizerThreshold;
|
|
}
|
|
}
|
|
}
|