Commit d2ca2f26 authored by Adam Barth's avatar Adam Barth

Merge pull request #712 from abarth/rm_paint_frame

Remove RenderView.paintFrame
parents 58296881 077e75e8
......@@ -169,6 +169,19 @@ class ContainerLayer extends Layer {
child._parent = null;
}
void removeAllChildren() {
Layer child = _firstChild;
while (child != null) {
Layer next = child.nextSibling;
child._previousSibling = null;
child._nextSibling = null;
child._parent = null;
child = next;
}
_firstChild = null;
_lastChild = null;
}
void paint(sky.Canvas canvas) {
canvas.translate(offset.dx, offset.dy);
paintChildren(canvas);
......
......@@ -51,13 +51,6 @@ class PaintingContext {
_startRecording(paintBounds);
}
factory PaintingContext.replacingLayer(ContainerLayer oldLayer, Rect paintBounds) {
PaintingContext newContext = new PaintingContext.withOffset(oldLayer.offset, paintBounds);
if (oldLayer.parent != null)
oldLayer.replaceWith(newContext._containerLayer);
return newContext;
}
PaintingContext.forTesting(this._canvas);
ContainerLayer _containerLayer;
......@@ -650,21 +643,20 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
sky.tracing.end('RenderObject.flushPaint');
}
}
void initialPaint(ContainerLayer rootLayer, Size size) {
void scheduleInitialPaint(ContainerLayer rootLayer) {
assert(attached);
assert(parent is! RenderObject);
assert(!_debugDoingPaint);
assert(hasLayer);
PaintingContext newContext = new PaintingContext.withLayer(rootLayer, Point.origin & size);
_paintLayer(newContext);
_layer = rootLayer;
assert(_needsPaint);
_nodesNeedingPaint.add(this);
}
void _repaint() {
assert(hasLayer);
assert(_layer != null);
PaintingContext newContext = new PaintingContext.replacingLayer(_layer, paintBounds);
_paintLayer(newContext);
}
void _paintLayer(PaintingContext context) {
_layer.removeAllChildren();
PaintingContext context = new PaintingContext.withLayer(_layer, paintBounds);
_layer = context._containerLayer;
try {
_paintWithContext(context, Offset.zero);
......
......@@ -44,6 +44,7 @@ class SkyBinding {
_renderView.attach();
_renderView.rootConstraints = _createConstraints();
_renderView.scheduleInitialLayout();
_renderView.initializeLayerTree();
} else {
_renderView = renderViewOverride;
}
......@@ -74,7 +75,6 @@ class SkyBinding {
RenderObject.flushLayout();
_renderView.updateCompositingBits();
RenderObject.flushPaint();
_renderView.paintFrame();
_renderView.compositeFrame();
}
......
......@@ -42,6 +42,12 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
markNeedsLayout();
}
void initializeLayerTree() {
final double devicePixelRatio = sky.view.devicePixelRatio;
Matrix4 logicalToDeviceZoom = new Matrix4.diagonal3Values(devicePixelRatio, devicePixelRatio, 1.0);
scheduleInitialPaint(new TransformLayer(transform: logicalToDeviceZoom));
}
// We never call layout() on this class, so this should never get
// checked. (This class is laid out using scheduleInitialLayout().)
bool debugDoesMeetConstraints() { assert(false); return false; }
......@@ -84,18 +90,6 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
context.paintChild(child, offset.toPoint());
}
void paintFrame() {
sky.tracing.begin('RenderView.paintFrame');
try {
final double devicePixelRatio = sky.view.devicePixelRatio;
Matrix4 logicalToDeviceZoom = new Matrix4.diagonal3Values(devicePixelRatio, devicePixelRatio, 1.0);
ContainerLayer rootLayer = new TransformLayer(transform: logicalToDeviceZoom);
initialPaint(rootLayer, size);
} finally {
sky.tracing.end('RenderView.paintFrame');
}
}
void compositeFrame() {
sky.tracing.begin('RenderView.compositeFrame');
try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment