diff options
author | reed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-12 13:11:54 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-12 13:11:54 +0000 |
commit | 9628e0d1b18acb3ef20752bfa19737338d26346c (patch) | |
tree | 351c06ac28c8e89f99825fa0ef82250b36bd006f /skia/ext/skia_utils_base.cc | |
parent | 0b57b3ae0fcffa1f1734c19b92c1b3c8ecb3a4c7 (diff) | |
download | chromium_src-9628e0d1b18acb3ef20752bfa19737338d26346c.zip chromium_src-9628e0d1b18acb3ef20752bfa19737338d26346c.tar.gz chromium_src-9628e0d1b18acb3ef20752bfa19737338d26346c.tar.bz2 |
re-land 187283 -- switch to skia's version of SkFontHost_fontconfig
add suppressions.txt to account for global typeface cache
Review URL: https://codereview.chromium.org/12764009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187572 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/skia_utils_base.cc')
-rw-r--r-- | skia/ext/skia_utils_base.cc | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/skia/ext/skia_utils_base.cc b/skia/ext/skia_utils_base.cc new file mode 100644 index 0000000..07c06bb --- /dev/null +++ b/skia/ext/skia_utils_base.cc @@ -0,0 +1,53 @@ +// Copyright (c) 2013 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 "skia/ext/skia_utils_base.h" + +namespace skia { + +bool ReadSkString(const Pickle& pickle, PickleIterator* iter, SkString* str) { + int reply_length; + const char* reply_text; + + if (!pickle.ReadData(iter, &reply_text, &reply_length)) + return false; + + if (str) + str->set(reply_text, reply_length); + return true; +} + +bool ReadSkFontIdentity(const Pickle& pickle, PickleIterator* iter, + SkFontConfigInterface::FontIdentity* identity) { + uint32_t reply_id; + uint32_t reply_ttcIndex; + int reply_length; + const char* reply_text; + + if (!pickle.ReadUInt32(iter, &reply_id) || + !pickle.ReadUInt32(iter, &reply_ttcIndex) || + !pickle.ReadData(iter, &reply_text, &reply_length)) + return false; + + if (identity) { + identity->fID = reply_id; + identity->fTTCIndex = reply_ttcIndex; + identity->fString.set(reply_text, reply_length); + } + return true; +} + +bool WriteSkString(Pickle* pickle, const SkString& str) { + return pickle->WriteData(str.c_str(), str.size()); +} + +bool WriteSkFontIdentity(Pickle* pickle, + const SkFontConfigInterface::FontIdentity& identity) { + return pickle->WriteUInt32(identity.fID) && + pickle->WriteUInt32(identity.fTTCIndex) && + WriteSkString(pickle, identity.fString); +} + +} // namespace skia + |