diff options
author | Mike Reed <reed@google.com> | 2017-09-15 11:37:15 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-15 18:46:45 +0000 |
commit | 49f1f34438d3431f6d7e32847accd2ba96948a73 (patch) | |
tree | c4e0342c3350c546573fb2add99597e92c9ca66c /src/ports | |
parent | 226e2032e8e37068a409aeb37aac79608fbd315d (diff) |
use unique_ptr for stream api
Bug: skia:6888
Change-Id: I3459b4913982a7cae1c0061697c82cc65ad9a2d8
Reviewed-on: https://skia-review.googlesource.com/26740
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/ports')
-rw-r--r-- | src/ports/SkFontMgr_FontConfigInterface.cpp | 4 | ||||
-rw-r--r-- | src/ports/SkFontMgr_android.cpp | 4 | ||||
-rw-r--r-- | src/ports/SkFontMgr_custom.cpp | 4 | ||||
-rw-r--r-- | src/ports/SkFontMgr_fontconfig.cpp | 4 | ||||
-rw-r--r-- | src/ports/SkFontMgr_win_dw.cpp | 2 |
5 files changed, 17 insertions, 1 deletions
diff --git a/src/ports/SkFontMgr_FontConfigInterface.cpp b/src/ports/SkFontMgr_FontConfigInterface.cpp index 99092b6b98..aec76af685 100644 --- a/src/ports/SkFontMgr_FontConfigInterface.cpp +++ b/src/ports/SkFontMgr_FontConfigInterface.cpp @@ -26,7 +26,11 @@ SkStreamAsset* SkTypeface_FCI::onOpenStream(int* ttcIndex) const { if (!stream) { return nullptr; } +#ifdef SK_SUPPORT_LEGACY_STREAM_API return stream->duplicate(); +#else + return stream->duplicate().release(); +#endif } return fFCI->openStream(this->getIdentity()); diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp index 2dd3221466..0ec2edba6a 100644 --- a/src/ports/SkFontMgr_android.cpp +++ b/src/ports/SkFontMgr_android.cpp @@ -129,7 +129,11 @@ public: SkStreamAsset* onOpenStream(int* ttcIndex) const override { *ttcIndex = fData->getIndex(); +#ifdef SK_SUPPORT_LEGACY_STREAM_API return fData->getStream()->duplicate(); +#else + return fData->getStream()->duplicate().release(); +#endif } std::unique_ptr<SkFontData> onMakeFontData() const override { diff --git a/src/ports/SkFontMgr_custom.cpp b/src/ports/SkFontMgr_custom.cpp index 91a590827c..b38f48c322 100644 --- a/src/ports/SkFontMgr_custom.cpp +++ b/src/ports/SkFontMgr_custom.cpp @@ -60,7 +60,11 @@ SkTypeface_Stream::SkTypeface_Stream(std::unique_ptr<SkFontData> fontData, SkStreamAsset* SkTypeface_Stream::onOpenStream(int* ttcIndex) const { *ttcIndex = fData->getIndex(); +#ifdef SK_SUPPORT_LEGACY_STREAM_API return fData->getStream()->duplicate(); +#else + return fData->getStream()->duplicate().release(); +#endif } std::unique_ptr<SkFontData> SkTypeface_Stream::onMakeFontData() const { diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp index 95c963d69f..8b3a058e9e 100644 --- a/src/ports/SkFontMgr_fontconfig.cpp +++ b/src/ports/SkFontMgr_fontconfig.cpp @@ -435,7 +435,11 @@ public: SkStreamAsset* onOpenStream(int* ttcIndex) const override { *ttcIndex = fData->getIndex(); +#ifdef SK_SUPPORT_LEGACY_STREAM_API return fData->getStream()->duplicate(); +#else + return fData->getStream()->duplicate().release(); +#endif } std::unique_ptr<SkFontData> onMakeFontData() const override { diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp index 1fd300ca1d..eca20d94b7 100644 --- a/src/ports/SkFontMgr_win_dw.cpp +++ b/src/ports/SkFontMgr_win_dw.cpp @@ -86,7 +86,7 @@ HRESULT StreamFontFileLoader::CreateStreamFromKey( IDWriteFontFileStream** fontFileStream) { SkTScopedComPtr<SkDWriteFontFileStreamWrapper> stream; - HR(SkDWriteFontFileStreamWrapper::Create(fStream->duplicate(), &stream)); + HR(SkDWriteFontFileStreamWrapper::Create(fStream->duplicate().release(), &stream)); *fontFileStream = stream.release(); return S_OK; } |