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

Side by Side Diff: examples/dart/camera_video/lib/main.dart

Issue 1964193002: Dart: Refactors Proxies (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address comments Created 4 years, 7 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
« no previous file with comments | « examples/dart/camera_roll/lib/main.dart ('k') | examples/dart/device_info/lib/main.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This example makes use of mojo:camera which is available only when 5 // This example makes use of mojo:camera which is available only when
6 // running on Android. It repeatedly captures camera video frame images 6 // running on Android. It repeatedly captures camera video frame images
7 // and displays it in a mojo view. 7 // and displays it in a mojo view.
8 // 8 //
9 // Example usage: 9 // Example usage:
10 // pub get 10 // pub get
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 void beginFrame(double timeStamp) { 57 void beginFrame(double timeStamp) {
58 Rect paintBounds = new Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height); 58 Rect paintBounds = new Rect.fromLTWH(0.0, 0.0, ui.view.width, ui.view.height);
59 Picture picture = paint(paintBounds); 59 Picture picture = paint(paintBounds);
60 ui.Scene scene = composite(picture, paintBounds); 60 ui.Scene scene = composite(picture, paintBounds);
61 ui.view.scene = scene; 61 ui.view.scene = scene;
62 } 62 }
63 63
64 void drawNextPhoto() { 64 void drawNextPhoto() {
65 var future = camera.ptr.getLatestFrame(); 65 var future = camera.getLatestFrame();
66 future.then((response) { 66 future.then((response) {
67 if (response.content == null) { 67 if (response.content == null) {
68 drawNextPhoto(); 68 drawNextPhoto();
69 return; 69 return;
70 } 70 }
71 71
72 final imageFrame = decodeImageFromDataPipe(response.content); 72 final imageFrame = decodeImageFromDataPipe(response.content);
73 imageFrame.then((frame) { 73 imageFrame.then((frame) {
74 if (frame != null) { 74 if (frame != null) {
75 image = frame; 75 image = frame;
76 ui.view.scheduleFrame(); 76 ui.view.scheduleFrame();
77 drawNextPhoto(); 77 drawNextPhoto();
78 } 78 }
79 }); 79 });
80 }); 80 });
81 } 81 }
82 82
83 void main() { 83 void main() {
84 embedder.connectToService("mojo:camera", camera); 84 embedder.connectToService("mojo:camera", camera);
85 drawNextPhoto(); 85 drawNextPhoto();
86 ui.view.setFrameCallback(beginFrame); 86 ui.view.setFrameCallback(beginFrame);
87 } 87 }
OLDNEW
« no previous file with comments | « examples/dart/camera_roll/lib/main.dart ('k') | examples/dart/device_info/lib/main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698