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

Side by Side Diff: sky/examples/game/lib/sprite_box.dart

Issue 1190123003: Decouple Canvas from DisplayList and map Picture and PictureRecorder more directly to their Skia co… (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebased version of previous patch 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 unified diff | Download patch
OLDNEW
1 part of sprites; 1 part of sprites;
2 2
3 /// Options for setting up a [SpriteBox]. 3 /// Options for setting up a [SpriteBox].
4 /// 4 ///
5 /// * [nativePoints], use the same points as the parent [Widget]. 5 /// * [nativePoints], use the same points as the parent [Widget].
6 /// * [letterbox], use the size of the root node for the coordinate system, con strain the aspect ratio and trim off 6 /// * [letterbox], use the size of the root node for the coordinate system, con strain the aspect ratio and trim off
7 /// areas that end up outside the screen. 7 /// areas that end up outside the screen.
8 /// * [stretch], use the size of the root node for the coordinate system, scale it to fit the size of the box. 8 /// * [stretch], use the size of the root node for the coordinate system, scale it to fit the size of the box.
9 /// * [scaleToFit], similar to the letterbox option, but instead of trimming ar eas the sprite system will be scaled 9 /// * [scaleToFit], similar to the letterbox option, but instead of trimming ar eas the sprite system will be scaled
10 /// down to fit the box. 10 /// down to fit the box.
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 _transformMatrix.scale(scaleX, scaleY); 246 _transformMatrix.scale(scaleX, scaleY);
247 247
248 return _transformMatrix; 248 return _transformMatrix;
249 } 249 }
250 250
251 void _invalidateTransformMatrix() { 251 void _invalidateTransformMatrix() {
252 _transformMatrix = null; 252 _transformMatrix = null;
253 _rootNode._invalidateToBoxTransformMatrix(); 253 _rootNode._invalidateToBoxTransformMatrix();
254 } 254 }
255 255
256 void paint(RenderObjectDisplayList canvas) { 256 void paint(RenderCanvas canvas) {
257 canvas.save(); 257 canvas.save();
258 258
259 // Move to correct coordinate space before drawing 259 // Move to correct coordinate space before drawing
260 canvas.concat(transformMatrix.storage); 260 canvas.concat(transformMatrix.storage);
261 261
262 // Draw the sprite tree 262 // Draw the sprite tree
263 _rootNode._visit(canvas); 263 _rootNode._visit(canvas);
264 264
265 canvas.restore(); 265 canvas.restore();
266 } 266 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 /// if (event.pointer == firstPointerId) { 374 /// if (event.pointer == firstPointerId) {
375 /// // Do something 375 /// // Do something
376 /// } 376 /// }
377 final int pointer; 377 final int pointer;
378 378
379 /// Creates a new SpriteBoxEvent, typically this is done internally inside the SpriteBox. 379 /// Creates a new SpriteBoxEvent, typically this is done internally inside the SpriteBox.
380 /// 380 ///
381 /// var event = new SpriteBoxEvent(new Point(50.0, 50.0), 'pointerdown', 0 ); 381 /// var event = new SpriteBoxEvent(new Point(50.0, 50.0), 'pointerdown', 0 );
382 SpriteBoxEvent(this.boxPosition, this.type, this.pointer); 382 SpriteBoxEvent(this.boxPosition, this.type, this.pointer);
383 } 383 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698