| OLD | NEW |
| 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 "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "ppapi/c/dev/ppb_font_dev.h" | |
| 10 #include "ppapi/c/pp_file_info.h" | 9 #include "ppapi/c/pp_file_info.h" |
| 11 #include "ppapi/c/pp_rect.h" | 10 #include "ppapi/c/pp_rect.h" |
| 12 #include "ppapi/c/trusted/ppb_browser_font_trusted.h" | 11 #include "ppapi/c/trusted/ppb_browser_font_trusted.h" |
| 13 #include "ppapi/shared_impl/var.h" | 12 #include "ppapi/shared_impl/var.h" |
| 14 | 13 |
| 15 namespace ppapi { | 14 namespace ppapi { |
| 16 namespace proxy { | 15 namespace proxy { |
| 17 | 16 |
| 18 SerializedFontDescription::SerializedFontDescription() | 17 SerializedFontDescription::SerializedFontDescription() |
| 19 : face(), | 18 : face(), |
| 20 family(0), | 19 family(0), |
| 21 size(0), | 20 size(0), |
| 22 weight(0), | 21 weight(0), |
| 23 italic(PP_FALSE), | 22 italic(PP_FALSE), |
| 24 small_caps(PP_FALSE), | 23 small_caps(PP_FALSE), |
| 25 letter_spacing(0), | 24 letter_spacing(0), |
| 26 word_spacing(0) { | 25 word_spacing(0) { |
| 27 } | 26 } |
| 28 | 27 |
| 29 SerializedFontDescription::~SerializedFontDescription() {} | 28 SerializedFontDescription::~SerializedFontDescription() {} |
| 30 | 29 |
| 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(); | |
| 35 | |
| 36 family = desc.family; | |
| 37 size = desc.size; | |
| 38 weight = desc.weight; | |
| 39 italic = desc.italic; | |
| 40 small_caps = desc.small_caps; | |
| 41 letter_spacing = desc.letter_spacing; | |
| 42 word_spacing = desc.word_spacing; | |
| 43 } | |
| 44 | |
| 45 void SerializedFontDescription::SetFromPPBrowserFontDescription( | 30 void SerializedFontDescription::SetFromPPBrowserFontDescription( |
| 46 const PP_BrowserFont_Trusted_Description& desc) { | 31 const PP_BrowserFont_Trusted_Description& desc) { |
| 47 StringVar* string_var = StringVar::FromPPVar(desc.face); | 32 StringVar* string_var = StringVar::FromPPVar(desc.face); |
| 48 face = string_var ? string_var->value() : std::string(); | 33 face = string_var ? string_var->value() : std::string(); |
| 49 | 34 |
| 50 family = desc.family; | 35 family = desc.family; |
| 51 size = desc.size; | 36 size = desc.size; |
| 52 weight = desc.weight; | 37 weight = desc.weight; |
| 53 italic = desc.italic; | 38 italic = desc.italic; |
| 54 small_caps = desc.small_caps; | 39 small_caps = desc.small_caps; |
| 55 letter_spacing = desc.letter_spacing; | 40 letter_spacing = desc.letter_spacing; |
| 56 word_spacing = desc.word_spacing; | 41 word_spacing = desc.word_spacing; |
| 57 } | 42 } |
| 58 | 43 |
| 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); | |
| 63 desc->size = size; | |
| 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; | |
| 69 } | |
| 70 | |
| 71 void SerializedFontDescription::SetToPPBrowserFontDescription( | 44 void SerializedFontDescription::SetToPPBrowserFontDescription( |
| 72 PP_BrowserFont_Trusted_Description* desc) const { | 45 PP_BrowserFont_Trusted_Description* desc) const { |
| 73 desc->face = StringVar::StringToPPVar(face); | 46 desc->face = StringVar::StringToPPVar(face); |
| 74 desc->family = static_cast<PP_BrowserFont_Trusted_Family>(family); | 47 desc->family = static_cast<PP_BrowserFont_Trusted_Family>(family); |
| 75 desc->size = size; | 48 desc->size = size; |
| 76 desc->weight = static_cast<PP_BrowserFont_Trusted_Weight>(weight); | 49 desc->weight = static_cast<PP_BrowserFont_Trusted_Weight>(weight); |
| 77 desc->italic = italic; | 50 desc->italic = italic; |
| 78 desc->small_caps = small_caps; | 51 desc->small_caps = small_caps; |
| 79 desc->letter_spacing = letter_spacing; | 52 desc->letter_spacing = letter_spacing; |
| 80 desc->word_spacing = word_spacing; | 53 desc->word_spacing = word_spacing; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 clip.size.width = 0; | 105 clip.size.width = 0; |
| 133 position.x = 0; | 106 position.x = 0; |
| 134 position.y = 0; | 107 position.y = 0; |
| 135 allow_subpixel_aa = PP_FALSE; | 108 allow_subpixel_aa = PP_FALSE; |
| 136 } | 109 } |
| 137 | 110 |
| 138 PPBFlash_DrawGlyphs_Params::~PPBFlash_DrawGlyphs_Params() {} | 111 PPBFlash_DrawGlyphs_Params::~PPBFlash_DrawGlyphs_Params() {} |
| 139 | 112 |
| 140 } // namespace proxy | 113 } // namespace proxy |
| 141 } // namespace ppapi | 114 } // namespace ppapi |
| OLD | NEW |