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

Side by Side Diff: samples/stm32f746g-discovery/disco-light.dart

Issue 1996533003: Change framebuffer.clear to use background color (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Review feedback 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 | « pkg/stm32/lib/lcd.dart ('k') | samples/stm32f746g-discovery/touch.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 (c) 2016, the Dartino project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 import 'dart:math'; 5 import 'dart:math';
6 6
7 import 'package:stm32/stm32f746g_disco.dart'; 7 import 'package:stm32/stm32f746g_disco.dart';
8 import 'package:stm32/lcd.dart'; 8 import 'package:stm32/lcd.dart';
9 9
10 main() { 10 main() {
11 // Initialize display, and get display dimensions. 11 // Initialize display, and get display dimensions.
12 STM32F746GDiscovery discoBoard = new STM32F746GDiscovery(); 12 STM32F746GDiscovery discoBoard = new STM32F746GDiscovery();
13 var display = discoBoard.frameBuffer; 13 var display = discoBoard.frameBuffer;
14 display.backgroundColor = Color.black; 14 display.backgroundColor = Color.black;
15 int w = display.width; 15 int w = display.width;
16 int h = display.height; 16 int h = display.height;
17 17
18 // Loop eternally drawing random lines. 18 // Loop eternally drawing random lines.
19 Random rnd = new Random(42); 19 Random rnd = new Random(42);
20 int lineCounter = 0; 20 int lineCounter = 0;
21 while (true) { 21 while (true) {
22 // Render a line of random color from the centre to a random location. 22 // Render a line of random color from the centre to a random location.
23 var color = new Color(rnd.nextInt(255), rnd.nextInt(255), rnd.nextInt(255)); 23 var color = new Color(rnd.nextInt(255), rnd.nextInt(255), rnd.nextInt(255));
24 display.drawLine(w ~/ 2, h ~/ 2, rnd.nextInt(w), rnd.nextInt(h), color); 24 display.drawLine(w ~/ 2, h ~/ 2, rnd.nextInt(w), rnd.nextInt(h), color);
25 25
26 // Every 100 lines, clear the display and update the counter. 26 // Every 100 lines, clear the display and update the counter.
27 lineCounter += 1; 27 lineCounter += 1;
28 if ((lineCounter % 100) == 0) { 28 if ((lineCounter % 100) == 0) {
29 display.clear(Color.black); 29 display.clear();
30 display.writeText(10, 10, 'Rendered $lineCounter lines'); 30 display.writeText(10, 10, 'Rendered $lineCounter lines');
31 } 31 }
32 } 32 }
33 } 33 }
OLDNEW
« no previous file with comments | « pkg/stm32/lib/lcd.dart ('k') | samples/stm32f746g-discovery/touch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698