Chromium Code Reviews| Index: sky/examples/raw/painting.dart |
| diff --git a/sky/examples/raw/painting.dart b/sky/examples/raw/painting.dart |
| index 6b24922fb5064517bae6ae8fa903b285230c0838..4bae5c4009e693bdf1722058fa0141c702fb13b2 100644 |
| --- a/sky/examples/raw/painting.dart |
| +++ b/sky/examples/raw/painting.dart |
| @@ -6,29 +6,32 @@ import 'dart:sky' as sky; |
| import 'dart:math' as math; |
| import 'dart:typed_data'; |
| +import 'package:sky/rendering/object.dart'; |
|
abarth-chromium
2015/06/23 02:28:45
Again, please don't add dependencies on package:sk
Hixie
2015/06/23 16:36:48
Specifically, nothing in examples/raw/ should have
iansf
2015/06/23 22:46:09
Done.
iansf
2015/06/23 22:46:09
Done.
|
| + |
| void beginFrame(double timeStamp) { |
| - sky.PictureRecorder context = new sky.PictureRecorder(sky.view.width, 200.0); |
| + sky.PictureRecorder recorder = new sky.PictureRecorder(); |
| + RenderCanvas canvas = new RenderCanvas(recorder, sky.view.width, 200.0); |
| sky.Paint paint = new sky.Paint(); |
| - sky.Point mid = new sky.Point(context.width / 2.0, context.height / 2.0); |
| + sky.Point mid = new sky.Point(sky.view.width / 2.0, sky.view.height / 2.0); |
| double radius = math.min(mid.x, mid.y); |
| - context.drawPaint(new sky.Paint()..color = const sky.Color(0xFFFFFFFF)); |
| + canvas.drawPaint(new sky.Paint()..color = const sky.Color(0xFFFFFFFF)); |
| - context.save(); |
| + canvas.save(); |
| - context.translate(-mid.x/2.0, context.height*2.0); |
| - context.clipRect( |
| - new sky.Rect.fromLTRB(0.0, -context.height, context.width, radius)); |
| + canvas.translate(-mid.x/2.0, sky.view.height*2.0); |
| + canvas.clipRect( |
| + new sky.Rect.fromLTRB(0.0, -sky.view.height, sky.view.width, radius)); |
| - context.translate(mid.x, mid.y); |
| + canvas.translate(mid.x, mid.y); |
| paint.color = const sky.Color.fromARGB(128, 255, 0, 255); |
| - context.rotate(math.PI/4.0); |
| + canvas.rotate(math.PI/4.0); |
| sky.Gradient yellowBlue = new sky.Gradient.linear( |
| [new sky.Point(-radius, -radius), new sky.Point(0.0, 0.0)], |
| [const sky.Color(0xFFFFFF00), const sky.Color(0xFF0000FF)]); |
| - context.drawRect(new sky.Rect.fromLTRB(-radius, -radius, radius, radius), |
| + canvas.drawRect(new sky.Rect.fromLTRB(-radius, -radius, radius, radius), |
| new sky.Paint()..setShader(yellowBlue)); |
| // Scale x and y by 0.5. |
| @@ -38,13 +41,13 @@ void beginFrame(double timeStamp) { |
| 0.0, 0.0, 0.0, 0.0, |
| 0.0, 0.0, 0.0, 1.0, |
| ]); |
| - context.concat(scaleMatrix); |
| + canvas.concat(scaleMatrix); |
| paint.color = const sky.Color.fromARGB(128, 0, 255, 0); |
| - context.drawCircle(0.0, 0.0, radius, paint); |
| + canvas.drawCircle(0.0, 0.0, radius, paint); |
| - context.restore(); |
| + canvas.restore(); |
| - context.translate(0.0, 50.0); |
| + canvas.translate(0.0, 50.0); |
| var builder = new sky.LayerDrawLooperBuilder() |
| ..addLayerOnTop( |
| new sky.DrawLooperLayerInfo() |
| @@ -80,9 +83,9 @@ void beginFrame(double timeStamp) { |
| layerPaint.color = const sky.Color.fromARGB(128, 255, 0, 0); |
| }); |
| paint.setDrawLooper(builder.build()); |
| - context.drawCircle(0.0, 0.0, radius, paint); |
| + canvas.drawCircle(0.0, 0.0, radius, paint); |
| - sky.view.picture = context.endRecording(); |
| + sky.view.picture = recorder.endRecording(); |
| } |
| void main() { |