remove dead code for STREAM_API
Bug: skia: Change-Id: I5c5a65710af443c60a3d13fb309ce31309be7f74 Reviewed-on: https://skia-review.googlesource.com/49460 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
d4f100dad9
commit
0ca21466da
@ -53,11 +53,7 @@ protected:
|
|||||||
SkFontArguments::VariationPosition position =
|
SkFontArguments::VariationPosition position =
|
||||||
{ coordinates, SK_ARRAY_COUNT(coordinates) };
|
{ coordinates, SK_ARRAY_COUNT(coordinates) };
|
||||||
paint.setTypeface(sk_sp<SkTypeface>(fontMgr->createFromStream(
|
paint.setTypeface(sk_sp<SkTypeface>(fontMgr->createFromStream(
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
distortable->duplicate(),
|
|
||||||
#else
|
|
||||||
distortable->duplicate().release(),
|
distortable->duplicate().release(),
|
||||||
#endif
|
|
||||||
SkFontArguments().setVariationDesignPosition(position))));
|
SkFontArguments().setVariationDesignPosition(position))));
|
||||||
|
|
||||||
SkAutoCanvasRestore acr(canvas, true);
|
SkAutoCanvasRestore acr(canvas, true);
|
||||||
|
@ -101,16 +101,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual bool rewind() { return false; }
|
virtual bool rewind() { return false; }
|
||||||
|
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
/** Duplicates this stream. If this cannot be done, returns NULL.
|
|
||||||
* The returned stream will be positioned at the beginning of its data.
|
|
||||||
*/
|
|
||||||
virtual SkStreamRewindable* duplicate() const { return nullptr; }
|
|
||||||
/** Duplicates this stream. If this cannot be done, returns NULL.
|
|
||||||
* The returned stream will be positioned the same as this stream.
|
|
||||||
*/
|
|
||||||
virtual SkStreamSeekable* fork() const { return nullptr; }
|
|
||||||
#else
|
|
||||||
/** Duplicates this stream. If this cannot be done, returns NULL.
|
/** Duplicates this stream. If this cannot be done, returns NULL.
|
||||||
* The returned stream will be positioned at the beginning of its data.
|
* The returned stream will be positioned at the beginning of its data.
|
||||||
*/
|
*/
|
||||||
@ -123,7 +113,6 @@ public:
|
|||||||
std::unique_ptr<SkStream> fork() const {
|
std::unique_ptr<SkStream> fork() const {
|
||||||
return std::unique_ptr<SkStream>(this->onFork());
|
return std::unique_ptr<SkStream>(this->onFork());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
//SkStreamSeekable
|
//SkStreamSeekable
|
||||||
/** Returns true if this stream can report it's current position. */
|
/** Returns true if this stream can report it's current position. */
|
||||||
@ -155,52 +144,39 @@ public:
|
|||||||
virtual const void* getMemoryBase() { return nullptr; }
|
virtual const void* getMemoryBase() { return nullptr; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifndef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
virtual SkStream* onDuplicate() const { return nullptr; }
|
virtual SkStream* onDuplicate() const { return nullptr; }
|
||||||
virtual SkStream* onFork() const { return nullptr; }
|
virtual SkStream* onFork() const { return nullptr; }
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** SkStreamRewindable is a SkStream for which rewind and duplicate are required. */
|
/** SkStreamRewindable is a SkStream for which rewind and duplicate are required. */
|
||||||
class SK_API SkStreamRewindable : public SkStream {
|
class SK_API SkStreamRewindable : public SkStream {
|
||||||
public:
|
public:
|
||||||
bool rewind() override = 0;
|
bool rewind() override = 0;
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkStreamRewindable* duplicate() const override = 0;
|
|
||||||
#else
|
|
||||||
std::unique_ptr<SkStreamRewindable> duplicate() const {
|
std::unique_ptr<SkStreamRewindable> duplicate() const {
|
||||||
return std::unique_ptr<SkStreamRewindable>(this->onDuplicate());
|
return std::unique_ptr<SkStreamRewindable>(this->onDuplicate());
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
SkStreamRewindable* onDuplicate() const override = 0;
|
SkStreamRewindable* onDuplicate() const override = 0;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** SkStreamSeekable is a SkStreamRewindable for which position, seek, move, and fork are required. */
|
/** SkStreamSeekable is a SkStreamRewindable for which position, seek, move, and fork are required. */
|
||||||
class SK_API SkStreamSeekable : public SkStreamRewindable {
|
class SK_API SkStreamSeekable : public SkStreamRewindable {
|
||||||
public:
|
public:
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkStreamSeekable* duplicate() const override = 0;
|
|
||||||
#else
|
|
||||||
std::unique_ptr<SkStreamSeekable> duplicate() const {
|
std::unique_ptr<SkStreamSeekable> duplicate() const {
|
||||||
return std::unique_ptr<SkStreamSeekable>(this->onDuplicate());
|
return std::unique_ptr<SkStreamSeekable>(this->onDuplicate());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool hasPosition() const override { return true; }
|
bool hasPosition() const override { return true; }
|
||||||
size_t getPosition() const override = 0;
|
size_t getPosition() const override = 0;
|
||||||
bool seek(size_t position) override = 0;
|
bool seek(size_t position) override = 0;
|
||||||
bool move(long offset) override = 0;
|
bool move(long offset) override = 0;
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkStreamSeekable* fork() const override = 0;
|
|
||||||
#else
|
|
||||||
std::unique_ptr<SkStreamSeekable> fork() const {
|
std::unique_ptr<SkStreamSeekable> fork() const {
|
||||||
return std::unique_ptr<SkStreamSeekable>(this->onFork());
|
return std::unique_ptr<SkStreamSeekable>(this->onFork());
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
SkStreamSeekable* onDuplicate() const override = 0;
|
SkStreamSeekable* onDuplicate() const override = 0;
|
||||||
SkStreamSeekable* onFork() const override = 0;
|
SkStreamSeekable* onFork() const override = 0;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** SkStreamAsset is a SkStreamSeekable for which getLength is required. */
|
/** SkStreamAsset is a SkStreamSeekable for which getLength is required. */
|
||||||
@ -209,10 +185,6 @@ public:
|
|||||||
bool hasLength() const override { return true; }
|
bool hasLength() const override { return true; }
|
||||||
size_t getLength() const override = 0;
|
size_t getLength() const override = 0;
|
||||||
|
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkStreamAsset* duplicate() const override = 0;
|
|
||||||
SkStreamAsset* fork() const override = 0;
|
|
||||||
#else
|
|
||||||
std::unique_ptr<SkStreamAsset> duplicate() const {
|
std::unique_ptr<SkStreamAsset> duplicate() const {
|
||||||
return std::unique_ptr<SkStreamAsset>(this->onDuplicate());
|
return std::unique_ptr<SkStreamAsset>(this->onDuplicate());
|
||||||
}
|
}
|
||||||
@ -222,7 +194,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
SkStreamAsset* onDuplicate() const override = 0;
|
SkStreamAsset* onDuplicate() const override = 0;
|
||||||
SkStreamAsset* onFork() const override = 0;
|
SkStreamAsset* onFork() const override = 0;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** SkStreamMemory is a SkStreamAsset for which getMemoryBase is required. */
|
/** SkStreamMemory is a SkStreamAsset for which getMemoryBase is required. */
|
||||||
@ -230,10 +201,6 @@ class SK_API SkStreamMemory : public SkStreamAsset {
|
|||||||
public:
|
public:
|
||||||
const void* getMemoryBase() override = 0;
|
const void* getMemoryBase() override = 0;
|
||||||
|
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkStreamMemory* duplicate() const override = 0;
|
|
||||||
SkStreamMemory* fork() const override = 0;
|
|
||||||
#else
|
|
||||||
std::unique_ptr<SkStreamMemory> duplicate() const {
|
std::unique_ptr<SkStreamMemory> duplicate() const {
|
||||||
return std::unique_ptr<SkStreamMemory>(this->onDuplicate());
|
return std::unique_ptr<SkStreamMemory>(this->onDuplicate());
|
||||||
}
|
}
|
||||||
@ -243,7 +210,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
SkStreamMemory* onDuplicate() const override = 0;
|
SkStreamMemory* onDuplicate() const override = 0;
|
||||||
SkStreamMemory* onFork() const override = 0;
|
SkStreamMemory* onFork() const override = 0;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SK_API SkWStream : SkNoncopyable {
|
class SK_API SkWStream : SkNoncopyable {
|
||||||
@ -345,24 +311,17 @@ public:
|
|||||||
bool isAtEnd() const override;
|
bool isAtEnd() const override;
|
||||||
|
|
||||||
bool rewind() override;
|
bool rewind() override;
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkStreamAsset* duplicate() const override;
|
|
||||||
#else
|
|
||||||
std::unique_ptr<SkStreamAsset> duplicate() const {
|
std::unique_ptr<SkStreamAsset> duplicate() const {
|
||||||
return std::unique_ptr<SkStreamAsset>(this->onDuplicate());
|
return std::unique_ptr<SkStreamAsset>(this->onDuplicate());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
size_t getPosition() const override;
|
size_t getPosition() const override;
|
||||||
bool seek(size_t position) override;
|
bool seek(size_t position) override;
|
||||||
bool move(long offset) override;
|
bool move(long offset) override;
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkStreamAsset* fork() const override;
|
|
||||||
#else
|
|
||||||
std::unique_ptr<SkStreamAsset> fork() const {
|
std::unique_ptr<SkStreamAsset> fork() const {
|
||||||
return std::unique_ptr<SkStreamAsset>(this->onFork());
|
return std::unique_ptr<SkStreamAsset>(this->onFork());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
size_t getLength() const override;
|
size_t getLength() const override;
|
||||||
|
|
||||||
@ -370,10 +329,8 @@ private:
|
|||||||
explicit SkFILEStream(std::shared_ptr<FILE>, size_t size, size_t offset);
|
explicit SkFILEStream(std::shared_ptr<FILE>, size_t size, size_t offset);
|
||||||
explicit SkFILEStream(std::shared_ptr<FILE>, size_t size, size_t offset, size_t originalOffset);
|
explicit SkFILEStream(std::shared_ptr<FILE>, size_t size, size_t offset, size_t originalOffset);
|
||||||
|
|
||||||
#ifndef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkStreamAsset* onDuplicate() const override;
|
SkStreamAsset* onDuplicate() const override;
|
||||||
SkStreamAsset* onFork() const override;
|
SkStreamAsset* onFork() const override;
|
||||||
#endif
|
|
||||||
|
|
||||||
std::shared_ptr<FILE> fFILE;
|
std::shared_ptr<FILE> fFILE;
|
||||||
// My own council will I keep on sizes and offsets.
|
// My own council will I keep on sizes and offsets.
|
||||||
@ -430,34 +387,26 @@ public:
|
|||||||
size_t peek(void* buffer, size_t size) const override;
|
size_t peek(void* buffer, size_t size) const override;
|
||||||
|
|
||||||
bool rewind() override;
|
bool rewind() override;
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkMemoryStream* duplicate() const override;
|
|
||||||
#else
|
|
||||||
std::unique_ptr<SkMemoryStream> duplicate() const {
|
std::unique_ptr<SkMemoryStream> duplicate() const {
|
||||||
return std::unique_ptr<SkMemoryStream>(this->onDuplicate());
|
return std::unique_ptr<SkMemoryStream>(this->onDuplicate());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
size_t getPosition() const override;
|
size_t getPosition() const override;
|
||||||
bool seek(size_t position) override;
|
bool seek(size_t position) override;
|
||||||
bool move(long offset) override;
|
bool move(long offset) override;
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkMemoryStream* fork() const override;
|
|
||||||
#else
|
|
||||||
std::unique_ptr<SkMemoryStream> fork() const {
|
std::unique_ptr<SkMemoryStream> fork() const {
|
||||||
return std::unique_ptr<SkMemoryStream>(this->onFork());
|
return std::unique_ptr<SkMemoryStream>(this->onFork());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
size_t getLength() const override;
|
size_t getLength() const override;
|
||||||
|
|
||||||
const void* getMemoryBase() override;
|
const void* getMemoryBase() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifndef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkMemoryStream* onDuplicate() const override;
|
SkMemoryStream* onDuplicate() const override;
|
||||||
SkMemoryStream* onFork() const override;
|
SkMemoryStream* onFork() const override;
|
||||||
#endif
|
|
||||||
|
|
||||||
sk_sp<SkData> fData;
|
sk_sp<SkData> fData;
|
||||||
size_t fOffset;
|
size_t fOffset;
|
||||||
|
@ -35,11 +35,5 @@ public:
|
|||||||
*/
|
*/
|
||||||
static std::unique_ptr<SkStreamRewindable> Make(std::unique_ptr<SkStream> stream,
|
static std::unique_ptr<SkStreamRewindable> Make(std::unique_ptr<SkStream> stream,
|
||||||
size_t minBufferSize);
|
size_t minBufferSize);
|
||||||
|
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
static SkStreamRewindable* Create(SkStream* stream, size_t minBufferSize) {
|
|
||||||
return Make(std::unique_ptr<SkStream>(stream), minBufferSize).release();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
#endif // SkFrontBufferedStream_DEFINED
|
#endif // SkFrontBufferedStream_DEFINED
|
||||||
|
@ -315,10 +315,6 @@ public:
|
|||||||
return fBuffer->size() == fGlobalOffset;
|
return fBuffer->size() == fGlobalOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkStreamAsset* duplicate() const override { return new SkROBufferStreamAsset(fBuffer); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
size_t getPosition() const override {
|
size_t getPosition() const override {
|
||||||
return fGlobalOffset;
|
return fGlobalOffset;
|
||||||
}
|
}
|
||||||
@ -343,23 +339,16 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkStreamAsset* fork() const override {
|
|
||||||
SkStreamAsset* clone = this->duplicate();
|
|
||||||
clone->seek(this->getPosition());
|
|
||||||
return clone;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifndef SK_SUPPORT_LEGACY_STREAM_API
|
SkStreamAsset* onDuplicate() const override {
|
||||||
SkStreamAsset* onDuplicate() const override { return new SkROBufferStreamAsset(fBuffer); }
|
return new SkROBufferStreamAsset(fBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
SkStreamAsset* onFork() const override {
|
SkStreamAsset* onFork() const override {
|
||||||
auto clone = this->duplicate();
|
auto clone = this->duplicate();
|
||||||
clone->seek(this->getPosition());
|
clone->seek(this->getPosition());
|
||||||
return clone.release();
|
return clone.release();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
sk_sp<SkROBuffer> fBuffer;
|
sk_sp<SkROBuffer> fBuffer;
|
||||||
SkROBuffer::Iter fIter;
|
SkROBuffer::Iter fIter;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
* found in the LICENSE file.
|
* found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "SkStream.h"
|
#include "SkStream.h"
|
||||||
#include "SkStreamPriv.h"
|
#include "SkStreamPriv.h"
|
||||||
#include "SkData.h"
|
#include "SkData.h"
|
||||||
@ -15,17 +14,8 @@
|
|||||||
#include "SkOSFile.h"
|
#include "SkOSFile.h"
|
||||||
#include "SkTypes.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 SkStream::readS8() {
|
||||||
int8_t value;
|
int8_t value;
|
||||||
SkDEBUGCODE(size_t len =) this->read(&value, 1);
|
SkDEBUGCODE(size_t len =) this->read(&value, 1);
|
||||||
@ -224,7 +214,7 @@ bool SkFILEStream::rewind() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkStreamAsset* SkFILEStream::DUP_NAME() const {
|
SkStreamAsset* SkFILEStream::onDuplicate() const {
|
||||||
// TODO: fOriginalOffset instead of 0.
|
// TODO: fOriginalOffset instead of 0.
|
||||||
return new SkFILEStream(fFILE, fSize, 0, fOriginalOffset);
|
return new SkFILEStream(fFILE, fSize, 0, fOriginalOffset);
|
||||||
}
|
}
|
||||||
@ -242,7 +232,7 @@ bool SkFILEStream::move(long offset) {
|
|||||||
return this->seek(fOffset + offset);
|
return this->seek(fOffset + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkStreamAsset* SkFILEStream::FORK_NAME() const {
|
SkStreamAsset* SkFILEStream::onFork() const {
|
||||||
return new SkFILEStream(fFILE, fSize, fOffset, fOriginalOffset);
|
return new SkFILEStream(fFILE, fSize, fOffset, fOriginalOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,12 +340,7 @@ bool SkMemoryStream::rewind() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
SkMemoryStream* SkMemoryStream::onDuplicate() const {
|
||||||
SkMemoryStream* SkMemoryStream::duplicate() const
|
|
||||||
#else
|
|
||||||
SkMemoryStream* SkMemoryStream::onDuplicate() const
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
return new SkMemoryStream(fData);
|
return new SkMemoryStream(fData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,7 +359,7 @@ bool SkMemoryStream::move(long offset) {
|
|||||||
return this->seek(fOffset + offset);
|
return this->seek(fOffset + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkMemoryStream* SkMemoryStream::FORK_NAME() const {
|
SkMemoryStream* SkMemoryStream::onFork() const {
|
||||||
std::unique_ptr<SkMemoryStream> that(this->duplicate());
|
std::unique_ptr<SkMemoryStream> that(this->duplicate());
|
||||||
that->seek(fOffset);
|
that->seek(fOffset);
|
||||||
return that.release();
|
return that.release();
|
||||||
@ -746,7 +731,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkBlockMemoryStream* DUP_NAME() const override {
|
SkBlockMemoryStream* onDuplicate() const override {
|
||||||
return new SkBlockMemoryStream(fBlockMemory, fSize);
|
return new SkBlockMemoryStream(fBlockMemory, fSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -775,8 +760,8 @@ public:
|
|||||||
return seek(fOffset + offset);
|
return seek(fOffset + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
SkBlockMemoryStream* FORK_NAME() const override {
|
SkBlockMemoryStream* onFork() const override {
|
||||||
SkBlockMemoryStream* that = this->DUP_NAME();
|
SkBlockMemoryStream* that = this->onDuplicate();
|
||||||
that->fCurrent = this->fCurrent;
|
that->fCurrent = this->fCurrent;
|
||||||
that->fOffset = this->fOffset;
|
that->fOffset = this->fOffset;
|
||||||
that->fCurrentOffset = this->fCurrentOffset;
|
that->fCurrentOffset = this->fCurrentOffset;
|
||||||
|
@ -26,11 +26,7 @@ SkStreamAsset* SkTypeface_FCI::onOpenStream(int* ttcIndex) const {
|
|||||||
if (!stream) {
|
if (!stream) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
return stream->duplicate();
|
|
||||||
#else
|
|
||||||
return stream->duplicate().release();
|
return stream->duplicate().release();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return fFCI->openStream(this->getIdentity());
|
return fFCI->openStream(this->getIdentity());
|
||||||
|
@ -129,11 +129,7 @@ public:
|
|||||||
|
|
||||||
SkStreamAsset* onOpenStream(int* ttcIndex) const override {
|
SkStreamAsset* onOpenStream(int* ttcIndex) const override {
|
||||||
*ttcIndex = fData->getIndex();
|
*ttcIndex = fData->getIndex();
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
return fData->getStream()->duplicate();
|
|
||||||
#else
|
|
||||||
return fData->getStream()->duplicate().release();
|
return fData->getStream()->duplicate().release();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SkFontData> onMakeFontData() const override {
|
std::unique_ptr<SkFontData> onMakeFontData() const override {
|
||||||
|
@ -60,11 +60,7 @@ SkTypeface_Stream::SkTypeface_Stream(std::unique_ptr<SkFontData> fontData,
|
|||||||
|
|
||||||
SkStreamAsset* SkTypeface_Stream::onOpenStream(int* ttcIndex) const {
|
SkStreamAsset* SkTypeface_Stream::onOpenStream(int* ttcIndex) const {
|
||||||
*ttcIndex = fData->getIndex();
|
*ttcIndex = fData->getIndex();
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
return fData->getStream()->duplicate();
|
|
||||||
#else
|
|
||||||
return fData->getStream()->duplicate().release();
|
return fData->getStream()->duplicate().release();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SkFontData> SkTypeface_Stream::onMakeFontData() const {
|
std::unique_ptr<SkFontData> SkTypeface_Stream::onMakeFontData() const {
|
||||||
|
@ -435,11 +435,7 @@ public:
|
|||||||
|
|
||||||
SkStreamAsset* onOpenStream(int* ttcIndex) const override {
|
SkStreamAsset* onOpenStream(int* ttcIndex) const override {
|
||||||
*ttcIndex = fData->getIndex();
|
*ttcIndex = fData->getIndex();
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
return fData->getStream()->duplicate();
|
|
||||||
#else
|
|
||||||
return fData->getStream()->duplicate().release();
|
return fData->getStream()->duplicate().release();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SkFontData> onMakeFontData() const override {
|
std::unique_ptr<SkFontData> onMakeFontData() const override {
|
||||||
|
@ -86,11 +86,7 @@ HRESULT StreamFontFileLoader::CreateStreamFromKey(
|
|||||||
IDWriteFontFileStream** fontFileStream)
|
IDWriteFontFileStream** fontFileStream)
|
||||||
{
|
{
|
||||||
SkTScopedComPtr<SkDWriteFontFileStreamWrapper> stream;
|
SkTScopedComPtr<SkDWriteFontFileStreamWrapper> stream;
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
HR(SkDWriteFontFileStreamWrapper::Create(fStream->duplicate(), &stream));
|
|
||||||
#else
|
|
||||||
HR(SkDWriteFontFileStreamWrapper::Create(fStream->duplicate().release(), &stream));
|
HR(SkDWriteFontFileStreamWrapper::Create(fStream->duplicate().release(), &stream));
|
||||||
#endif
|
|
||||||
*fontFileStream = stream.release();
|
*fontFileStream = stream.release();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -26,14 +26,8 @@ public:
|
|||||||
|
|
||||||
size_t getLength() const override { return fLength; }
|
size_t getLength() const override { return fLength; }
|
||||||
|
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkStreamRewindable* duplicate() const override { return nullptr; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifndef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkStreamRewindable* onDuplicate() const override { return nullptr; }
|
SkStreamRewindable* onDuplicate() const override { return nullptr; }
|
||||||
#endif
|
|
||||||
|
|
||||||
std::unique_ptr<SkStream> fStream;
|
std::unique_ptr<SkStream> fStream;
|
||||||
const bool fHasLength;
|
const bool fHasLength;
|
||||||
|
@ -86,12 +86,7 @@ bool SkDWriteFontFileStream::rewind() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
SkDWriteFontFileStream* SkDWriteFontFileStream::onDuplicate() const {
|
||||||
SkDWriteFontFileStream* SkDWriteFontFileStream::duplicate() const
|
|
||||||
#else
|
|
||||||
SkDWriteFontFileStream* SkDWriteFontFileStream::onDuplicate() const
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
return new SkDWriteFontFileStream(fFontFileStream.get());
|
return new SkDWriteFontFileStream(fFontFileStream.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,12 +104,7 @@ bool SkDWriteFontFileStream::move(long offset) {
|
|||||||
return seek(fPos + offset);
|
return seek(fPos + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
SkDWriteFontFileStream* SkDWriteFontFileStream::onFork() const {
|
||||||
SkDWriteFontFileStream* SkDWriteFontFileStream::fork() const
|
|
||||||
#else
|
|
||||||
SkDWriteFontFileStream* SkDWriteFontFileStream::onFork() const
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
std::unique_ptr<SkDWriteFontFileStream> that(this->duplicate());
|
std::unique_ptr<SkDWriteFontFileStream> that(this->duplicate());
|
||||||
that->seek(fPos);
|
that->seek(fPos);
|
||||||
return that.release();
|
return that.release();
|
||||||
|
@ -34,24 +34,16 @@ public:
|
|||||||
size_t getLength() const override;
|
size_t getLength() const override;
|
||||||
const void* getMemoryBase() 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 {
|
std::unique_ptr<SkDWriteFontFileStream> duplicate() const {
|
||||||
return std::unique_ptr<SkDWriteFontFileStream>(this->onDuplicate());
|
return std::unique_ptr<SkDWriteFontFileStream>(this->onDuplicate());
|
||||||
}
|
}
|
||||||
std::unique_ptr<SkDWriteFontFileStream> fork() const {
|
std::unique_ptr<SkDWriteFontFileStream> fork() const {
|
||||||
return std::unique_ptr<SkDWriteFontFileStream>(this->onFork());
|
return std::unique_ptr<SkDWriteFontFileStream>(this->onFork());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifndef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
SkDWriteFontFileStream* onDuplicate() const override;
|
SkDWriteFontFileStream* onDuplicate() const override;
|
||||||
SkDWriteFontFileStream* onFork() const override;
|
SkDWriteFontFileStream* onFork() const override;
|
||||||
#endif
|
|
||||||
|
|
||||||
SkTScopedComPtr<IDWriteFontFileStream> fFontFileStream;
|
SkTScopedComPtr<IDWriteFontFileStream> fFontFileStream;
|
||||||
size_t fPos;
|
size_t fPos;
|
||||||
|
@ -249,11 +249,7 @@ static void test_peeking_front_buffered_stream(skiatest::Reporter* r,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Test that attempting to peek beyond the length of the buffer does not prevent rewinding.
|
// Test that attempting to peek beyond the length of the buffer does not prevent rewinding.
|
||||||
#ifdef SK_SUPPORT_LEGACY_STREAM_API
|
|
||||||
bufferedStream.reset(SkFrontBufferedStream::Create(original.duplicate(), bufferSize));
|
|
||||||
#else
|
|
||||||
bufferedStream = SkFrontBufferedStream::Make(original.duplicate(), bufferSize);
|
bufferedStream = SkFrontBufferedStream::Make(original.duplicate(), bufferSize);
|
||||||
#endif
|
|
||||||
REPORTER_ASSERT(r, bufferedStream != nullptr);
|
REPORTER_ASSERT(r, bufferedStream != nullptr);
|
||||||
|
|
||||||
const size_t bytesToPeek = bufferSize + 1;
|
const size_t bytesToPeek = bufferSize + 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user