Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(599)

Unified Diff: sky/sdk/lib/rendering/box.dart

Issue 1216833003: Make rendering use PaintingNodes for increased efficiency. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix comments I missed Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/sdk/lib/rendering/box.dart
diff --git a/sky/sdk/lib/rendering/box.dart b/sky/sdk/lib/rendering/box.dart
index 78ec1d2c4d75075e52810734de486bb14c51c378..436dbb98a76283f949aec827ed07b2d7d28c327a 100644
--- a/sky/sdk/lib/rendering/box.dart
+++ b/sky/sdk/lib/rendering/box.dart
@@ -430,6 +430,8 @@ abstract class RenderBox extends RenderObject {
_size = inDebugBuild ? new _DebugSize(value, this, debugCanParentUseSize) : value;
}
+ Rect get paintBounds => Point.origin & size;
+
String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(prefix)}${prefix}size: ${size}\n';
}
@@ -489,7 +491,7 @@ class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<RenderBox
void paint(PaintingCanvas canvas, Offset offset) {
if (child != null)
- child.paint(canvas, offset);
+ canvas.paintChild(child, offset.toPoint());
}
}
@@ -662,7 +664,7 @@ class RenderOpacity extends RenderProxyBox {
return;
if (a == 255) {
- child.paint(canvas, offset);
+ canvas.paintChild(child, offset.toPoint());
return;
}
@@ -670,7 +672,7 @@ class RenderOpacity extends RenderProxyBox {
..color = new Color.fromARGB(a, 0, 0, 0)
..setTransferMode(sky.TransferMode.srcOver);
canvas.saveLayer(null, paint);
- child.paint(canvas, offset);
+ canvas.paintChild(child, offset.toPoint());
canvas.restore();
}
}
@@ -706,7 +708,7 @@ class RenderColorFilter extends RenderProxyBox {
Paint paint = new Paint()
..setColorFilter(new sky.ColorFilter.mode(_color, _transferMode));
canvas.saveLayer(null, paint);
- child.paint(canvas, offset);
+ canvas.paintChild(child, offset.toPoint());
canvas.restore();
}
}
@@ -719,7 +721,7 @@ class RenderClipRect extends RenderProxyBox {
if (child != null) {
canvas.save();
canvas.clipRect(offset & size);
- child.paint(canvas, offset);
+ canvas.paintChild(child, offset.toPoint());
canvas.restore();
}
}
@@ -758,7 +760,7 @@ class RenderClipRRect extends RenderProxyBox {
canvas.saveLayer(rect, new Paint());
sky.RRect rrect = new sky.RRect()..setRectXY(rect, xRadius, yRadius);
canvas.clipRRect(rrect);
- child.paint(canvas, offset);
+ canvas.paintChild(child, offset.toPoint());
canvas.restore();
}
}
@@ -774,7 +776,7 @@ class RenderClipOval extends RenderProxyBox {
Path path = new Path();
path.addOval(rect);
canvas.clipPath(path);
- child.paint(canvas, offset);
+ canvas.paintChild(child, offset.toPoint());
canvas.restore();
}
}
@@ -1143,6 +1145,8 @@ class RenderDecoratedBox extends RenderProxyBox {
}
class RenderTransform extends RenderProxyBox {
+ bool get createNewDisplayList => true;
+
RenderTransform({
Matrix4 transform,
RenderBox child
@@ -1286,6 +1290,7 @@ class ViewConstraints {
}
class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox> {
+ bool get createNewDisplayList => true;
RenderView({
RenderBox child,
@@ -1352,18 +1357,17 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
void paintFrame() {
sky.tracing.begin('RenderView.paintFrame');
- RenderObject.debugDoingPaint = true;
try {
sky.PictureRecorder recorder = new sky.PictureRecorder();
- PaintingCanvas canvas = new PaintingCanvas(recorder, _size);
- paint(canvas, Offset.zero);
+ PaintingCanvas canvas = new PaintingCanvas(recorder, paintBounds);
+ canvas.drawPaintingNode(paintingNode, Point.origin);
sky.view.picture = recorder.endRecording();
} finally {
- RenderObject.debugDoingPaint = false;
sky.tracing.end('RenderView.paintFrame');
}
}
+ Rect get paintBounds => Point.origin & size;
}
// HELPER METHODS FOR RENDERBOX CONTAINERS

Powered by Google App Engine
This is Rietveld 408576698