| 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 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
| 8 import 'object.dart'; | 8 import 'object.dart'; |
| 9 import '../painting/shadows.dart'; | 9 import '../painting/shadows.dart'; |
| 10 import 'package:vector_math/vector_math.dart'; | 10 import 'package:vector_math/vector_math.dart'; |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 void performLayout() { | 432 void performLayout() { |
| 433 if (child != null) { | 433 if (child != null) { |
| 434 child.layout(_getInnerConstraints(constraints)); | 434 child.layout(_getInnerConstraints(constraints)); |
| 435 size = child.size; | 435 size = child.size; |
| 436 } else { | 436 } else { |
| 437 performResize(); | 437 performResize(); |
| 438 } | 438 } |
| 439 } | 439 } |
| 440 } | 440 } |
| 441 | 441 |
| 442 class RenderClip extends RenderProxyBox { | 442 class RenderClipRect extends RenderProxyBox { |
| 443 RenderClip({ RenderBox child }) : super(child); | 443 RenderClipRect({ RenderBox child }) : super(child); |
| 444 | 444 |
| 445 void paint(RenderObjectDisplayList canvas) { | 445 void paint(RenderObjectDisplayList canvas) { |
| 446 if (child != null) { | 446 if (child != null) { |
| 447 canvas.save(); | 447 canvas.save(); |
| 448 canvas.clipRect(new Rect.fromSize(size)); | 448 canvas.clipRect(new Rect.fromSize(size)); |
| 449 child.paint(canvas); | 449 child.paint(canvas); |
| 450 canvas.restore(); | 450 canvas.restore(); |
| 451 } | 451 } |
| 452 } | 452 } |
| 453 } | 453 } |
| 454 | 454 |
| 455 class RenderClipOval extends RenderProxyBox { |
| 456 RenderClipOval({ RenderBox child }) : super(child); |
| 457 |
| 458 void paint(RenderObjectDisplayList canvas) { |
| 459 if (child != null) { |
| 460 Rect rect = new Rect.fromSize(size); |
| 461 canvas.saveLayer(rect, new Paint()); |
| 462 Path path = new Path(); |
| 463 path.addOval(rect); |
| 464 canvas.clipPath(path); |
| 465 child.paint(canvas); |
| 466 canvas.restore(); |
| 467 } |
| 468 } |
| 469 } |
| 470 |
| 455 class RenderPadding extends RenderBox with RenderObjectWithChildMixin<RenderBox>
{ | 471 class RenderPadding extends RenderBox with RenderObjectWithChildMixin<RenderBox>
{ |
| 456 | 472 |
| 457 RenderPadding({ EdgeDims padding, RenderBox child }) { | 473 RenderPadding({ EdgeDims padding, RenderBox child }) { |
| 458 assert(padding != null); | 474 assert(padding != null); |
| 459 this.padding = padding; | 475 this.padding = padding; |
| 460 this.child = child; | 476 this.child = child; |
| 461 } | 477 } |
| 462 | 478 |
| 463 EdgeDims _padding; | 479 EdgeDims _padding; |
| 464 EdgeDims get padding => _padding; | 480 EdgeDims get padding => _padding; |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 | 1135 |
| 1120 void defaultPaint(RenderObjectDisplayList canvas) { | 1136 void defaultPaint(RenderObjectDisplayList canvas) { |
| 1121 RenderBox child = firstChild; | 1137 RenderBox child = firstChild; |
| 1122 while (child != null) { | 1138 while (child != null) { |
| 1123 assert(child.parentData is ParentDataType); | 1139 assert(child.parentData is ParentDataType); |
| 1124 canvas.paintChild(child, child.parentData.position); | 1140 canvas.paintChild(child, child.parentData.position); |
| 1125 child = child.parentData.nextSibling; | 1141 child = child.parentData.nextSibling; |
| 1126 } | 1142 } |
| 1127 } | 1143 } |
| 1128 } | 1144 } |
| OLD | NEW |