Chromium Code Reviews| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 425 void performLayout() { | 425 void performLayout() { |
| 426 if (child != null) { | 426 if (child != null) { |
| 427 child.layout(_getInnerConstraints(constraints)); | 427 child.layout(_getInnerConstraints(constraints)); |
| 428 size = child.size; | 428 size = child.size; |
| 429 } else { | 429 } else { |
| 430 performResize(); | 430 performResize(); |
| 431 } | 431 } |
| 432 } | 432 } |
| 433 } | 433 } |
| 434 | 434 |
| 435 class RenderClip extends RenderProxyBox { | 435 class RenderClipRect extends RenderProxyBox { |
| 436 RenderClip({ RenderBox child }) : super(child); | 436 RenderClipRect({ RenderBox child }) : super(child); |
| 437 | 437 |
| 438 void paint(RenderObjectDisplayList canvas) { | 438 void paint(RenderObjectDisplayList canvas) { |
| 439 if (child != null) { | 439 if (child != null) { |
| 440 canvas.save(); | 440 canvas.save(); |
| 441 canvas.clipRect(new Rect.fromSize(size)); | 441 canvas.clipRect(new Rect.fromSize(size)); |
| 442 child.paint(canvas); | 442 child.paint(canvas); |
| 443 canvas.restore(); | 443 canvas.restore(); |
| 444 } | 444 } |
| 445 } | 445 } |
| 446 } | 446 } |
| 447 | 447 |
| 448 class RenderClipCircle extends RenderProxyBox { | |
|
Hixie
2015/06/10 22:34:16
Why is this called Circle? It doesn't seem to guar
| |
| 449 RenderClipCircle({ RenderBox child }) : super(child); | |
| 450 | |
| 451 void paint(RenderObjectDisplayList canvas) { | |
| 452 if (child != null) { | |
| 453 canvas.saveLayer(new Rect.fromSize(size), new Paint()); | |
|
abarth-chromium
2015/06/10 22:33:44
new Rect.fromSize(size)
We should use a local var
| |
| 454 Path path = new Path(); | |
| 455 path.addOval(new Rect.fromSize(size)); | |
| 456 canvas.clipPath(path); | |
| 457 child.paint(canvas); | |
| 458 canvas.restore(); | |
| 459 } | |
| 460 } | |
| 461 } | |
| 462 | |
| 448 class RenderPadding extends RenderBox with RenderObjectWithChildMixin<RenderBox> { | 463 class RenderPadding extends RenderBox with RenderObjectWithChildMixin<RenderBox> { |
| 449 | 464 |
| 450 RenderPadding({ EdgeDims padding, RenderBox child }) { | 465 RenderPadding({ EdgeDims padding, RenderBox child }) { |
| 451 assert(padding != null); | 466 assert(padding != null); |
| 452 this.padding = padding; | 467 this.padding = padding; |
| 453 this.child = child; | 468 this.child = child; |
| 454 } | 469 } |
| 455 | 470 |
| 456 EdgeDims _padding; | 471 EdgeDims _padding; |
| 457 EdgeDims get padding => _padding; | 472 EdgeDims get padding => _padding; |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1112 | 1127 |
| 1113 void defaultPaint(RenderObjectDisplayList canvas) { | 1128 void defaultPaint(RenderObjectDisplayList canvas) { |
| 1114 RenderBox child = firstChild; | 1129 RenderBox child = firstChild; |
| 1115 while (child != null) { | 1130 while (child != null) { |
| 1116 assert(child.parentData is ParentDataType); | 1131 assert(child.parentData is ParentDataType); |
| 1117 canvas.paintChild(child, child.parentData.position); | 1132 canvas.paintChild(child, child.parentData.position); |
| 1118 child = child.parentData.nextSibling; | 1133 child = child.parentData.nextSibling; |
| 1119 } | 1134 } |
| 1120 } | 1135 } |
| 1121 } | 1136 } |
| OLD | NEW |