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

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
Index: sky/sdk/lib/rendering/box.dart
diff --git a/sky/sdk/lib/rendering/box.dart b/sky/sdk/lib/rendering/box.dart
index 36d700aee1fdbfdd35f625c4cb84e58403955d24..6e9595ea7005112dc6d2daded45a6b99c0d3dbba 100644
--- a/sky/sdk/lib/rendering/box.dart
+++ b/sky/sdk/lib/rendering/box.dart
@@ -556,6 +556,45 @@ class RenderClipRect extends RenderProxyBox {
}
}
+class RenderClipRRect extends RenderProxyBox {
+ RenderClipRRect({ RenderBox child, double xRadius, double yRadius })
+ : _xRadius = xRadius,_yRadius = yRadius, super(child) {
abarth-chromium 2015/06/25 18:04:12 s/xRadius,_yRadius/xRadius, _yRadius/
+ 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);

Powered by Google App Engine
This is Rietveld 408576698