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

Side by Side Diff: ppapi/examples/gamepad/gamepad.cc

Issue 915403003: Enable size_t to int truncation warnings in PPAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ppapi_unittests win x64 Created 5 years, 10 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 | « ppapi/cpp/private/flash_clipboard.cc ('k') | ppapi/examples/ime/ime.cc » ('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) 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
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
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
OLDNEW
« no previous file with comments | « ppapi/cpp/private/flash_clipboard.cc ('k') | ppapi/examples/ime/ime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698