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 | 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 void paint(RenderCanvas canvas) { | 549 void paint(RenderCanvas canvas) { |
| 550 if (child != null) { | 550 if (child != null) { |
| 551 canvas.save(); | 551 canvas.save(); |
| 552 canvas.clipRect(new Rect.fromSize(size)); | 552 canvas.clipRect(new Rect.fromSize(size)); |
| 553 child.paint(canvas); | 553 child.paint(canvas); |
| 554 canvas.restore(); | 554 canvas.restore(); |
| 555 } | 555 } |
| 556 } | 556 } |
| 557 } | 557 } |
| 558 | 558 |
| 559 class RenderClipRRect extends RenderProxyBox { | |
| 560 final double xRad; | |
| 561 final double yRad; | |
|
abarth-chromium
2015/06/25 17:11:21
xRadius and yRadius
Please use complete words in
Hixie
2015/06/25 17:16:58
also, constructors first. fields second or with th
| |
| 562 RenderClipRRect({ RenderBox child, this.xRad, this.yRad }) : super(child) { | |
| 563 assert(xRad != null); | |
| 564 assert(yRad != null); | |
| 565 } | |
| 566 | |
| 567 void paint(RenderCanvas canvas) { | |
| 568 if (child != null) { | |
| 569 Rect rect = new Rect.fromSize(size); | |
| 570 canvas.saveLayer(rect, new Paint()); | |
| 571 sky.RRect rrect = new sky.RRect()..setRectXY(rect, xRad, yRad); | |
|
Hixie
2015/06/25 17:16:59
Doesn't RRect() have a suitable constructor?
Inde
| |
| 572 canvas.clipRRect(rrect); | |
|
Hixie
2015/06/25 17:16:59
What's the anti-aliasing story here?
(ok, trick q
| |
| 573 child.paint(canvas); | |
| 574 canvas.restore(); | |
| 575 } | |
| 576 } | |
| 577 } | |
| 578 | |
| 559 class RenderClipOval extends RenderProxyBox { | 579 class RenderClipOval extends RenderProxyBox { |
| 560 RenderClipOval({ RenderBox child }) : super(child); | 580 RenderClipOval({ RenderBox child }) : super(child); |
| 561 | 581 |
| 562 void paint(RenderCanvas canvas) { | 582 void paint(RenderCanvas canvas) { |
| 563 if (child != null) { | 583 if (child != null) { |
| 564 Rect rect = new Rect.fromSize(size); | 584 Rect rect = new Rect.fromSize(size); |
| 565 canvas.saveLayer(rect, new Paint()); | 585 canvas.saveLayer(rect, new Paint()); |
| 566 Path path = new Path(); | 586 Path path = new Path(); |
| 567 path.addOval(rect); | 587 path.addOval(rect); |
| 568 canvas.clipPath(path); | 588 canvas.clipPath(path); |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1106 | 1126 |
| 1107 void defaultPaint(RenderCanvas canvas) { | 1127 void defaultPaint(RenderCanvas canvas) { |
| 1108 RenderBox child = firstChild; | 1128 RenderBox child = firstChild; |
| 1109 while (child != null) { | 1129 while (child != null) { |
| 1110 assert(child.parentData is ParentDataType); | 1130 assert(child.parentData is ParentDataType); |
| 1111 canvas.paintChild(child, child.parentData.position); | 1131 canvas.paintChild(child, child.parentData.position); |
| 1112 child = child.parentData.nextSibling; | 1132 child = child.parentData.nextSibling; |
| 1113 } | 1133 } |
| 1114 } | 1134 } |
| 1115 } | 1135 } |
| OLD | NEW |