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

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

Issue 1174253003: Make the stocks popup menu fade in (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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/framework/fn2.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/framework/rendering/box.dart
diff --git a/sky/sdk/lib/framework/rendering/box.dart b/sky/sdk/lib/framework/rendering/box.dart
index 6b5d0f0d419cbbfa67b664f69779734f7f36c86f..4482ff04c8c1a621a943e22b31f5ea84e3bd6000 100644
--- a/sky/sdk/lib/framework/rendering/box.dart
+++ b/sky/sdk/lib/framework/rendering/box.dart
@@ -439,6 +439,43 @@ class RenderShrinkWrapWidth extends RenderProxyBox {
}
}
+class RenderOpacity extends RenderProxyBox {
+ RenderOpacity({ RenderBox child, double opacity })
+ : this._opacity = opacity, super(child) {
+ assert(opacity >= 0.0 && opacity <= 1.0);
+ }
+
+ double _opacity;
+ double get opacity => _opacity;
+ void set opacity (double value) {
+ assert(value != null);
+ assert(value >= 0.0 && value <= 1.0);
+ if (_opacity == value)
+ return;
+ _opacity = value;
+ markNeedsPaint();
+ }
+
+ void paint(RenderObjectDisplayList canvas) {
+ if (child != null) {
+ if (_opacity == 0.0)
+ return;
+
+ if (_opacity == 1.0) {
+ child.paint(canvas);
+ return;
+ }
+
+ Paint paint = new Paint()
+ ..color = new Color.fromARGB((_opacity * 255).floor(), 0, 0, 0);
+ ..setTransferMode(sky.TransferMode.srcOverMode);
+ canvas.saveLayer(null, paint);
+ child.paint(canvas);
+ canvas.restore();
+ }
+ }
+}
+
class RenderClipRect extends RenderProxyBox {
RenderClipRect({ RenderBox child }) : super(child);
« no previous file with comments | « sky/sdk/lib/framework/fn2.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698