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

Side by Side Diff: ppapi/examples/font/simple_font.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/scroll.cc ('k') | no next file » | 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 "ppapi/cpp/completion_callback.h" 5 #include "ppapi/cpp/completion_callback.h"
6 #include "ppapi/cpp/dev/font_dev.h" 6 #include "ppapi/cpp/dev/font_dev.h"
7 #include "ppapi/cpp/graphics_2d.h" 7 #include "ppapi/cpp/graphics_2d.h"
8 #include "ppapi/cpp/image_data.h" 8 #include "ppapi/cpp/image_data.h"
9 #include "ppapi/cpp/instance.h" 9 #include "ppapi/cpp/instance.h"
10 #include "ppapi/cpp/module.h" 10 #include "ppapi/cpp/module.h"
11 #include "ppapi/cpp/rect.h" 11 #include "ppapi/cpp/rect.h"
12 #include "ppapi/cpp/size.h" 12 #include "ppapi/cpp/size.h"
13 13
14 static void DummyCompletionCallback(void* /*user_data*/, int32_t /*result*/) { 14 static void DummyCompletionCallback(void* /*user_data*/, int32_t /*result*/) {
15 } 15 }
16 16
17 class MyInstance : public pp::Instance { 17 class MyInstance : public pp::Instance {
18 public: 18 public:
19 MyInstance(PP_Instance instance) 19 MyInstance(PP_Instance instance)
20 : pp::Instance(instance) { 20 : pp::Instance(instance) {
21 } 21 }
22 22
23 virtual void ViewChanged(const pp::Rect& position, const pp::Rect& clip) { 23 virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip) {
24 if (position.size() == last_size_) 24 if (position.size() == last_size_)
25 return; 25 return;
26 last_size_ = position.size(); 26 last_size_ = position.size();
27 27
28 pp::ImageData image(PP_IMAGEDATAFORMAT_BGRA_PREMUL, last_size_, true); 28 pp::ImageData image(this, PP_IMAGEDATAFORMAT_BGRA_PREMUL, last_size_, true);
29 pp::Graphics2D device(last_size_, false); 29 pp::Graphics2D device(this, last_size_, false);
30 BindGraphics(device); 30 BindGraphics(device);
31 31
32 pp::FontDescription_Dev desc; 32 pp::FontDescription_Dev desc;
33 desc.set_family(PP_FONTFAMILY_SANSSERIF); 33 desc.set_family(PP_FONTFAMILY_SANSSERIF);
34 desc.set_size(30); 34 desc.set_size(30);
35 pp::Font_Dev font(desc); 35 pp::Font_Dev font(this, desc);
36 36
37 pp::Rect text_clip(position.size()); // Use entire bounds for clip. 37 pp::Rect text_clip(position.size()); // Use entire bounds for clip.
38 font.DrawTextAt(&image, 38 font.DrawTextAt(&image,
39 pp::TextRun_Dev("\xD9\x85\xD8\xB1\xD8\xAD\xD8\xA8\xD8\xA7\xE2\x80\x8E", 39 pp::TextRun_Dev("\xD9\x85\xD8\xB1\xD8\xAD\xD8\xA8\xD8\xA7\xE2\x80\x8E",
40 true, true), 40 true, true),
41 pp::Point(10, 40), 0xFF008000, clip, false); 41 pp::Point(10, 40), 0xFF008000, clip, false);
42 font.DrawTextAt(&image, pp::TextRun_Dev("Hello"), 42 font.DrawTextAt(&image, pp::TextRun_Dev("Hello"),
43 pp::Point(10, 80), 0xFF000080, text_clip, false); 43 pp::Point(10, 80), 0xFF000080, text_clip, false);
44 44
45 device.PaintImageData(image, pp::Point(0, 0)); 45 device.PaintImageData(image, pp::Point(0, 0));
(...skipping 12 matching lines...) Expand all
58 }; 58 };
59 59
60 namespace pp { 60 namespace pp {
61 61
62 // Factory function for your specialization of the Module object. 62 // Factory function for your specialization of the Module object.
63 Module* CreateModule() { 63 Module* CreateModule() {
64 return new MyModule(); 64 return new MyModule();
65 } 65 }
66 66
67 } // namespace pp 67 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/examples/2d/scroll.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698