diff --git a/packages/flutter/lib/src/rendering/layer.dart b/packages/flutter/lib/src/rendering/layer.dart index 1e22221d39..efff6c4590 100644 --- a/packages/flutter/lib/src/rendering/layer.dart +++ b/packages/flutter/lib/src/rendering/layer.dart @@ -93,18 +93,22 @@ class StatisticsLayer extends Layer { StatisticsLayer({ Offset offset: Offset.zero, this.paintBounds, - this.optionsMask + this.optionsMask, + this.rasterizerThreshold }) : super(offset: offset); /// The rectangle in this layer's coodinate system that bounds the recording Rect paintBounds; /// A mask specifying the statistics to display - int optionsMask; + final int optionsMask; + + final int rasterizerThreshold; void addToScene(sky.SceneBuilder builder, Offset layerOffset) { assert(optionsMask != null); builder.addStatistics(optionsMask, paintBounds.shift(layerOffset)); + builder.setRasterizerTracingThreshold(rasterizerThreshold); } } diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index 4ebca858aa..66445d2858 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -132,11 +132,12 @@ class PaintingContext { } } - void paintStatistics(int optionsMask, Offset offset, Size size) { + void paintStatistics(int optionsMask, int rasterizerThreshold, Offset offset, Size size) { StatisticsLayer statsLayer = new StatisticsLayer( offset: offset, paintBounds: new Rect.fromLTWH(0.0, 0.0, size.width, size.height), - optionsMask : optionsMask + optionsMask : optionsMask, + rasterizerThreshold : rasterizerThreshold ); _containerLayer.append(statsLayer); } diff --git a/packages/flutter/lib/src/rendering/statistics_box.dart b/packages/flutter/lib/src/rendering/statistics_box.dart index 98780ea889..e4235c7bbb 100644 --- a/packages/flutter/lib/src/rendering/statistics_box.dart +++ b/packages/flutter/lib/src/rendering/statistics_box.dart @@ -7,7 +7,9 @@ import 'package:sky/src/rendering/object.dart'; class StatisticsBox extends RenderBox { - StatisticsBox({int optionsMask: 0}) : _optionsMask = optionsMask; + StatisticsBox({int optionsMask: 0, int rasterizerThreshold: 0}) + : _optionsMask = optionsMask, + _rasterizerThreshold = rasterizerThreshold; int _optionsMask; int get optionsMask => _optionsMask; @@ -19,6 +21,16 @@ class StatisticsBox extends RenderBox { markNeedsPaint(); } + int _rasterizerThreshold; + int get rasterizerThreshold => _rasterizerThreshold; + void set rasterizerThreshold (int threshold) { + if (threshold == _rasterizerThreshold) { + return; + } + _rasterizerThreshold = threshold; + markNeedsPaint(); + } + bool get sizedByParent => true; double getMinIntrinsicWidth(BoxConstraints constraints) { @@ -42,6 +54,6 @@ class StatisticsBox extends RenderBox { } void paint(PaintingContext context, Offset offset) { - context.paintStatistics(optionsMask, offset, size); + context.paintStatistics(optionsMask, rasterizerThreshold, offset, size); } } diff --git a/packages/flutter/lib/src/widgets/statistics_overlay.dart b/packages/flutter/lib/src/widgets/statistics_overlay.dart index e3d62fc556..fbc3ae33f7 100644 --- a/packages/flutter/lib/src/widgets/statistics_overlay.dart +++ b/packages/flutter/lib/src/widgets/statistics_overlay.dart @@ -40,10 +40,10 @@ class StatisticsOverlay extends LeafRenderObjectWidget { /// Create a statistics overlay that only displays specific statistics. The /// mask is created by shifting 1 by the index of the specific StatisticOption /// to enable. - StatisticsOverlay({ this.optionsMask, Key key }) : super(key: key); + StatisticsOverlay({ this.optionsMask, this.rasterizerThreshold: 0, Key key }) : super(key: key); /// Create a statistics overaly that displays all available statistics - StatisticsOverlay.allEnabled({ Key key }) : super(key: key), optionsMask = ( + StatisticsOverlay.allEnabled({ Key key, this.rasterizerThreshold: 0 }) : super(key: key), optionsMask = ( 1 << StatisticsOption.displayRasterizerStatistics.index | 1 << StatisticsOption.visualizeRasterizerStatistics.index | 1 << StatisticsOption.displayEngineStatistics.index | @@ -51,10 +51,15 @@ class StatisticsOverlay extends LeafRenderObjectWidget { ); final int optionsMask; + final int rasterizerThreshold; - StatisticsBox createRenderObject() => new StatisticsBox(optionsMask: optionsMask); + StatisticsBox createRenderObject() => new StatisticsBox( + optionsMask: optionsMask, + rasterizerThreshold: rasterizerThreshold + ); void updateRenderObject(StatisticsBox renderObject, RenderObjectWidget oldWidget) { renderObject.optionsMask = optionsMask; + renderObject.rasterizerThreshold = rasterizerThreshold; } }