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

Side by Side Diff: ppapi/examples/2d/scroll.cc

Issue 6676072: Unbreak compilation of ppapi examples. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed virtual functions. Created 9 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
« no previous file with comments | « ppapi/examples/2d/paint_manager_example.cc ('k') | ppapi/examples/font/simple_font.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <math.h> 5 #include <math.h>
6 6
7 #include "ppapi/cpp/completion_callback.h" 7 #include "ppapi/cpp/completion_callback.h"
8 #include "ppapi/cpp/graphics_2d.h" 8 #include "ppapi/cpp/graphics_2d.h"
9 #include "ppapi/cpp/image_data.h" 9 #include "ppapi/cpp/image_data.h"
10 #include "ppapi/cpp/instance.h" 10 #include "ppapi/cpp/instance.h"
(...skipping 22 matching lines...) Expand all
33 class MyInstance : public pp::Instance, public pp::PaintManager::Client { 33 class MyInstance : public pp::Instance, public pp::PaintManager::Client {
34 public: 34 public:
35 MyInstance(PP_Instance instance) 35 MyInstance(PP_Instance instance)
36 : pp::Instance(instance), 36 : pp::Instance(instance),
37 current_step_(0), 37 current_step_(0),
38 kicked_off_(false) { 38 kicked_off_(false) {
39 factory_.Initialize(this); 39 factory_.Initialize(this);
40 paint_manager_.Initialize(this, this, false); 40 paint_manager_.Initialize(this, this, false);
41 } 41 }
42 42
43 virtual void ViewChanged(const pp::Rect& position, const pp::Rect& clip) { 43 virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip) {
44 paint_manager_.SetSize(position.size()); 44 paint_manager_.SetSize(position.size());
45 } 45 }
46 46
47 void OnTimer(int32_t) { 47 void OnTimer(int32_t) {
48 pp::Module::Get()->core()->CallOnMainThread( 48 pp::Module::Get()->core()->CallOnMainThread(
49 16, factory_.NewCallback(&MyInstance::OnTimer), 0); 49 16, factory_.NewCallback(&MyInstance::OnTimer), 0);
50 // The scroll and the invalidate will do the same thing in this example, 50 // The scroll and the invalidate will do the same thing in this example,
51 // but the invalidate will cause a large repaint, whereas the scroll will 51 // but the invalidate will cause a large repaint, whereas the scroll will
52 // be faster and cause a smaller repaint. 52 // be faster and cause a smaller repaint.
53 #if 1 53 #if 1
(...skipping 10 matching lines...) Expand all
64 virtual bool OnPaint(pp::Graphics2D& device, 64 virtual bool OnPaint(pp::Graphics2D& device,
65 const std::vector<pp::Rect>& paint_rects, 65 const std::vector<pp::Rect>& paint_rects,
66 const pp::Rect& paint_bounds) { 66 const pp::Rect& paint_bounds) {
67 if (!kicked_off_) { 67 if (!kicked_off_) {
68 pp::Module::Get()->core()->CallOnMainThread( 68 pp::Module::Get()->core()->CallOnMainThread(
69 16, factory_.NewCallback(&MyInstance::OnTimer), 0); 69 16, factory_.NewCallback(&MyInstance::OnTimer), 0);
70 kicked_off_ = true; 70 kicked_off_ = true;
71 } 71 }
72 72
73 // Paint the background. 73 // Paint the background.
74 pp::ImageData updated_image(PP_IMAGEDATAFORMAT_BGRA_PREMUL, 74 pp::ImageData updated_image(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
75 paint_bounds.size(), false); 75 paint_bounds.size(), false);
76 FillRect(&updated_image, pp::Rect(updated_image.size()), 0xFF8888FF); 76 FillRect(&updated_image, pp::Rect(updated_image.size()), 0xFF8888FF);
77 77
78 int x_origin = current_step_ * kAdvanceXPerFrame; 78 int x_origin = current_step_ * kAdvanceXPerFrame;
79 int y_origin = current_step_ * kAdvanceYPerFrame; 79 int y_origin = current_step_ * kAdvanceYPerFrame;
80 80
81 int x_offset = x_origin % kSquareSpacing; 81 int x_offset = x_origin % kSquareSpacing;
82 int y_offset = y_origin % kSquareSpacing; 82 int y_offset = y_origin % kSquareSpacing;
83 83
84 for (int ys = 0; ys < device.size().height() / kSquareSpacing + 2; ys++) { 84 for (int ys = 0; ys < device.size().height() / kSquareSpacing + 2; ys++) {
(...skipping 25 matching lines...) Expand all
110 }; 110 };
111 111
112 namespace pp { 112 namespace pp {
113 113
114 // Factory function for your specialization of the Module object. 114 // Factory function for your specialization of the Module object.
115 Module* CreateModule() { 115 Module* CreateModule() {
116 return new MyModule(); 116 return new MyModule();
117 } 117 }
118 118
119 } // namespace pp 119 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/examples/2d/paint_manager_example.cc ('k') | ppapi/examples/font/simple_font.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698