| 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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 void paint(RenderCanvas canvas) { | 582 void paint(RenderCanvas canvas) { |
| 583 if (child != null) { | 583 if (child != null) { |
| 584 canvas.save(); | 584 canvas.save(); |
| 585 canvas.clipRect(new Rect.fromSize(size)); | 585 canvas.clipRect(new Rect.fromSize(size)); |
| 586 child.paint(canvas); | 586 child.paint(canvas); |
| 587 canvas.restore(); | 587 canvas.restore(); |
| 588 } | 588 } |
| 589 } | 589 } |
| 590 } | 590 } |
| 591 | 591 |
| 592 class RenderClipRRect extends RenderProxyBox { |
| 593 RenderClipRRect({ RenderBox child, double xRadius, double yRadius }) |
| 594 : _xRadius = xRadius, _yRadius = yRadius, super(child) { |
| 595 assert(_xRadius != null); |
| 596 assert(_yRadius != null); |
| 597 } |
| 598 |
| 599 double _xRadius; |
| 600 double get xRadius => _xRadius; |
| 601 void set xRadius (double value) { |
| 602 assert(value != null); |
| 603 if (_xRadius == value) |
| 604 return; |
| 605 _xRadius = value; |
| 606 markNeedsPaint(); |
| 607 } |
| 608 |
| 609 double _yRadius; |
| 610 double get yRadius => _yRadius; |
| 611 void set yRadius (double value) { |
| 612 assert(value != null); |
| 613 if (_yRadius == value) |
| 614 return; |
| 615 _yRadius = value; |
| 616 markNeedsPaint(); |
| 617 } |
| 618 |
| 619 void paint(RenderCanvas canvas) { |
| 620 if (child != null) { |
| 621 Rect rect = new Rect.fromSize(size); |
| 622 canvas.saveLayer(rect, new Paint()); |
| 623 sky.RRect rrect = new sky.RRect()..setRectXY(rect, xRadius, yRadius); |
| 624 canvas.clipRRect(rrect); |
| 625 child.paint(canvas); |
| 626 canvas.restore(); |
| 627 } |
| 628 } |
| 629 } |
| 630 |
| 592 class RenderClipOval extends RenderProxyBox { | 631 class RenderClipOval extends RenderProxyBox { |
| 593 RenderClipOval({ RenderBox child }) : super(child); | 632 RenderClipOval({ RenderBox child }) : super(child); |
| 594 | 633 |
| 595 void paint(RenderCanvas canvas) { | 634 void paint(RenderCanvas canvas) { |
| 596 if (child != null) { | 635 if (child != null) { |
| 597 Rect rect = new Rect.fromSize(size); | 636 Rect rect = new Rect.fromSize(size); |
| 598 canvas.saveLayer(rect, new Paint()); | 637 canvas.saveLayer(rect, new Paint()); |
| 599 Path path = new Path(); | 638 Path path = new Path(); |
| 600 path.addOval(rect); | 639 path.addOval(rect); |
| 601 canvas.clipPath(path); | 640 canvas.clipPath(path); |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 | 1227 |
| 1189 void defaultPaint(RenderCanvas canvas) { | 1228 void defaultPaint(RenderCanvas canvas) { |
| 1190 RenderBox child = firstChild; | 1229 RenderBox child = firstChild; |
| 1191 while (child != null) { | 1230 while (child != null) { |
| 1192 assert(child.parentData is ParentDataType); | 1231 assert(child.parentData is ParentDataType); |
| 1193 canvas.paintChild(child, child.parentData.position); | 1232 canvas.paintChild(child, child.parentData.position); |
| 1194 child = child.parentData.nextSibling; | 1233 child = child.parentData.nextSibling; |
| 1195 } | 1234 } |
| 1196 } | 1235 } |
| 1197 } | 1236 } |
| OLD | NEW |