OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <cmath> | 5 #include <cmath> |
6 #include <stdarg.h> | 6 #include <stdarg.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "ppapi/c/dev/ppb_console_dev.h" | 9 #include "ppapi/c/dev/ppb_console_dev.h" |
10 #include "ppapi/c/ppb_input_event.h" | 10 #include "ppapi/c/ppb_input_event.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 219 |
220 return image; | 220 return image; |
221 } | 221 } |
222 | 222 |
223 double GetDistance(int point_1_x, int point_1_y, | 223 double GetDistance(int point_1_x, int point_1_y, |
224 int point_2_x, int point_2_y) { | 224 int point_2_x, int point_2_y) { |
225 return sqrt(pow(static_cast<double>(point_1_x - point_2_x), 2) + | 225 return sqrt(pow(static_cast<double>(point_1_x - point_2_x), 2) + |
226 pow(static_cast<double>(point_1_y - point_2_y), 2)); | 226 pow(static_cast<double>(point_1_y - point_2_y), 2)); |
227 } | 227 } |
228 | 228 |
229 void Log(PP_LogLevel_Dev level, const char* format, ...) { | 229 void Log(PP_LogLevel level, const char* format, ...) { |
230 va_list args; | 230 va_list args; |
231 va_start(args, format); | 231 va_start(args, format); |
232 char buf[512]; | 232 char buf[512]; |
233 vsnprintf(buf, sizeof(buf) - 1, format, args); | 233 vsnprintf(buf, sizeof(buf) - 1, format, args); |
234 buf[sizeof(buf) - 1] = '\0'; | 234 buf[sizeof(buf) - 1] = '\0'; |
235 va_end(args); | 235 va_end(args); |
236 | 236 |
237 pp::Var value(buf); | 237 pp::Var value(buf); |
238 console_->Log(pp_instance(), level, value.pp_var()); | 238 console_->Log(pp_instance(), level, value.pp_var()); |
239 } | 239 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 271 |
272 namespace pp { | 272 namespace pp { |
273 | 273 |
274 // Factory function for your specialization of the Module object. | 274 // Factory function for your specialization of the Module object. |
275 Module* CreateModule() { | 275 Module* CreateModule() { |
276 return new MyModule(); | 276 return new MyModule(); |
277 } | 277 } |
278 | 278 |
279 } // namespace pp | 279 } // namespace pp |
280 | 280 |
OLD | NEW |