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

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: 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 import 'dart:sky' as sky;
abarth-chromium 2015/06/18 00:03:52 This file is a "part of" the main game library, wh
iansf 2015/06/20 00:02:38 Done.
2
1 part of sprites; 3 part of sprites;
2 4
3 enum SpriteBoxTransformMode { 5 enum SpriteBoxTransformMode {
4 nativePoints, 6 nativePoints,
5 letterbox, 7 letterbox,
6 stretch, 8 stretch,
7 scaleToFit, 9 scaleToFit,
8 fixedWidth, 10 fixedWidth,
9 fixedHeight, 11 fixedHeight,
10 } 12 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 size = constraints.constrain(Size.infinite); 64 size = constraints.constrain(Size.infinite);
63 } 65 }
64 66
65 // Event handling 67 // Event handling
66 68
67 void handleEvent(Event event, BoxHitTestEntry entry) { 69 void handleEvent(Event event, BoxHitTestEntry entry) {
68 } 70 }
69 71
70 // Rendering 72 // Rendering
71 73
72 void paint(RenderObjectDisplayList canvas) { 74 void paint(sky.Canvas canvas) {
73 // Move to correct coordinate space before drawing 75 // Move to correct coordinate space before drawing
74 double scaleX = 1.0; 76 double scaleX = 1.0;
75 double scaleY = 1.0; 77 double scaleY = 1.0;
76 double offsetX = 0.0; 78 double offsetX = 0.0;
77 double offsetY = 0.0; 79 double offsetY = 0.0;
78 80
79 switch(transformMode) { 81 switch(transformMode) {
80 case SpriteBoxTransformMode.stretch: 82 case SpriteBoxTransformMode.stretch:
81 scaleX = size.width/_systemWidth; 83 scaleX = size.width/_systemWidth;
82 scaleY = size.height/_systemHeight; 84 scaleY = size.height/_systemHeight;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 for (Node child in node.children) { 178 for (Node child in node.children) {
177 _addNodesAtPosition(child, position, list); 179 _addNodesAtPosition(child, position, list);
178 } 180 }
179 // Do the hit test 181 // Do the hit test
180 Point posInNodeSpace = node.convertPointToNodeSpace(position); 182 Point posInNodeSpace = node.convertPointToNodeSpace(position);
181 if (node.hitTest(posInNodeSpace)) { 183 if (node.hitTest(posInNodeSpace)) {
182 list.add(node); 184 list.add(node);
183 } 185 }
184 } 186 }
185 } 187 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698