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

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

Issue 10912062: Implement the gamepad API in the IPC proxy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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) 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_gamepad.h" 10 #include "ppapi/c/ppb_gamepad.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if (!image.is_null()) { 78 if (!image.is_null()) {
79 device_context_.ReplaceContents(&image); 79 device_context_.ReplaceContents(&image);
80 device_context_.Flush( 80 device_context_.Flush(
81 callback_factory_.NewCallback(&MyInstance::OnFlush)); 81 callback_factory_.NewCallback(&MyInstance::OnFlush));
82 } else { 82 } else {
83 printf("NullImage\n"); 83 printf("NullImage\n");
84 } 84 }
85 } 85 }
86 86
87 pp::ImageData PaintImage(const pp::Size& size) { 87 pp::ImageData PaintImage(const pp::Size& size) {
88 pp::ImageData image(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL, size, false); 88 pp::ImageData image(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL, size, true);
raymes 2012/09/05 21:05:57 What's this for?
brettw 2012/09/05 21:25:51 This was a bug in the example where it doesn't req
89 if (image.is_null()) 89 if (image.is_null())
90 return image; 90 return image;
91 91
92 PP_GamepadsSampleData gamepad_data; 92 PP_GamepadsSampleData gamepad_data;
93 gamepad_->Sample(pp_instance(), &gamepad_data); 93 gamepad_->Sample(pp_instance(), &gamepad_data);
94 94
95 if (gamepad_data.length > 1 && gamepad_data.items[0].connected) { 95 if (gamepad_data.length > 1 && gamepad_data.items[0].connected) {
96 int width2 = size.width() / 2; 96 int width2 = size.width() / 2;
97 int height2 = size.height() / 2; 97 int height2 = size.height() / 2;
98 // Draw 2 axes 98 // Draw 2 axes
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
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

Powered by Google App Engine
This is Rietveld 408576698