Improve compositing strategy for Shrine (#5014)

This patch includes a number of improvements:

 * Material page routes now put a repaint boundary inside their transition so
   they don't repaint during the transition.
 * Heroes that are on a quest now get a repaint boundary so we repaint them
   individually.
 * I've hoisted the transparent material for the product items up in the widget
   tree, which doesn't affect performance but makes the ink splashes reach the
   edge of the product cards.
 * I've changed the repaint rainbow visualization to make it easier to see
   what's going on.
This commit is contained in:
Adam Barth
2016-07-22 14:09:48 -07:00
committed by GitHub
parent 1a292ff66a
commit 39e759212f
4 changed files with 38 additions and 34 deletions

View File

@@ -173,8 +173,13 @@ class PaintingContext {
if (!_isRecording)
return;
assert(() {
if (debugRepaintRainbowEnabled)
canvas.drawRect(_paintBounds, new Paint()..color = debugCurrentRepaintColor.toColor());
if (debugRepaintRainbowEnabled) {
Paint paint = new Paint()
..style = PaintingStyle.stroke
..strokeWidth = 6.0
..color = debugCurrentRepaintColor.toColor();
canvas.drawRect(_paintBounds.deflate(3.0), paint);
}
if (debugPaintLayerBordersEnabled) {
Paint paint = new Paint()
..style = PaintingStyle.stroke

View File

@@ -272,7 +272,7 @@ class _HeroQuestState implements HeroHandle {
size: animationArea.size,
child: new RotationTransition(
turns: currentTurns.animate(animation),
child: new KeyedSubtree(
child: new RepaintBoundary(
key: key,
child: child
)

View File

@@ -426,15 +426,14 @@ class _ModalScopeState extends State<_ModalScope> {
context,
config.route.animation,
config.route.forwardAnimation,
contents
new RepaintBoundary(child: contents)
)
);
}
contents = new Focus(
return new Focus(
key: config.route.focusKey,
child: new RepaintBoundary(child: contents)
child: contents
);
return contents;
}
}