| Index: src/ports/SkFontHost_fontconfig.cpp
|
| diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp
|
| index 4c577d8c279b4293ed868ea9aa7227ffcba7c53c..591e9d5aed682fb851255d6f45082df856ad62da 100644
|
| --- a/src/ports/SkFontHost_fontconfig.cpp
|
| +++ b/src/ports/SkFontHost_fontconfig.cpp
|
| @@ -126,41 +126,21 @@ SkTypeface* FontConfigTypeface::LegacyCreateTypeface(
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| -SkStream* FontConfigTypeface::onOpenStream(int* ttcIndex) const {
|
| - SkStream* stream = this->getLocalStream();
|
| +SkStreamAsset* FontConfigTypeface::onOpenStream(int* ttcIndex) const {
|
| + SkStreamAsset* stream = this->getLocalStream();
|
| if (stream) {
|
| - // should have been provided by CreateFromStream()
|
| + // TODO: should have been provided by CreateFromStream()
|
| *ttcIndex = 0;
|
| + return stream->duplicate();
|
| + }
|
|
|
| - SkAutoTDelete<SkStream> dupStream(stream->duplicate());
|
| - if (dupStream) {
|
| - return dupStream.detach();
|
| - }
|
| -
|
| - // TODO: update interface use, remove the following code in this block.
|
| - size_t length = stream->getLength();
|
| -
|
| - const void* memory = stream->getMemoryBase();
|
| - if (memory) {
|
| - return new SkMemoryStream(memory, length, true);
|
| - }
|
| -
|
| - SkAutoTMalloc<uint8_t> allocMemory(length);
|
| - stream->rewind();
|
| - if (length == stream->read(allocMemory.get(), length)) {
|
| - SkAutoTDelete<SkMemoryStream> copyStream(new SkMemoryStream());
|
| - copyStream->setMemoryOwned(allocMemory.detach(), length);
|
| - return copyStream.detach();
|
| - }
|
| - } else {
|
| - SkAutoTUnref<SkFontConfigInterface> fci(RefFCI());
|
| - if (NULL == fci.get()) {
|
| - return NULL;
|
| - }
|
| - stream = fci->openStream(this->getIdentity());
|
| - *ttcIndex = this->getIdentity().fTTCIndex;
|
| + SkAutoTUnref<SkFontConfigInterface> fci(RefFCI());
|
| + if (NULL == fci.get()) {
|
| + return NULL;
|
| }
|
| - return stream;
|
| +
|
| + *ttcIndex = this->getIdentity().fTTCIndex;
|
| + return fci->openStream(this->getIdentity());
|
| }
|
|
|
| void FontConfigTypeface::onGetFamilyName(SkString* familyName) const {
|
|
|