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
3 // found in the LICENSE file.
5 #include "ppapi/proxy/serialized_structs.h"
7 #include "base/pickle.h"
8 #include "build/build_config.h"
9 #include "ppapi/c/dev/ppb_font_dev.h"
10 #include "ppapi/c/pp_file_info.h"
11 #include "ppapi/c/pp_rect.h"
12 #include "ppapi/c/trusted/ppb_browser_font_trusted.h"
13 #include "ppapi/shared_impl/var.h"
18 SerializedFontDescription::SerializedFontDescription()
29 SerializedFontDescription::~SerializedFontDescription() {}
31 void SerializedFontDescription::SetFromPPFontDescription(
32 const PP_FontDescription_Dev
& desc
) {
33 StringVar
* string_var
= StringVar::FromPPVar(desc
.face
);
34 face
= string_var
? string_var
->value() : std::string();
40 small_caps
= desc
.small_caps
;
41 letter_spacing
= desc
.letter_spacing
;
42 word_spacing
= desc
.word_spacing
;
45 void SerializedFontDescription::SetFromPPBrowserFontDescription(
46 const PP_BrowserFont_Trusted_Description
& desc
) {
47 StringVar
* string_var
= StringVar::FromPPVar(desc
.face
);
48 face
= string_var
? string_var
->value() : std::string();
54 small_caps
= desc
.small_caps
;
55 letter_spacing
= desc
.letter_spacing
;
56 word_spacing
= desc
.word_spacing
;
59 void SerializedFontDescription::SetToPPFontDescription(
60 PP_FontDescription_Dev
* desc
) const {
61 desc
->face
= StringVar::StringToPPVar(face
);
62 desc
->family
= static_cast<PP_FontFamily_Dev
>(family
);
64 desc
->weight
= static_cast<PP_FontWeight_Dev
>(weight
);
65 desc
->italic
= italic
;
66 desc
->small_caps
= small_caps
;
67 desc
->letter_spacing
= letter_spacing
;
68 desc
->word_spacing
= word_spacing
;
71 void SerializedFontDescription::SetToPPBrowserFontDescription(
72 PP_BrowserFont_Trusted_Description
* desc
) const {
73 desc
->face
= StringVar::StringToPPVar(face
);
74 desc
->family
= static_cast<PP_BrowserFont_Trusted_Family
>(family
);
76 desc
->weight
= static_cast<PP_BrowserFont_Trusted_Weight
>(weight
);
77 desc
->italic
= italic
;
78 desc
->small_caps
= small_caps
;
79 desc
->letter_spacing
= letter_spacing
;
80 desc
->word_spacing
= word_spacing
;
83 SerializedTrueTypeFontDesc::SerializedTrueTypeFontDesc()
92 SerializedTrueTypeFontDesc::~SerializedTrueTypeFontDesc() {}
94 void SerializedTrueTypeFontDesc::SetFromPPTrueTypeFontDesc(
95 const PP_TrueTypeFontDesc_Dev
& desc
) {
96 StringVar
* string_var
= StringVar::FromPPVar(desc
.family
);
97 family
= string_var
? string_var
->value() : std::string();
99 generic_family
= desc
.generic_family
;
101 weight
= desc
.weight
;
103 charset
= desc
.charset
;
106 void SerializedTrueTypeFontDesc::CopyToPPTrueTypeFontDesc(
107 PP_TrueTypeFontDesc_Dev
* desc
) const {
108 desc
->family
= StringVar::StringToPPVar(family
);
110 desc
->generic_family
= generic_family
;
112 desc
->weight
= weight
;
114 desc
->charset
= charset
;
117 PPBFlash_DrawGlyphs_Params::PPBFlash_DrawGlyphs_Params()
123 clip
.size
.height
= 0;
127 allow_subpixel_aa
= PP_FALSE
;
130 PPBFlash_DrawGlyphs_Params::~PPBFlash_DrawGlyphs_Params() {}