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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « sky/sdk/lib/framework/fn2.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import 'dart:typed_data'; 7 import 'dart:typed_data';
8 import 'object.dart'; 8 import 'object.dart';
9 import '../painting/shadows.dart'; 9 import '../painting/shadows.dart';
10 import 'package:vector_math/vector_math.dart'; 10 import 'package:vector_math/vector_math.dart';
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 void performLayout() { 432 void performLayout() {
433 if (child != null) { 433 if (child != null) {
434 child.layout(_getInnerConstraints(constraints)); 434 child.layout(_getInnerConstraints(constraints));
435 size = child.size; 435 size = child.size;
436 } else { 436 } else {
437 performResize(); 437 performResize();
438 } 438 }
439 } 439 }
440 } 440 }
441 441
442 class RenderOpacity extends RenderProxyBox {
443 RenderOpacity({ RenderBox child, double opacity })
444 : this._opacity = opacity, super(child) {
445 assert(opacity >= 0.0 && opacity <= 1.0);
446 }
447
448 double _opacity;
449 double get opacity => _opacity;
450 void set opacity (double value) {
451 assert(value != null);
452 assert(value >= 0.0 && value <= 1.0);
453 if (_opacity == value)
454 return;
455 _opacity = value;
456 markNeedsPaint();
457 }
458
459 void paint(RenderObjectDisplayList canvas) {
460 if (child != null) {
461 if (_opacity == 0.0)
462 return;
463
464 if (_opacity == 1.0) {
465 child.paint(canvas);
466 return;
467 }
468
469 Paint paint = new Paint()
470 ..color = new Color.fromARGB((_opacity * 255).floor(), 0, 0, 0);
471 ..setTransferMode(sky.TransferMode.srcOverMode);
472 canvas.saveLayer(null, paint);
473 child.paint(canvas);
474 canvas.restore();
475 }
476 }
477 }
478
442 class RenderClipRect extends RenderProxyBox { 479 class RenderClipRect extends RenderProxyBox {
443 RenderClipRect({ RenderBox child }) : super(child); 480 RenderClipRect({ RenderBox child }) : super(child);
444 481
445 void paint(RenderObjectDisplayList canvas) { 482 void paint(RenderObjectDisplayList canvas) {
446 if (child != null) { 483 if (child != null) {
447 canvas.save(); 484 canvas.save();
448 canvas.clipRect(new Rect.fromSize(size)); 485 canvas.clipRect(new Rect.fromSize(size));
449 child.paint(canvas); 486 child.paint(canvas);
450 canvas.restore(); 487 canvas.restore();
451 } 488 }
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 1172
1136 void defaultPaint(RenderObjectDisplayList canvas) { 1173 void defaultPaint(RenderObjectDisplayList canvas) {
1137 RenderBox child = firstChild; 1174 RenderBox child = firstChild;
1138 while (child != null) { 1175 while (child != null) {
1139 assert(child.parentData is ParentDataType); 1176 assert(child.parentData is ParentDataType);
1140 canvas.paintChild(child, child.parentData.position); 1177 canvas.paintChild(child, child.parentData.position);
1141 child = child.parentData.nextSibling; 1178 child = child.parentData.nextSibling;
1142 } 1179 }
1143 } 1180 }
1144 } 1181 }
OLDNEW
« 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