Chromium Code Reviews| Index: skia/ext/skia_utils_base.cc |
| diff --git a/skia/ext/skia_utils_base.cc b/skia/ext/skia_utils_base.cc |
| index f026c07adecd83592f51395ff651397e5e1ff096..335eb27d70719f23de7dc2abefe6dba822085e27 100644 |
| --- a/skia/ext/skia_utils_base.cc |
| +++ b/skia/ext/skia_utils_base.cc |
| @@ -40,6 +40,24 @@ bool ReadSkFontIdentity(base::PickleIterator* iter, |
| return true; |
| } |
| +bool ReadSkFontStyle(base::PickleIterator* iter, SkFontStyle* style) { |
| + uint16_t reply_weight; |
| + uint16_t reply_width; |
| + uint16_t reply_slant; |
| + |
| + if (!iter->ReadUInt16(&reply_weight) || |
| + !iter->ReadUInt16(&reply_width) || |
| + !iter->ReadUInt16(&reply_slant)) |
| + return false; |
| + |
| + if (style) { |
|
dcheng
2016/04/12 17:11:23
Seems odd that this is an optional parameter. It d
bungeman-chromium
2016/04/12 18:15:38
I think the original intent was to avoid the local
bungeman-chromium
2016/04/12 18:47:04
To provide an example, taking advantage of the way
|
| + *style = SkFontStyle(reply_weight, |
| + reply_width, |
| + static_cast<SkFontStyle::Slant>(reply_slant)); |
| + } |
| + return true; |
| +} |
| + |
| bool WriteSkString(base::Pickle* pickle, const SkString& str) { |
| return pickle->WriteData(str.c_str(), str.size()); |
| } |
| @@ -51,6 +69,12 @@ bool WriteSkFontIdentity(base::Pickle* pickle, |
| WriteSkString(pickle, identity.fString); |
| } |
| +bool WriteSkFontStyle(base::Pickle* pickle, SkFontStyle style) { |
| + return pickle->WriteUInt16(style.weight()) && |
| + pickle->WriteUInt16(style.width()) && |
| + pickle->WriteUInt16(style.slant()); |
| +} |
| + |
| SkPixelGeometry ComputeDefaultPixelGeometry() { |
| SkFontHost::LCDOrder order = SkFontHost::GetSubpixelOrder(); |
| if (SkFontHost::kNONE_LCDOrder == order) { |