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

Side by Side Diff: ppapi/proxy/serialized_structs.cc

Issue 10905227: Introduce PPB_Flash_Font. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 2 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/proxy/serialized_structs.h ('k') | ppapi/shared_impl/api_id.h » ('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) 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/proxy/serialized_structs.h" 5 #include "ppapi/proxy/serialized_structs.h"
6 6
7 #include "base/pickle.h" 7 #include "base/pickle.h"
8 #include "ppapi/c/dev/ppb_font_dev.h" 8 #include "ppapi/c/dev/ppb_font_dev.h"
9 #include "ppapi/c/pp_file_info.h" 9 #include "ppapi/c/pp_file_info.h"
10 #include "ppapi/c/pp_rect.h" 10 #include "ppapi/c/pp_rect.h"
11 #include "ppapi/shared_impl/var.h"
11 12
12 namespace ppapi { 13 namespace ppapi {
13 namespace proxy { 14 namespace proxy {
14 15
15 SerializedFontDescription::SerializedFontDescription() 16 SerializedFontDescription::SerializedFontDescription()
16 : face(), 17 : face(),
17 family(0), 18 family(0),
18 size(0), 19 size(0),
19 weight(0), 20 weight(0),
20 italic(PP_FALSE), 21 italic(PP_FALSE),
21 small_caps(PP_FALSE), 22 small_caps(PP_FALSE),
22 letter_spacing(0), 23 letter_spacing(0),
23 word_spacing(0) { 24 word_spacing(0) {
24 } 25 }
25 26
26 SerializedFontDescription::~SerializedFontDescription() {} 27 SerializedFontDescription::~SerializedFontDescription() {}
27 28
28 void SerializedFontDescription::SetFromPPFontDescription( 29 void SerializedFontDescription::SetFromPPFontDescription(
29 Dispatcher* dispatcher, 30 const PP_FontDescription_Dev& desc) {
30 const PP_FontDescription_Dev& desc, 31 StringVar* string_var = StringVar::FromPPVar(desc.face);
31 bool source_owns_ref) { 32 face = string_var ? string_var->value() : std::string();
32 if (source_owns_ref)
33 face = SerializedVarSendInput(dispatcher, desc.face);
34 else
35 SerializedVarReturnValue(&face).Return(dispatcher, desc.face);
36 33
37 family = desc.family; 34 family = desc.family;
38 size = desc.size; 35 size = desc.size;
39 weight = desc.weight; 36 weight = desc.weight;
40 italic = desc.italic; 37 italic = desc.italic;
41 small_caps = desc.small_caps; 38 small_caps = desc.small_caps;
42 letter_spacing = desc.letter_spacing; 39 letter_spacing = desc.letter_spacing;
43 word_spacing = desc.word_spacing; 40 word_spacing = desc.word_spacing;
44 } 41 }
45 42
46 void SerializedFontDescription::SetToPPFontDescription( 43 void SerializedFontDescription::SetToPPFontDescription(
47 Dispatcher* dispatcher, 44 PP_FontDescription_Dev* desc) const {
48 PP_FontDescription_Dev* desc, 45 desc->face = StringVar::StringToPPVar(face);
49 bool dest_owns_ref) const {
50 if (dest_owns_ref) {
51 ReceiveSerializedVarReturnValue face_return_value;
52 *static_cast<SerializedVar*>(&face_return_value) = face;
53 desc->face = face_return_value.Return(dispatcher);
54 } else {
55 desc->face = SerializedVarReceiveInput(face).Get(dispatcher);
56 }
57
58 desc->family = static_cast<PP_FontFamily_Dev>(family); 46 desc->family = static_cast<PP_FontFamily_Dev>(family);
59 desc->size = size; 47 desc->size = size;
60 desc->weight = static_cast<PP_FontWeight_Dev>(weight); 48 desc->weight = static_cast<PP_FontWeight_Dev>(weight);
61 desc->italic = italic; 49 desc->italic = italic;
62 desc->small_caps = small_caps; 50 desc->small_caps = small_caps;
63 desc->letter_spacing = letter_spacing; 51 desc->letter_spacing = letter_spacing;
64 desc->word_spacing = word_spacing; 52 desc->word_spacing = word_spacing;
65 } 53 }
66 54
67 PPBFlash_DrawGlyphs_Params::PPBFlash_DrawGlyphs_Params() 55 PPBFlash_DrawGlyphs_Params::PPBFlash_DrawGlyphs_Params()
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 break; 140 break;
153 // No default so the compiler will warn us if a new type is added. 141 // No default so the compiler will warn us if a new type is added.
154 } 142 }
155 if (valid_type) 143 if (valid_type)
156 hdr->type = Type(type); 144 hdr->type = Type(type);
157 return valid_type; 145 return valid_type;
158 } 146 }
159 147
160 } // namespace proxy 148 } // namespace proxy
161 } // namespace ppapi 149 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/serialized_structs.h ('k') | ppapi/shared_impl/api_id.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698