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 "ppapi/shared_impl/ppb_gamepad_shared.h" | 5 #include "ppapi/shared_impl/ppb_gamepad_shared.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | |
10 | 9 |
11 namespace ppapi { | 10 namespace ppapi { |
12 | 11 |
13 const size_t WebKitGamepads::kItemsLengthCap; | 12 const size_t WebKitGamepads::kItemsLengthCap; |
14 | 13 |
15 void ConvertWebKitGamepadData(const WebKitGamepads& webkit_data, | 14 void ConvertWebKitGamepadData(const WebKitGamepads& webkit_data, |
16 PP_GamepadsSampleData* output_data) { | 15 PP_GamepadsSampleData* output_data) { |
17 size_t length = std::min(WebKitGamepads::kItemsLengthCap, | 16 size_t length = std::min(WebKitGamepads::kItemsLengthCap, |
18 static_cast<const size_t>(webkit_data.length)); | 17 static_cast<const size_t>(webkit_data.length)); |
19 output_data->length = static_cast<unsigned>(length); | 18 output_data->length = static_cast<unsigned>(length); |
(...skipping 10 matching lines...) Expand all Loading... |
30 for (unsigned j = 0; j < webkit_pad.axes_length; ++j) | 29 for (unsigned j = 0; j < webkit_pad.axes_length; ++j) |
31 output_pad.axes[j] = static_cast<float>(webkit_pad.axes[j]); | 30 output_pad.axes[j] = static_cast<float>(webkit_pad.axes[j]); |
32 output_pad.buttons_length = webkit_pad.buttons_length; | 31 output_pad.buttons_length = webkit_pad.buttons_length; |
33 for (unsigned j = 0; j < webkit_pad.buttons_length; ++j) | 32 for (unsigned j = 0; j < webkit_pad.buttons_length; ++j) |
34 output_pad.buttons[j] = static_cast<float>(webkit_pad.buttons[j].value); | 33 output_pad.buttons[j] = static_cast<float>(webkit_pad.buttons[j].value); |
35 } | 34 } |
36 } | 35 } |
37 } | 36 } |
38 | 37 |
39 } // namespace ppapi | 38 } // namespace ppapi |
OLD | NEW |