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_gamepad.h" | 10 #include "ppapi/c/ppb_gamepad.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 void OnFlush(int32_t) { | 71 void OnFlush(int32_t) { |
72 Paint(); | 72 Paint(); |
73 } | 73 } |
74 | 74 |
75 private: | 75 private: |
76 void Paint() { | 76 void Paint() { |
77 pp::ImageData image = PaintImage(device_context_.size()); | 77 pp::ImageData image = PaintImage(device_context_.size()); |
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_.NewRequiredCallback(&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, false); |
89 if (image.is_null()) | 89 if (image.is_null()) |
90 return image; | 90 return image; |
91 | 91 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |