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.)

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

mercurial