Commit c25beb84 authored by Adam Barth's avatar Adam Barth

Merge pull request #551 from abarth/rm_weak_paint

Remove weak handle from sky.Paint
parents 7d3a6c4a 375c2477
...@@ -55,34 +55,29 @@ void beginFrame(double timeStamp) { ...@@ -55,34 +55,29 @@ void beginFrame(double timeStamp) {
..setOffset(const sky.Offset(150.0, 0.0)) ..setOffset(const sky.Offset(150.0, 0.0))
..setColorMode(sky.TransferMode.src) ..setColorMode(sky.TransferMode.src)
..setPaintBits(sky.PaintBits.all), ..setPaintBits(sky.PaintBits.all),
(sky.Paint layerPaint) { new sky.Paint()
layerPaint.color = const sky.Color.fromARGB(128, 255, 255, 0); ..color = const sky.Color.fromARGB(128, 255, 255, 0)
layerPaint.setColorFilter(new sky.ColorFilter.mode( ..setColorFilter(new sky.ColorFilter.mode(
const sky.Color.fromARGB(128, 0, 0, 255), sky.TransferMode.srcIn)); const sky.Color.fromARGB(128, 0, 0, 255), sky.TransferMode.srcIn))
layerPaint.setMaskFilter(new sky.MaskFilter.blur( ..setMaskFilter(new sky.MaskFilter.blur(
sky.BlurStyle.normal, 3.0, highQuality: true)); sky.BlurStyle.normal, 3.0, highQuality: true)))
})
..addLayerOnTop( ..addLayerOnTop(
new sky.DrawLooperLayerInfo() new sky.DrawLooperLayerInfo()
..setOffset(const sky.Offset(75.0, 75.0)) ..setOffset(const sky.Offset(75.0, 75.0))
..setColorMode(sky.TransferMode.src) ..setColorMode(sky.TransferMode.src)
..setPaintBits(sky.PaintBits.shader), ..setPaintBits(sky.PaintBits.shader),
(sky.Paint layerPaint) { new sky.Paint()
sky.Gradient redYellow = new sky.Gradient.radial( ..setShader(new sky.Gradient.radial(
new sky.Point(0.0, 0.0), radius/3.0, new sky.Point(0.0, 0.0), radius/3.0,
[const sky.Color(0xFFFFFF00), const sky.Color(0xFFFF0000)], [const sky.Color(0xFFFFFF00), const sky.Color(0xFFFF0000)],
null, sky.TileMode.mirror); null, sky.TileMode.mirror))
layerPaint.setShader(redYellow);
// Since we're don't set sky.PaintBits.maskFilter, this has no effect. // Since we're don't set sky.PaintBits.maskFilter, this has no effect.
layerPaint.setMaskFilter(new sky.MaskFilter.blur( ..setMaskFilter(new sky.MaskFilter.blur(
sky.BlurStyle.normal, 50.0, highQuality: true)); sky.BlurStyle.normal, 50.0, highQuality: true)))
})
..addLayerOnTop( ..addLayerOnTop(
new sky.DrawLooperLayerInfo()..setOffset(const sky.Offset(225.0, 75.0)), new sky.DrawLooperLayerInfo()..setOffset(const sky.Offset(225.0, 75.0)),
(sky.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.color = const sky.Color.fromARGB(128, 255, 0, 0); new sky.Paint()..color = const sky.Color.fromARGB(128, 255, 0, 0));
});
paint.setDrawLooper(builder.build()); paint.setDrawLooper(builder.build());
canvas.drawCircle(sky.Point.origin, radius, paint); canvas.drawCircle(sky.Point.origin, radius, paint);
......
...@@ -27,7 +27,7 @@ void beginFrame(double timeStamp) { ...@@ -27,7 +27,7 @@ void beginFrame(double timeStamp) {
new MaskFilter.blur(BlurStyle.normal, 5.0, highQuality: true)); new MaskFilter.blur(BlurStyle.normal, 5.0, highQuality: true));
}) })
// Main layer. // Main layer.
..addLayerOnTop(new DrawLooperLayerInfo(), (Paint) {}); ..addLayerOnTop(new DrawLooperLayerInfo(), new Paint());
paint.setDrawLooper(builder.build()); paint.setDrawLooper(builder.build());
canvas.drawPaint( canvas.drawPaint(
......
...@@ -15,15 +15,13 @@ class ShadowDrawLooperBuilder { ...@@ -15,15 +15,13 @@ class ShadowDrawLooperBuilder {
..setPaintBits(sky.PaintBits.all) ..setPaintBits(sky.PaintBits.all)
..setOffset(offset) ..setOffset(offset)
..setColorMode(sky.TransferMode.src), ..setColorMode(sky.TransferMode.src),
(sky.Paint layerPaint) { new sky.Paint()
layerPaint.color = color; ..color = color
layerPaint.setMaskFilter( ..setMaskFilter(new sky.MaskFilter.blur(sky.BlurStyle.normal, blur)));
new sky.MaskFilter.blur(sky.BlurStyle.normal, blur));
});
} }
sky.DrawLooper build() { sky.DrawLooper build() {
builder_.addLayerOnTop(new sky.DrawLooperLayerInfo(), (_) {}); builder_.addLayerOnTop(new sky.DrawLooperLayerInfo(), new sky.Paint());
return builder_.build(); return builder_.build();
} }
} }
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