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

Side by Side Diff: sky/sdk/lib/rendering/box.dart

Issue 1188003006: Implement ColorFilter in widgets/basic.dart (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/painting/shadows.dart ('k') | sky/sdk/lib/widgets/basic.dart » ('j') | 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 7
8 import 'package:vector_math/vector_math.dart'; 8 import 'package:vector_math/vector_math.dart';
9 9
10 import '../framework/debug/utils.dart'; 10 import '../framework/debug/utils.dart';
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 if (a == 0) 475 if (a == 0)
476 return; 476 return;
477 477
478 if (a == 255) { 478 if (a == 255) {
479 child.paint(canvas); 479 child.paint(canvas);
480 return; 480 return;
481 } 481 }
482 482
483 Paint paint = new Paint() 483 Paint paint = new Paint()
484 ..color = new Color.fromARGB(a, 0, 0, 0) 484 ..color = new Color.fromARGB(a, 0, 0, 0)
485 ..setTransferMode(sky.TransferMode.srcOverMode); 485 ..setTransferMode(sky.TransferMode.srcOver);
486 canvas.saveLayer(null, paint); 486 canvas.saveLayer(null, paint);
487 child.paint(canvas); 487 child.paint(canvas);
488 canvas.restore(); 488 canvas.restore();
489 }
490 }
491 }
492
493 class RenderColorFilter extends RenderProxyBox {
494 RenderColorFilter({ RenderBox child, Color color, sky.TransferMode transferMod e })
495 : this._color = color, _transferMode = transferMode, super(child) {
Hixie 2015/06/17 23:59:12 you don't need the this.
496 }
497
498 Color _color;
499 Color get color => _color;
500 void set color (Color value) {
501 assert(value != null);
502 if (_color == value)
503 return;
504 _color = value;
505 markNeedsPaint();
506 }
507
508 sky.TransferMode _transferMode;
509 sky.TransferMode get transferMode => _transferMode;
510 void set transferMode (sky.TransferMode value) {
511 assert(value != null);
512 if (_transferMode == value)
513 return;
514 _transferMode = value;
515 markNeedsPaint();
516 }
517
518 void paint(RenderObjectDisplayList canvas) {
519 if (child != null) {
520 Paint paint = new Paint()
521 ..setColorFilter(new sky.ColorFilter.mode(_color, _transferMode));
522 canvas.saveLayer(null, paint);
523 child.paint(canvas);
524 canvas.restore();
489 } 525 }
490 } 526 }
491 } 527 }
492 528
493 class RenderClipRect extends RenderProxyBox { 529 class RenderClipRect extends RenderProxyBox {
494 RenderClipRect({ RenderBox child }) : super(child); 530 RenderClipRect({ RenderBox child }) : super(child);
495 531
496 void paint(RenderObjectDisplayList canvas) { 532 void paint(RenderObjectDisplayList canvas) {
497 if (child != null) { 533 if (child != null) {
498 canvas.save(); 534 canvas.save();
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 1079
1044 void defaultPaint(RenderObjectDisplayList canvas) { 1080 void defaultPaint(RenderObjectDisplayList canvas) {
1045 RenderBox child = firstChild; 1081 RenderBox child = firstChild;
1046 while (child != null) { 1082 while (child != null) {
1047 assert(child.parentData is ParentDataType); 1083 assert(child.parentData is ParentDataType);
1048 canvas.paintChild(child, child.parentData.position); 1084 canvas.paintChild(child, child.parentData.position);
1049 child = child.parentData.nextSibling; 1085 child = child.parentData.nextSibling;
1050 } 1086 }
1051 } 1087 }
1052 } 1088 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/painting/shadows.dart ('k') | sky/sdk/lib/widgets/basic.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698