| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:math' as math; | 5 import 'dart:math' as math; |
| 6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
| 7 | 7 |
| 8 import 'package:vector_math/vector_math.dart'; | 8 import 'package:vector_math/vector_math.dart'; |
| 9 | 9 |
| 10 import '../base/debug.dart'; | 10 import '../base/debug.dart'; |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 assert(RenderObject.debugDoingLayout); | 423 assert(RenderObject.debugDoingLayout); |
| 424 assert((sizedByParent && debugDoingThisResize) || | 424 assert((sizedByParent && debugDoingThisResize) || |
| 425 (!sizedByParent && debugDoingThisLayout)); | 425 (!sizedByParent && debugDoingThisLayout)); |
| 426 if (value is _DebugSize) { | 426 if (value is _DebugSize) { |
| 427 assert(value._canBeUsedByParent); | 427 assert(value._canBeUsedByParent); |
| 428 assert(value._owner.parent == this); | 428 assert(value._owner.parent == this); |
| 429 } | 429 } |
| 430 _size = inDebugBuild ? new _DebugSize(value, this, debugCanParentUseSize) :
value; | 430 _size = inDebugBuild ? new _DebugSize(value, this, debugCanParentUseSize) :
value; |
| 431 } | 431 } |
| 432 | 432 |
| 433 Rect get paintBounds => Point.origin & size; |
| 434 |
| 433 String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(
prefix)}${prefix}size: ${size}\n'; | 435 String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(
prefix)}${prefix}size: ${size}\n'; |
| 434 } | 436 } |
| 435 | 437 |
| 436 class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<RenderBox
> { | 438 class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<RenderBox
> { |
| 437 | 439 |
| 438 // ProxyBox assumes the child will be at 0,0 and will have the same size | 440 // ProxyBox assumes the child will be at 0,0 and will have the same size |
| 439 | 441 |
| 440 RenderProxyBox([RenderBox child = null]) { | 442 RenderProxyBox([RenderBox child = null]) { |
| 441 this.child = child; | 443 this.child = child; |
| 442 } | 444 } |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 class ViewConstraints { | 1295 class ViewConstraints { |
| 1294 const ViewConstraints({ | 1296 const ViewConstraints({ |
| 1295 this.size: Size.zero, | 1297 this.size: Size.zero, |
| 1296 this.orientation | 1298 this.orientation |
| 1297 }); | 1299 }); |
| 1298 final Size size; | 1300 final Size size; |
| 1299 final int orientation; | 1301 final int orientation; |
| 1300 } | 1302 } |
| 1301 | 1303 |
| 1302 class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
{ | 1304 class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
{ |
| 1305 bool get createNewDisplayList => true; |
| 1303 | 1306 |
| 1304 RenderView({ | 1307 RenderView({ |
| 1305 RenderBox child, | 1308 RenderBox child, |
| 1306 this.timeForRotation: const Duration(microseconds: 83333) | 1309 this.timeForRotation: const Duration(microseconds: 83333) |
| 1307 }) { | 1310 }) { |
| 1308 this.child = child; | 1311 this.child = child; |
| 1309 } | 1312 } |
| 1310 | 1313 |
| 1311 Size _size = Size.zero; | 1314 Size _size = Size.zero; |
| 1312 Size get size => _size; | 1315 Size get size => _size; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 return true; | 1362 return true; |
| 1360 } | 1363 } |
| 1361 | 1364 |
| 1362 void paint(PaintingCanvas canvas, Offset offset) { | 1365 void paint(PaintingCanvas canvas, Offset offset) { |
| 1363 if (child != null) | 1366 if (child != null) |
| 1364 canvas.paintChild(child, offset.toPoint()); | 1367 canvas.paintChild(child, offset.toPoint()); |
| 1365 } | 1368 } |
| 1366 | 1369 |
| 1367 void paintFrame() { | 1370 void paintFrame() { |
| 1368 sky.tracing.begin('RenderView.paintFrame'); | 1371 sky.tracing.begin('RenderView.paintFrame'); |
| 1369 RenderObject.debugDoingPaint = true; | |
| 1370 try { | 1372 try { |
| 1371 sky.PictureRecorder recorder = new sky.PictureRecorder(); | 1373 sky.PictureRecorder recorder = new sky.PictureRecorder(); |
| 1372 PaintingCanvas canvas = new PaintingCanvas(recorder, _size); | 1374 PaintingCanvas canvas = new PaintingCanvas(recorder, paintBounds); |
| 1373 paint(canvas, Offset.zero); | 1375 canvas.drawPaintingNode(paintingNode, Point.origin); |
| 1374 sky.view.picture = recorder.endRecording(); | 1376 sky.view.picture = recorder.endRecording(); |
| 1375 } finally { | 1377 } finally { |
| 1376 RenderObject.debugDoingPaint = false; | |
| 1377 sky.tracing.end('RenderView.paintFrame'); | 1378 sky.tracing.end('RenderView.paintFrame'); |
| 1378 } | 1379 } |
| 1379 } | 1380 } |
| 1380 | 1381 |
| 1382 Rect get paintBounds => Point.origin & size; |
| 1381 } | 1383 } |
| 1382 | 1384 |
| 1383 // HELPER METHODS FOR RENDERBOX CONTAINERS | 1385 // HELPER METHODS FOR RENDERBOX CONTAINERS |
| 1384 abstract class RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, Pare
ntDataType extends ContainerParentDataMixin<ChildType>> implements ContainerRend
erObjectMixin<ChildType, ParentDataType> { | 1386 abstract class RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, Pare
ntDataType extends ContainerParentDataMixin<ChildType>> implements ContainerRend
erObjectMixin<ChildType, ParentDataType> { |
| 1385 | 1387 |
| 1386 // This class, by convention, doesn't override any members of the superclass. | 1388 // This class, by convention, doesn't override any members of the superclass. |
| 1387 // It only provides helper functions that subclasses can call. | 1389 // It only provides helper functions that subclasses can call. |
| 1388 | 1390 |
| 1389 double defaultComputeDistanceToFirstActualBaseline(TextBaseline baseline) { | 1391 double defaultComputeDistanceToFirstActualBaseline(TextBaseline baseline) { |
| 1390 assert(!needsLayout); | 1392 assert(!needsLayout); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 | 1437 |
| 1436 void defaultPaint(PaintingCanvas canvas, Offset offset) { | 1438 void defaultPaint(PaintingCanvas canvas, Offset offset) { |
| 1437 RenderBox child = firstChild; | 1439 RenderBox child = firstChild; |
| 1438 while (child != null) { | 1440 while (child != null) { |
| 1439 assert(child.parentData is ParentDataType); | 1441 assert(child.parentData is ParentDataType); |
| 1440 canvas.paintChild(child, child.parentData.position + offset); | 1442 canvas.paintChild(child, child.parentData.position + offset); |
| 1441 child = child.parentData.nextSibling; | 1443 child = child.parentData.nextSibling; |
| 1442 } | 1444 } |
| 1443 } | 1445 } |
| 1444 } | 1446 } |
| OLD | NEW |