aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/SkRWBuffer.cpp17
-rw-r--r--src/core/SkStream.cpp29
-rw-r--r--src/ports/SkFontMgr_FontConfigInterface.cpp4
-rw-r--r--src/ports/SkFontMgr_android.cpp4
-rw-r--r--src/ports/SkFontMgr_custom.cpp4
-rw-r--r--src/ports/SkFontMgr_fontconfig.cpp4
-rw-r--r--src/ports/SkFontMgr_win_dw.cpp4
-rw-r--r--src/utils/SkFrontBufferedStream.cpp6
-rw-r--r--src/utils/win/SkDWriteFontFileStream.cpp14
-rw-r--r--src/utils/win/SkDWriteFontFileStream.h8
10 files changed, 12 insertions, 82 deletions
diff --git a/src/core/SkRWBuffer.cpp b/src/core/SkRWBuffer.cpp
index 8ec2baafac..b90d617b0b 100644
--- a/src/core/SkRWBuffer.cpp
+++ b/src/core/SkRWBuffer.cpp
@@ -315,10 +315,6 @@ public:
return fBuffer->size() == fGlobalOffset;
}
-#ifdef SK_SUPPORT_LEGACY_STREAM_API
- SkStreamAsset* duplicate() const override { return new SkROBufferStreamAsset(fBuffer); }
-#endif
-
size_t getPosition() const override {
return fGlobalOffset;
}
@@ -343,23 +339,16 @@ public:
return true;
}
-#ifdef SK_SUPPORT_LEGACY_STREAM_API
- SkStreamAsset* fork() const override {
- SkStreamAsset* clone = this->duplicate();
- clone->seek(this->getPosition());
- return clone;
+private:
+ SkStreamAsset* onDuplicate() const override {
+ return new SkROBufferStreamAsset(fBuffer);
}
-#endif
-private:
-#ifndef SK_SUPPORT_LEGACY_STREAM_API
- SkStreamAsset* onDuplicate() const override { return new SkROBufferStreamAsset(fBuffer); }
SkStreamAsset* onFork() const override {
auto clone = this->duplicate();
clone->seek(this->getPosition());
return clone.release();
}
-#endif
sk_sp<SkROBuffer> fBuffer;
SkROBuffer::Iter fIter;
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index bc638c249a..2c5e9eba2f 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -5,7 +5,6 @@
* found in the LICENSE file.
*/
-
#include "SkStream.h"
#include "SkStreamPriv.h"
#include "SkData.h"
@@ -15,17 +14,8 @@
#include "SkOSFile.h"
#include "SkTypes.h"
-#ifdef SK_SUPPORT_LEGACY_STREAM_API
-#define DUP_NAME duplicate
-#define FORK_NAME fork
-#else
-#define DUP_NAME onDuplicate
-#define FORK_NAME onFork
-#endif
-
///////////////////////////////////////////////////////////////////////////////
-
int8_t SkStream::readS8() {
int8_t value;
SkDEBUGCODE(size_t len =) this->read(&value, 1);
@@ -224,7 +214,7 @@ bool SkFILEStream::rewind() {
return true;
}
-SkStreamAsset* SkFILEStream::DUP_NAME() const {
+SkStreamAsset* SkFILEStream::onDuplicate() const {
// TODO: fOriginalOffset instead of 0.
return new SkFILEStream(fFILE, fSize, 0, fOriginalOffset);
}
@@ -242,7 +232,7 @@ bool SkFILEStream::move(long offset) {
return this->seek(fOffset + offset);
}
-SkStreamAsset* SkFILEStream::FORK_NAME() const {
+SkStreamAsset* SkFILEStream::onFork() const {
return new SkFILEStream(fFILE, fSize, fOffset, fOriginalOffset);
}
@@ -350,12 +340,7 @@ bool SkMemoryStream::rewind() {
return true;
}
-#ifdef SK_SUPPORT_LEGACY_STREAM_API
-SkMemoryStream* SkMemoryStream::duplicate() const
-#else
-SkMemoryStream* SkMemoryStream::onDuplicate() const
-#endif
-{
+SkMemoryStream* SkMemoryStream::onDuplicate() const {
return new SkMemoryStream(fData);
}
@@ -374,7 +359,7 @@ bool SkMemoryStream::move(long offset) {
return this->seek(fOffset + offset);
}
-SkMemoryStream* SkMemoryStream::FORK_NAME() const {
+SkMemoryStream* SkMemoryStream::onFork() const {
std::unique_ptr<SkMemoryStream> that(this->duplicate());
that->seek(fOffset);
return that.release();
@@ -746,7 +731,7 @@ public:
return true;
}
- SkBlockMemoryStream* DUP_NAME() const override {
+ SkBlockMemoryStream* onDuplicate() const override {
return new SkBlockMemoryStream(fBlockMemory, fSize);
}
@@ -775,8 +760,8 @@ public:
return seek(fOffset + offset);
}
- SkBlockMemoryStream* FORK_NAME() const override {
- SkBlockMemoryStream* that = this->DUP_NAME();
+ SkBlockMemoryStream* onFork() const override {
+ SkBlockMemoryStream* that = this->onDuplicate();
that->fCurrent = this->fCurrent;
that->fOffset = this->fOffset;
that->fCurrentOffset = this->fCurrentOffset;
diff --git a/src/ports/SkFontMgr_FontConfigInterface.cpp b/src/ports/SkFontMgr_FontConfigInterface.cpp
index aec76af685..bfc600e74e 100644
--- a/src/ports/SkFontMgr_FontConfigInterface.cpp
+++ b/src/ports/SkFontMgr_FontConfigInterface.cpp
@@ -26,11 +26,7 @@ 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 0ec2edba6a..637d2f3182 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -129,11 +129,7 @@ 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 b38f48c322..f5aa7a3aa5 100644
--- a/src/ports/SkFontMgr_custom.cpp
+++ b/src/ports/SkFontMgr_custom.cpp
@@ -60,11 +60,7 @@ 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 8b3a058e9e..1524fc9f98 100644
--- a/src/ports/SkFontMgr_fontconfig.cpp
+++ b/src/ports/SkFontMgr_fontconfig.cpp
@@ -435,11 +435,7 @@ 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 b349c833a0..eca20d94b7 100644
--- a/src/ports/SkFontMgr_win_dw.cpp
+++ b/src/ports/SkFontMgr_win_dw.cpp
@@ -86,11 +86,7 @@ HRESULT StreamFontFileLoader::CreateStreamFromKey(
IDWriteFontFileStream** fontFileStream)
{
SkTScopedComPtr<SkDWriteFontFileStreamWrapper> stream;
-#ifdef SK_SUPPORT_LEGACY_STREAM_API
- HR(SkDWriteFontFileStreamWrapper::Create(fStream->duplicate(), &stream));
-#else
HR(SkDWriteFontFileStreamWrapper::Create(fStream->duplicate().release(), &stream));
-#endif
*fontFileStream = stream.release();
return S_OK;
}
diff --git a/src/utils/SkFrontBufferedStream.cpp b/src/utils/SkFrontBufferedStream.cpp
index 77c484af64..9205d104a3 100644
--- a/src/utils/SkFrontBufferedStream.cpp
+++ b/src/utils/SkFrontBufferedStream.cpp
@@ -26,14 +26,8 @@ public:
size_t getLength() const override { return fLength; }
-#ifdef SK_SUPPORT_LEGACY_STREAM_API
- SkStreamRewindable* duplicate() const override { return nullptr; }
-#endif
-
private:
-#ifndef SK_SUPPORT_LEGACY_STREAM_API
SkStreamRewindable* onDuplicate() const override { return nullptr; }
-#endif
std::unique_ptr<SkStream> fStream;
const bool fHasLength;
diff --git a/src/utils/win/SkDWriteFontFileStream.cpp b/src/utils/win/SkDWriteFontFileStream.cpp
index a43e163481..54ec7c7159 100644
--- a/src/utils/win/SkDWriteFontFileStream.cpp
+++ b/src/utils/win/SkDWriteFontFileStream.cpp
@@ -86,12 +86,7 @@ bool SkDWriteFontFileStream::rewind() {
return true;
}
-#ifdef SK_SUPPORT_LEGACY_STREAM_API
-SkDWriteFontFileStream* SkDWriteFontFileStream::duplicate() const
-#else
-SkDWriteFontFileStream* SkDWriteFontFileStream::onDuplicate() const
-#endif
-{
+SkDWriteFontFileStream* SkDWriteFontFileStream::onDuplicate() const {
return new SkDWriteFontFileStream(fFontFileStream.get());
}
@@ -109,12 +104,7 @@ bool SkDWriteFontFileStream::move(long offset) {
return seek(fPos + offset);
}
-#ifdef SK_SUPPORT_LEGACY_STREAM_API
-SkDWriteFontFileStream* SkDWriteFontFileStream::fork() const
-#else
-SkDWriteFontFileStream* SkDWriteFontFileStream::onFork() const
-#endif
-{
+SkDWriteFontFileStream* SkDWriteFontFileStream::onFork() const {
std::unique_ptr<SkDWriteFontFileStream> that(this->duplicate());
that->seek(fPos);
return that.release();
diff --git a/src/utils/win/SkDWriteFontFileStream.h b/src/utils/win/SkDWriteFontFileStream.h
index 9b65752382..680b3ab8a8 100644
--- a/src/utils/win/SkDWriteFontFileStream.h
+++ b/src/utils/win/SkDWriteFontFileStream.h
@@ -34,24 +34,16 @@ public:
size_t getLength() const override;
const void* getMemoryBase() override;
-#ifdef SK_SUPPORT_LEGACY_STREAM_API
- SkDWriteFontFileStream* duplicate() const override;
- SkDWriteFontFileStream* fork() const override;
-#else
std::unique_ptr<SkDWriteFontFileStream> duplicate() const {
return std::unique_ptr<SkDWriteFontFileStream>(this->onDuplicate());
}
std::unique_ptr<SkDWriteFontFileStream> fork() const {
return std::unique_ptr<SkDWriteFontFileStream>(this->onFork());
}
-#endif
-
private:
-#ifndef SK_SUPPORT_LEGACY_STREAM_API
SkDWriteFontFileStream* onDuplicate() const override;
SkDWriteFontFileStream* onFork() const override;
-#endif
SkTScopedComPtr<IDWriteFontFileStream> fFontFileStream;
size_t fPos;