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

Side by Side Diff: ppapi/cpp/dev/font_dev.h

Issue 5539001: Remove all the swap() stuff in the PPAPI C++ wrappers.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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/cpp/dev/file_ref_dev.cc ('k') | ppapi/cpp/dev/font_dev.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 #ifndef PPAPI_CPP_DEV_FONT_DEV_H_ 5 #ifndef PPAPI_CPP_DEV_FONT_DEV_H_
6 #define PPAPI_CPP_DEV_FONT_DEV_H_ 6 #define PPAPI_CPP_DEV_FONT_DEV_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "ppapi/c/dev/ppb_font_dev.h" 10 #include "ppapi/c/dev/ppb_font_dev.h"
(...skipping 17 matching lines...) Expand all
28 public: 28 public:
29 FontDescription_Dev(); 29 FontDescription_Dev();
30 FontDescription_Dev(const FontDescription_Dev& other); 30 FontDescription_Dev(const FontDescription_Dev& other);
31 ~FontDescription_Dev(); 31 ~FontDescription_Dev();
32 32
33 const PP_FontDescription_Dev& pp_font_description() const { 33 const PP_FontDescription_Dev& pp_font_description() const {
34 return pp_font_description_; 34 return pp_font_description_;
35 } 35 }
36 36
37 FontDescription_Dev& operator=(const FontDescription_Dev& other); 37 FontDescription_Dev& operator=(const FontDescription_Dev& other);
38 void swap(FontDescription_Dev& other);
39 38
40 Var face() const { return face_; } 39 Var face() const { return face_; }
41 void set_face(const Var& face) { 40 void set_face(const Var& face) {
42 face_ = face; 41 face_ = face;
43 pp_font_description_.face = face_.pp_var(); 42 pp_font_description_.face = face_.pp_var();
44 } 43 }
45 44
46 PP_FontFamily_Dev family() const { return pp_font_description_.family; } 45 PP_FontFamily_Dev family() const { return pp_font_description_.family; }
47 void set_family(PP_FontFamily_Dev f) { pp_font_description_.family = f; } 46 void set_family(PP_FontFamily_Dev f) { pp_font_description_.family = f; }
48 47
(...skipping 25 matching lines...) Expand all
74 Var face_; // Manages memory for pp_font_description_.face 73 Var face_; // Manages memory for pp_font_description_.face
75 PP_FontDescription_Dev pp_font_description_; 74 PP_FontDescription_Dev pp_font_description_;
76 }; 75 };
77 76
78 // TextRun_Dev ----------------------------------------------------------------- 77 // TextRun_Dev -----------------------------------------------------------------
79 78
80 class TextRun_Dev { 79 class TextRun_Dev {
81 public: 80 public:
82 TextRun_Dev(); 81 TextRun_Dev();
83 TextRun_Dev(const std::string& text, 82 TextRun_Dev(const std::string& text,
84 bool rtl = false, 83 bool rtl = false,
85 bool override_direction = false); 84 bool override_direction = false);
86 TextRun_Dev(const TextRun_Dev& other); 85 TextRun_Dev(const TextRun_Dev& other);
87 ~TextRun_Dev(); 86 ~TextRun_Dev();
88 87
89 TextRun_Dev& operator=(const TextRun_Dev& other); 88 TextRun_Dev& operator=(const TextRun_Dev& other);
90 void swap(TextRun_Dev& other);
91 89
92 const PP_TextRun_Dev& pp_text_run() const { 90 const PP_TextRun_Dev& pp_text_run() const {
93 return pp_text_run_; 91 return pp_text_run_;
94 } 92 }
95 93
96 private: 94 private:
97 Var text_; // Manages memory for the reference in pp_text_run_. 95 Var text_; // Manages memory for the reference in pp_text_run_.
98 PP_TextRun_Dev pp_text_run_; 96 PP_TextRun_Dev pp_text_run_;
99 }; 97 };
100 98
101 // Font ------------------------------------------------------------------------ 99 // Font ------------------------------------------------------------------------
102 100
103 // Provides access to system fonts. 101 // Provides access to system fonts.
104 class Font_Dev : public Resource { 102 class Font_Dev : public Resource {
105 public: 103 public:
106 // Creates an is_null() Font object. 104 // Creates an is_null() Font object.
107 Font_Dev() {} 105 Font_Dev() {}
108 106
109 explicit Font_Dev(PP_Resource resource); 107 explicit Font_Dev(PP_Resource resource);
110 explicit Font_Dev(const FontDescription_Dev& description); 108 explicit Font_Dev(const FontDescription_Dev& description);
111 Font_Dev(const Font_Dev& other); 109 Font_Dev(const Font_Dev& other);
112 110
113 Font_Dev& operator=(const Font_Dev& other); 111 Font_Dev& operator=(const Font_Dev& other);
114 void swap(Font_Dev& other);
115 112
116 // PPB_Font methods: 113 // PPB_Font methods:
117 bool Describe(FontDescription_Dev* description, 114 bool Describe(FontDescription_Dev* description,
118 PP_FontMetrics_Dev* metrics) const; 115 PP_FontMetrics_Dev* metrics) const;
119 bool DrawTextAt(ImageData* dest, 116 bool DrawTextAt(ImageData* dest,
120 const TextRun_Dev& text, 117 const TextRun_Dev& text,
121 const Point& position, 118 const Point& position,
122 uint32_t color, 119 uint32_t color,
123 const Rect& clip, 120 const Rect& clip,
124 bool image_data_is_opaque) const; 121 bool image_data_is_opaque) const;
(...skipping 10 matching lines...) Expand all
135 uint32_t color, 132 uint32_t color,
136 bool image_data_is_opaque = false) const; 133 bool image_data_is_opaque = false) const;
137 134
138 // Convenience function that assumes a left-to-right string. 135 // Convenience function that assumes a left-to-right string.
139 int32_t MeasureSimpleText(const std::string& text) const; 136 int32_t MeasureSimpleText(const std::string& text) const;
140 }; 137 };
141 138
142 } // namespace pp 139 } // namespace pp
143 140
144 #endif // PPAPI_CPP_DEV_FONT_DEV_H_ 141 #endif // PPAPI_CPP_DEV_FONT_DEV_H_
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/file_ref_dev.cc ('k') | ppapi/cpp/dev/font_dev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698