Commit dda253bb authored by Hixie's avatar Hixie

Reorder bootstrapping code in rendering/ for slightly cleaner code.

parent cf03afcd
......@@ -394,6 +394,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
void scheduleInitialLayout() {
assert(attached);
assert(parent is! RenderObject);
assert(!_debugDoingLayout);
assert(_relayoutSubtreeRoot == null);
_relayoutSubtreeRoot = this;
assert(() {
......@@ -401,7 +402,6 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
return true;
});
_nodesNeedingLayout.add(this);
scheduler.ensureVisualUpdate();
}
static void flushLayout() {
sky.tracing.begin('RenderObject.flushLayout');
......@@ -648,6 +648,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
assert(parent is! RenderObject);
assert(!_debugDoingPaint);
assert(hasLayer);
assert(_layer == null);
_layer = rootLayer;
assert(_needsPaint);
_nodesNeedingPaint.add(this);
......
......@@ -40,11 +40,10 @@ class SkyBinding {
sky.view.setMetricsChangedCallback(_handleMetricsChanged);
scheduler.init();
if (renderViewOverride == null) {
_renderView = new RenderView(child: root);
_renderView = new RenderView(child: root, devicePixelRatio: sky.view.devicePixelRatio);
_renderView.attach();
_renderView.rootConstraints = _createConstraints();
_renderView.scheduleInitialLayout();
_renderView.initializeLayerTree();
_renderView.scheduleInitialFrame();
} else {
_renderView = renderViewOverride;
}
......
......@@ -4,6 +4,7 @@
import 'dart:sky' as sky;
import 'package:sky/base/scheduler.dart' as scheduler;
import 'package:sky/rendering/layer.dart';
import 'package:sky/rendering/object.dart';
import 'package:sky/rendering/box.dart';
......@@ -21,17 +22,20 @@ class ViewConstraints {
class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox> {
RenderView({
RenderBox child,
this.devicePixelRatio,
this.timeForRotation: const Duration(microseconds: 83333)
}) {
this.child = child;
}
final double devicePixelRatio;
Duration timeForRotation;
Size _size = Size.zero;
Size get size => _size;
int _orientation; // 0..3
int get orientation => _orientation;
Duration timeForRotation;
ViewConstraints _rootConstraints;
ViewConstraints get rootConstraints => _rootConstraints;
......@@ -42,10 +46,11 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
markNeedsLayout();
}
void initializeLayerTree() {
final double devicePixelRatio = sky.view.devicePixelRatio;
void scheduleInitialFrame() {
Matrix4 logicalToDeviceZoom = new Matrix4.diagonal3Values(devicePixelRatio, devicePixelRatio, 1.0);
scheduleInitialLayout();
scheduleInitialPaint(new TransformLayer(transform: logicalToDeviceZoom));
scheduler.ensureVisualUpdate();
}
// We never call layout() on this class, so this should never get
......
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