Commit e28c832a authored by Matt Perry's avatar Matt Perry

Re-land "Add a Color class to dart:sky."

The previous patch broke the sky tests. I have updated the framework to use the new Color class.

R=jackson@google.com

Review URL: https://codereview.chromium.org/1159663003
parent dc9635dd
...@@ -33,7 +33,7 @@ class InkSplash { ...@@ -33,7 +33,7 @@ class InkSplash {
void paint(RenderNodeDisplayList canvas) { void paint(RenderNodeDisplayList canvas) {
int opacity = (_kInitialOpacity * (1.0 - (radius.value / _kTargetSize))).floor(); int opacity = (_kInitialOpacity * (1.0 - (radius.value / _kTargetSize))).floor();
_paint.color = opacity << 24; _paint.color = new sky.Color(opacity << 24);
canvas.drawCircle(position.x, position.y, radius.value, _paint); canvas.drawCircle(position.x, position.y, radius.value, _paint);
} }
} }
...@@ -57,7 +57,7 @@ class InkWell extends RenderBox { ...@@ -57,7 +57,7 @@ class InkWell extends RenderBox {
void paint(RenderNodeDisplayList canvas) { void paint(RenderNodeDisplayList canvas) {
canvas.drawRect(new sky.Rect.fromLTRB(0.0, 0.0, size.width, size.height), canvas.drawRect(new sky.Rect.fromLTRB(0.0, 0.0, size.width, size.height),
new sky.Paint()..color = 0xFFCCCCCC); new sky.Paint()..color = const sky.Color(0xFFCCCCCC));
for (InkSplash splash in _splashes) for (InkSplash splash in _splashes)
splash.paint(canvas); splash.paint(canvas);
} }
......
...@@ -22,7 +22,7 @@ void main() { ...@@ -22,7 +22,7 @@ void main() {
context.clipRect(new Rect.fromLTRB(0.0, 0.0, context.width, radius)); context.clipRect(new Rect.fromLTRB(0.0, 0.0, context.width, radius));
context.translate(mid.x, mid.y); context.translate(mid.x, mid.y);
paint.setARGB(128, 255, 0, 255); paint.color = const Color.fromARGB(128, 255, 0, 255);
context.rotateDegrees(45.0); context.rotateDegrees(45.0);
context.drawRect(new Rect.fromLTRB(-radius, -radius, radius, radius), context.drawRect(new Rect.fromLTRB(-radius, -radius, radius, radius),
...@@ -35,7 +35,7 @@ void main() { ...@@ -35,7 +35,7 @@ void main() {
0.0, 0.0, 1.0 0.0, 0.0, 1.0
]; ];
context.concat(scaleMatrix); context.concat(scaleMatrix);
paint.setARGB(128, 0, 255, 0); paint.color = const Color.fromARGB(128, 0, 255, 0);
context.drawCircle(0.0, 0.0, radius, paint); context.drawCircle(0.0, 0.0, radius, paint);
context.restore(); context.restore();
...@@ -46,19 +46,19 @@ void main() { ...@@ -46,19 +46,19 @@ void main() {
new DrawLooperLayerInfo() new DrawLooperLayerInfo()
..setOffset(150.0, 0.0)..setPaintBits(-1)..setColorMode(1), ..setOffset(150.0, 0.0)..setPaintBits(-1)..setColorMode(1),
(Paint layerPaint) { (Paint layerPaint) {
layerPaint.setARGB(128, 255, 255, 0); layerPaint.color = const Color.fromARGB(128, 255, 255, 0);
layerPaint.setColorFilter(new ColorFilter(0x770000ff, 5)); layerPaint.setColorFilter(new ColorFilter(0x770000ff, 5));
}) })
..addLayerOnTop( ..addLayerOnTop(
new DrawLooperLayerInfo()..setOffset(75.0, 75.0)..setColorMode(1), new DrawLooperLayerInfo()..setOffset(75.0, 75.0)..setColorMode(1),
(Paint layerPaint) { (Paint layerPaint) {
layerPaint.setARGB(128, 255, 0, 0); layerPaint.color = const Color.fromARGB(128, 255, 0, 0);
}) })
..addLayerOnTop( ..addLayerOnTop(
new DrawLooperLayerInfo()..setOffset(225.0, 75.0), new DrawLooperLayerInfo()..setOffset(225.0, 75.0),
(Paint layerPaint) { (Paint layerPaint) {
// Since this layer uses a DST color mode, this has no effect. // Since this layer uses a DST color mode, this has no effect.
layerPaint.setARGB(128, 255, 0, 0); layerPaint.color = const Color.fromARGB(128, 255, 0, 0);
}); });
paint.setDrawLooper(builder.build()); paint.setDrawLooper(builder.build());
context.drawCircle(0.0, 0.0, radius, paint); context.drawCircle(0.0, 0.0, radius, paint);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment