gfx/skia/trunk/src/core/SkPaintOptionsAndroid.cpp

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1
michael@0 2 /*
michael@0 3 * Copyright 2012 The Android Open Source Project
michael@0 4 *
michael@0 5 * Use of this source code is governed by a BSD-style license that can be
michael@0 6 * found in the LICENSE file.
michael@0 7 */
michael@0 8
michael@0 9 #include "SkPaintOptionsAndroid.h"
michael@0 10 #include "SkReadBuffer.h"
michael@0 11 #include "SkWriteBuffer.h"
michael@0 12 #include "SkTDict.h"
michael@0 13 #include "SkThread.h"
michael@0 14 #include <cstring>
michael@0 15
michael@0 16 SkLanguage SkLanguage::getParent() const {
michael@0 17 SkASSERT(!fTag.isEmpty());
michael@0 18 const char* tag = fTag.c_str();
michael@0 19
michael@0 20 // strip off the rightmost "-.*"
michael@0 21 const char* parentTagEnd = strrchr(tag, '-');
michael@0 22 if (parentTagEnd == NULL) {
michael@0 23 return SkLanguage();
michael@0 24 }
michael@0 25 size_t parentTagLen = parentTagEnd - tag;
michael@0 26 return SkLanguage(tag, parentTagLen);
michael@0 27 }
michael@0 28
michael@0 29 void SkPaintOptionsAndroid::flatten(SkWriteBuffer& buffer) const {
michael@0 30 buffer.writeUInt(fFontVariant);
michael@0 31 buffer.writeString(fLanguage.getTag().c_str());
michael@0 32 buffer.writeBool(fUseFontFallbacks);
michael@0 33 }
michael@0 34
michael@0 35 void SkPaintOptionsAndroid::unflatten(SkReadBuffer& buffer) {
michael@0 36 fFontVariant = (FontVariant)buffer.readUInt();
michael@0 37 SkString tag;
michael@0 38 buffer.readString(&tag);
michael@0 39 fLanguage = SkLanguage(tag);
michael@0 40 fUseFontFallbacks = buffer.readBool();
michael@0 41 }

mercurial