diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-14 17:08:00 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-14 17:08:00 +0000 |
commit | fb35dcfafd929772b185516173a92c619aa97421 (patch) | |
tree | cc7260344ab7f028274c312d646685adcebd95b5 /ppapi/proxy/serialized_structs.cc | |
parent | da441db001417a34e7378a95481d237a637488a7 (diff) | |
download | chromium_src-fb35dcfafd929772b185516173a92c619aa97421.zip chromium_src-fb35dcfafd929772b185516173a92c619aa97421.tar.gz chromium_src-fb35dcfafd929772b185516173a92c619aa97421.tar.bz2 |
Implement DrawGlyphs and refactor the FontDescription serialization such
that it can be reused for this code.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66081 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/serialized_structs.cc')
-rw-r--r-- | ppapi/proxy/serialized_structs.cc | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/ppapi/proxy/serialized_structs.cc b/ppapi/proxy/serialized_structs.cc new file mode 100644 index 0000000..fa71f71 --- /dev/null +++ b/ppapi/proxy/serialized_structs.cc @@ -0,0 +1,53 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/proxy/serialized_structs.h" + +#include "ppapi/c/dev/ppb_font_dev.h" +#include "ppapi/c/pp_rect.h" + +namespace pp { +namespace proxy { + +void SerializedFontDescription::SetFromPPFontDescription( + Dispatcher* dispatcher, + const PP_FontDescription_Dev& desc, + bool source_owns_ref) { + if (source_owns_ref) + face = SerializedVarSendInput(dispatcher, desc.face); + else + SerializedVarReturnValue(&face).Return(dispatcher, desc.face); + + family = desc.family; + size = desc.size; + weight = desc.weight; + italic = desc.italic; + small_caps = desc.small_caps; + letter_spacing = desc.letter_spacing; + word_spacing = desc.word_spacing; +} + +void SerializedFontDescription::SetToPPFontDescription( + Dispatcher* dispatcher, + PP_FontDescription_Dev* desc, + bool dest_owns_ref) const { + if (dest_owns_ref) { + ReceiveSerializedVarReturnValue face_return_value; + *static_cast<SerializedVar*>(&face_return_value) = face; + desc->face = face_return_value.Return(dispatcher); + } else { + desc->face = SerializedVarReceiveInput(face).Get(dispatcher); + } + + desc->family = static_cast<PP_FontFamily_Dev>(family); + desc->size = size; + desc->weight = static_cast<PP_FontWeight_Dev>(weight); + desc->italic = italic; + desc->small_caps = small_caps; + desc->letter_spacing = letter_spacing; + desc->word_spacing = word_spacing; +} + +} // namespace proxy +} // namespace pp |