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

Side by Side Diff: native_client_sdk/src/examples/demo/voronoi/voronoi.cc

Issue 22842011: [NaCl SDK] Remove invalid assert from nacl_io. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include <assert.h> 5 #include <assert.h>
6 #include <math.h> 6 #include <math.h>
7 #include <ppapi/c/ppb_input_event.h> 7 #include <ppapi/c/ppb_input_event.h>
8 #include <ppapi/cpp/input_event.h> 8 #include <ppapi/cpp/input_event.h>
9 #include <ppapi/cpp/var.h> 9 #include <ppapi/cpp/var.h>
10 #include <ppapi/cpp/var_array.h> 10 #include <ppapi/cpp/var_array.h>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 inline float frand() { 53 inline float frand() {
54 return (static_cast<float>(rand_r(&g_rand_state)) / 54 return (static_cast<float>(rand_r(&g_rand_state)) /
55 static_cast<float>(RAND_MAX)); 55 static_cast<float>(RAND_MAX));
56 } 56 }
57 57
58 // reset random seed 58 // reset random seed
59 inline void rand_reset(unsigned int seed) { 59 inline void rand_reset(unsigned int seed) {
60 g_rand_state = seed; 60 g_rand_state = seed;
61 } 61 }
62 62
63 #ifndef NDEBUG
63 // returns true if input is power of two. 64 // returns true if input is power of two.
65 // only used in assertions.
64 inline bool is_pow2(int x) { 66 inline bool is_pow2(int x) {
65 return (x & (x - 1)) == 0; 67 return (x & (x - 1)) == 0;
66 } 68 }
69 #endif
67 70
68 inline double getseconds() { 71 inline double getseconds() {
69 const double usec_to_sec = 0.000001; 72 const double usec_to_sec = 0.000001;
70 timeval tv; 73 timeval tv;
71 if (0 == gettimeofday(&tv, NULL)) 74 if (0 == gettimeofday(&tv, NULL))
72 return tv.tv_sec + tv.tv_usec * usec_to_sec; 75 return tv.tv_sec + tv.tv_usec * usec_to_sec;
73 return 0.0; 76 return 0.0;
74 } 77 }
75 78
76 // BGRA helper function, for constructing a pixel for a BGRA buffer. 79 // BGRA helper function, for constructing a pixel for a BGRA buffer.
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 // Do simulation, render and present. 519 // Do simulation, render and present.
517 voronoi.Update(); 520 voronoi.Update();
518 } 521 }
519 522
520 return 0; 523 return 0;
521 } 524 }
522 525
523 // Register the function to call once the Instance Object is initialized. 526 // Register the function to call once the Instance Object is initialized.
524 // see: pappi_simple/ps_main.h 527 // see: pappi_simple/ps_main.h
525 PPAPI_SIMPLE_REGISTER_MAIN(example_main); 528 PPAPI_SIMPLE_REGISTER_MAIN(example_main);
OLDNEW
« no previous file with comments | « native_client_sdk/src/examples/demo/nacl_io/nacl_io_demo.c ('k') | native_client_sdk/src/libraries/nacl_io/kernel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698