Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |