Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Unified Diff: sky/sdk/lib/rendering/box.dart

Issue 1206373002: Implement ClipRRect (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: cr feedback Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/sdk/lib/README.md ('k') | sky/sdk/lib/widgets/basic.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/rendering/box.dart
diff --git a/sky/sdk/lib/rendering/box.dart b/sky/sdk/lib/rendering/box.dart
index b5a961340538f3dcc39215d828648c7ab653c0ba..ee439632c1f90baf8c38004539c52d9e74ae4754 100644
--- a/sky/sdk/lib/rendering/box.dart
+++ b/sky/sdk/lib/rendering/box.dart
@@ -589,6 +589,45 @@ class RenderClipRect extends RenderProxyBox {
}
}
+class RenderClipRRect extends RenderProxyBox {
+ RenderClipRRect({ RenderBox child, double xRadius, double yRadius })
+ : _xRadius = xRadius, _yRadius = yRadius, super(child) {
+ assert(_xRadius != null);
+ assert(_yRadius != null);
+ }
+
+ double _xRadius;
+ double get xRadius => _xRadius;
+ void set xRadius (double value) {
+ assert(value != null);
+ if (_xRadius == value)
+ return;
+ _xRadius = value;
+ markNeedsPaint();
+ }
+
+ double _yRadius;
+ double get yRadius => _yRadius;
+ void set yRadius (double value) {
+ assert(value != null);
+ if (_yRadius == value)
+ return;
+ _yRadius = value;
+ markNeedsPaint();
+ }
+
+ void paint(RenderCanvas canvas) {
+ if (child != null) {
+ Rect rect = new Rect.fromSize(size);
+ canvas.saveLayer(rect, new Paint());
+ sky.RRect rrect = new sky.RRect()..setRectXY(rect, xRadius, yRadius);
+ canvas.clipRRect(rrect);
+ child.paint(canvas);
+ canvas.restore();
+ }
+ }
+}
+
class RenderClipOval extends RenderProxyBox {
RenderClipOval({ RenderBox child }) : super(child);
« no previous file with comments | « sky/sdk/lib/README.md ('k') | sky/sdk/lib/widgets/basic.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698