Add debug painting for layer borders
This patch makes it easier to debug layerization issues.
This commit is contained in:
parent
86da2f9bf4
commit
e0f14e3719
@ -23,6 +23,9 @@ bool debugPaintBaselinesEnabled = false;
|
||||
const sky.Color debugPaintAlphabeticBaselineColor = const sky.Color(0xFF00FF00);
|
||||
const sky.Color debugPaintIdeographicBaselineColor = const sky.Color(0xFFFFD000);
|
||||
|
||||
bool debugPaintLayerBordersEnabled = false;
|
||||
const sky.Color debugPaintLayerBordersColor = const sky.Color(0xFFFF9800);
|
||||
|
||||
bool debugPaintBoundsEnabled = false;
|
||||
|
||||
double timeDilation = 1.0;
|
||||
|
@ -5,6 +5,7 @@
|
||||
import 'dart:sky' as sky;
|
||||
import 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path;
|
||||
|
||||
import 'package:sky/base/debug.dart';
|
||||
import 'package:vector_math/vector_math.dart';
|
||||
|
||||
abstract class Layer {
|
||||
@ -36,9 +37,21 @@ class PictureLayer extends Layer {
|
||||
Size size;
|
||||
sky.Picture picture;
|
||||
|
||||
bool _debugPaintLayerBorder(sky.Canvas canvas) {
|
||||
if (debugPaintLayerBordersEnabled) {
|
||||
Paint border = new Paint()
|
||||
..color = debugPaintLayerBordersColor
|
||||
..strokeWidth = 2.0
|
||||
..setStyle(sky.PaintingStyle.stroke);
|
||||
canvas.drawRect(Point.origin & size, border);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void paint(sky.Canvas canvas) {
|
||||
canvas.translate(offset.dx, offset.dy);
|
||||
canvas.drawPicture(picture);
|
||||
assert(_debugPaintLayerBorder(canvas));
|
||||
canvas.translate(-offset.dx, -offset.dy);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user