| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "skia/ext/skia_utils_base.h" | 5 #include "skia/ext/skia_utils_base.h" |
| 6 | 6 |
| 7 namespace skia { | 7 namespace skia { |
| 8 | 8 |
| 9 bool ReadSkString(const Pickle& pickle, PickleIterator* iter, SkString* str) { | 9 bool ReadSkString(PickleIterator* iter, SkString* str) { |
| 10 int reply_length; | 10 int reply_length; |
| 11 const char* reply_text; | 11 const char* reply_text; |
| 12 | 12 |
| 13 if (!pickle.ReadData(iter, &reply_text, &reply_length)) | 13 if (!iter->ReadData(&reply_text, &reply_length)) |
| 14 return false; | 14 return false; |
| 15 | 15 |
| 16 if (str) | 16 if (str) |
| 17 str->set(reply_text, reply_length); | 17 str->set(reply_text, reply_length); |
| 18 return true; | 18 return true; |
| 19 } | 19 } |
| 20 | 20 |
| 21 bool ReadSkFontIdentity(const Pickle& pickle, PickleIterator* iter, | 21 bool ReadSkFontIdentity(PickleIterator* iter, |
| 22 SkFontConfigInterface::FontIdentity* identity) { | 22 SkFontConfigInterface::FontIdentity* identity) { |
| 23 uint32_t reply_id; | 23 uint32_t reply_id; |
| 24 uint32_t reply_ttcIndex; | 24 uint32_t reply_ttcIndex; |
| 25 int reply_length; | 25 int reply_length; |
| 26 const char* reply_text; | 26 const char* reply_text; |
| 27 | 27 |
| 28 if (!pickle.ReadUInt32(iter, &reply_id) || | 28 if (!iter->ReadUInt32(&reply_id) || |
| 29 !pickle.ReadUInt32(iter, &reply_ttcIndex) || | 29 !iter->ReadUInt32(&reply_ttcIndex) || |
| 30 !pickle.ReadData(iter, &reply_text, &reply_length)) | 30 !iter->ReadData(&reply_text, &reply_length)) |
| 31 return false; | 31 return false; |
| 32 | 32 |
| 33 if (identity) { | 33 if (identity) { |
| 34 identity->fID = reply_id; | 34 identity->fID = reply_id; |
| 35 identity->fTTCIndex = reply_ttcIndex; | 35 identity->fTTCIndex = reply_ttcIndex; |
| 36 identity->fString.set(reply_text, reply_length); | 36 identity->fString.set(reply_text, reply_length); |
| 37 } | 37 } |
| 38 return true; | 38 return true; |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool WriteSkString(Pickle* pickle, const SkString& str) { | 41 bool WriteSkString(Pickle* pickle, const SkString& str) { |
| 42 return pickle->WriteData(str.c_str(), str.size()); | 42 return pickle->WriteData(str.c_str(), str.size()); |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool WriteSkFontIdentity(Pickle* pickle, | 45 bool WriteSkFontIdentity(Pickle* pickle, |
| 46 const SkFontConfigInterface::FontIdentity& identity) { | 46 const SkFontConfigInterface::FontIdentity& identity) { |
| 47 return pickle->WriteUInt32(identity.fID) && | 47 return pickle->WriteUInt32(identity.fID) && |
| 48 pickle->WriteUInt32(identity.fTTCIndex) && | 48 pickle->WriteUInt32(identity.fTTCIndex) && |
| 49 WriteSkString(pickle, identity.fString); | 49 WriteSkString(pickle, identity.fString); |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace skia | 52 } // namespace skia |
| 53 | 53 |
| OLD | NEW |