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

Unified Diff: sky/sdk/lib/example/raw/painting.dart

Issue 1214833004: Split Size into Size and Offset. (Closed) Base URL: https://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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/sdk/lib/example/raw/launcher.dart ('k') | sky/sdk/lib/example/raw/shadow.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/example/raw/painting.dart
diff --git a/sky/sdk/lib/example/raw/painting.dart b/sky/sdk/lib/example/raw/painting.dart
index 29d381a8605abe44767781d54f8cb0ecefe9e901..8d94b62b6449bf48ed0cc0ac38c4f64c4ff3986e 100644
--- a/sky/sdk/lib/example/raw/painting.dart
+++ b/sky/sdk/lib/example/raw/painting.dart
@@ -7,12 +7,13 @@ import 'dart:math' as math;
import 'dart:typed_data';
void beginFrame(double timeStamp) {
+ sky.Size size = new sky.Size(sky.view.width, sky.view.height);
sky.PictureRecorder recorder = new sky.PictureRecorder();
- Canvas canvas = new Canvas(recorder, sky.view.width, 200.0);
+ sky.Canvas canvas = new sky.Canvas(recorder, size);
sky.Paint paint = new sky.Paint();
- sky.Point mid = new sky.Point(sky.view.width / 2.0, sky.view.height / 2.0);
- double radius = math.min(mid.x, mid.y);
+ sky.Point mid = size.center(sky.Point.origin);
+ double radius = size.shortestSide / 2.0;
canvas.drawPaint(new sky.Paint()..color = const sky.Color(0xFFFFFFFF));
@@ -41,7 +42,7 @@ void beginFrame(double timeStamp) {
]);
canvas.concat(scaleMatrix);
paint.color = const sky.Color.fromARGB(128, 0, 255, 0);
- canvas.drawCircle(0.0, 0.0, radius, paint);
+ canvas.drawCircle(sky.Point.origin, radius, paint);
canvas.restore();
@@ -49,7 +50,7 @@ void beginFrame(double timeStamp) {
var builder = new sky.LayerDrawLooperBuilder()
..addLayerOnTop(
new sky.DrawLooperLayerInfo()
- ..setOffset(const sky.Point(150.0, 0.0))
+ ..setOffset(const sky.Offset(150.0, 0.0))
..setColorMode(sky.TransferMode.src)
..setPaintBits(sky.PaintBits.all),
(sky.Paint layerPaint) {
@@ -61,7 +62,7 @@ void beginFrame(double timeStamp) {
})
..addLayerOnTop(
new sky.DrawLooperLayerInfo()
- ..setOffset(const sky.Point(75.0, 75.0))
+ ..setOffset(const sky.Offset(75.0, 75.0))
..setColorMode(sky.TransferMode.src)
..setPaintBits(sky.PaintBits.shader),
(sky.Paint layerPaint) {
@@ -75,13 +76,13 @@ void beginFrame(double timeStamp) {
sky.BlurStyle.normal, 50.0, highQuality: true));
})
..addLayerOnTop(
- new sky.DrawLooperLayerInfo()..setOffset(const sky.Point(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.
layerPaint.color = const sky.Color.fromARGB(128, 255, 0, 0);
});
paint.setDrawLooper(builder.build());
- canvas.drawCircle(0.0, 0.0, radius, paint);
+ canvas.drawCircle(sky.Point.origin, radius, paint);
sky.view.picture = recorder.endRecording();
}
« no previous file with comments | « sky/sdk/lib/example/raw/launcher.dart ('k') | sky/sdk/lib/example/raw/shadow.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698