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

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

Issue 9651002: Add C++ wrappers for output parameters. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: With swapping Created 8 years, 9 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 "ppapi/cpp/graphics_2d.h" 5 #include "ppapi/cpp/graphics_2d.h"
6 #include "ppapi/cpp/image_data.h" 6 #include "ppapi/cpp/image_data.h"
7 #include "ppapi/cpp/instance.h" 7 #include "ppapi/cpp/instance.h"
8 #include "ppapi/cpp/logging.h" 8 #include "ppapi/cpp/logging.h"
9 #include "ppapi/cpp/module.h" 9 #include "ppapi/cpp/module.h"
10 #include "ppapi/cpp/private/flash.h" 10 #include "ppapi/cpp/private/flash.h"
(...skipping 27 matching lines...) Expand all
38 return; 38 return;
39 } 39 }
40 40
41 Paint(); 41 Paint();
42 } 42 }
43 43
44 private: 44 private:
45 void ScheduleNextTimer() { 45 void ScheduleNextTimer() {
46 pp::Module::Get()->core()->CallOnMainThread( 46 pp::Module::Get()->core()->CallOnMainThread(
47 kTimerInterval, 47 kTimerInterval,
48 callback_factory_.NewRequiredCallback(&MyInstance::OnTimer), 48 callback_factory_.NewCallback(&MyInstance::OnTimer),
49 0); 49 0);
50 } 50 }
51 51
52 void OnTimer(int32_t) { 52 void OnTimer(int32_t) {
53 ScheduleNextTimer(); 53 ScheduleNextTimer();
54 Paint(); 54 Paint();
55 } 55 }
56 56
57 void DidFlush(int32_t result) { 57 void DidFlush(int32_t result) {
58 waiting_for_flush_completion_ = false; 58 waiting_for_flush_completion_ = false;
(...skipping 10 matching lines...) Expand all
69 pending_paint_ = false; 69 pending_paint_ = false;
70 70
71 if (size_.IsEmpty()) 71 if (size_.IsEmpty())
72 return; // Nothing to do. 72 return; // Nothing to do.
73 73
74 pp::ImageData image = PaintImage(size_); 74 pp::ImageData image = PaintImage(size_);
75 if (!image.is_null()) { 75 if (!image.is_null()) {
76 device_context_.ReplaceContents(&image); 76 device_context_.ReplaceContents(&image);
77 waiting_for_flush_completion_ = true; 77 waiting_for_flush_completion_ = true;
78 device_context_.Flush( 78 device_context_.Flush(
79 callback_factory_.NewRequiredCallback(&MyInstance::DidFlush)); 79 callback_factory_.NewCallback(&MyInstance::DidFlush));
80 } 80 }
81 } 81 }
82 82
83 pp::ImageData PaintImage(const pp::Size& size) { 83 pp::ImageData PaintImage(const pp::Size& size) {
84 pp::ImageData image(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL, size, false); 84 pp::ImageData image(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL, size, false);
85 if (image.is_null()) 85 if (image.is_null())
86 return image; 86 return image;
87 87
88 pp::Rect rect(size.width() / 8, size.height() / 4, 88 pp::Rect rect(size.width() / 8, size.height() / 4,
89 3 * size.width() / 4, size.height() / 2); 89 3 * size.width() / 4, size.height() / 2);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 }; 126 };
127 127
128 namespace pp { 128 namespace pp {
129 129
130 // Factory function for your specialization of the Module object. 130 // Factory function for your specialization of the Module object.
131 Module* CreateModule() { 131 Module* CreateModule() {
132 return new MyModule(); 132 return new MyModule();
133 } 133 }
134 134
135 } // namespace pp 135 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698