| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <cmath> | 6 #include <cmath> |
| 7 #include <stdarg.h> | 7 #include <stdarg.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 | 9 |
| 10 #include "ppapi/c/ppb_gamepad.h" | 10 #include "ppapi/c/ppb_gamepad.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 gamepad_data.items[0].axes[i + 0] * width2 + width2); | 101 gamepad_data.items[0].axes[i + 0] * width2 + width2); |
| 102 int y = static_cast<int>( | 102 int y = static_cast<int>( |
| 103 gamepad_data.items[0].axes[i + 1] * height2 + height2); | 103 gamepad_data.items[0].axes[i + 1] * height2 + height2); |
| 104 uint32_t box_bgra = 0x80000000; // Alpha 50%. | 104 uint32_t box_bgra = 0x80000000; // Alpha 50%. |
| 105 FillRect(&image, x - 3, y - 3, 7, 7, box_bgra); | 105 FillRect(&image, x - 3, y - 3, 7, 7, box_bgra); |
| 106 } | 106 } |
| 107 | 107 |
| 108 for (size_t i = 0; i < gamepad_data.items[0].buttons_length; ++i) { | 108 for (size_t i = 0; i < gamepad_data.items[0].buttons_length; ++i) { |
| 109 float button_val = gamepad_data.items[0].buttons[i]; | 109 float button_val = gamepad_data.items[0].buttons[i]; |
| 110 uint32_t colour = static_cast<uint32_t>((button_val * 192) + 63) << 24; | 110 uint32_t colour = static_cast<uint32_t>((button_val * 192) + 63) << 24; |
| 111 int x = i * 8 + 10; | 111 int x = static_cast<int>(i) * 8 + 10; |
| 112 int y = 10; | 112 int y = 10; |
| 113 FillRect(&image, x - 3, y - 3, 7, 7, colour); | 113 FillRect(&image, x - 3, y - 3, 7, 7, colour); |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 return image; | 116 return image; |
| 117 } | 117 } |
| 118 | 118 |
| 119 int width_; | 119 int width_; |
| 120 int height_; | 120 int height_; |
| 121 | 121 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 141 | 141 |
| 142 namespace pp { | 142 namespace pp { |
| 143 | 143 |
| 144 // Factory function for your specialization of the Module object. | 144 // Factory function for your specialization of the Module object. |
| 145 Module* CreateModule() { | 145 Module* CreateModule() { |
| 146 return new MyModule(); | 146 return new MyModule(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace pp | 149 } // namespace pp |
| 150 | 150 |
| OLD | NEW |