Index: src/core/SkFontDescriptor.h |
diff --git a/src/core/SkFontDescriptor.h b/src/core/SkFontDescriptor.h |
index de1462177bc949c3d3a8975a9279e71a2d85657a..cb8d2f4f03562484755e4147ca7b3fd85e4adfab 100644 |
--- a/src/core/SkFontDescriptor.h |
+++ b/src/core/SkFontDescriptor.h |
@@ -15,9 +15,9 @@ |
class SkFontData { |
public: |
- /** Makes a copy of the data in 'axis'. */ |
- SkFontData(std::unique_ptr<SkStreamAsset> stream, int index, const SkFixed axis[],int axisCount) |
- : fStream(std::move(stream)), fIndex(index), fAxisCount(axisCount), fAxis(axisCount) |
+ /** This takes ownership of 'stream'. Makes a copy of the data in 'axis'. */ |
+ SkFontData(SkStreamAsset* stream, int index, const SkFixed axis[], int axisCount) |
+ : fStream(stream), fIndex(index), fAxisCount(axisCount), fAxis(axisCount) |
{ |
for (int i = 0; i < axisCount; ++i) { |
fAxis[i] = axis[i]; |
@@ -34,15 +34,15 @@ |
} |
} |
bool hasStream() const { return fStream.get() != nullptr; } |
- std::unique_ptr<SkStreamAsset> detachStream() { return std::move(fStream); } |
+ SkStreamAsset* duplicateStream() const { return fStream->duplicate(); } |
+ SkStreamAsset* detachStream() { return fStream.release(); } |
SkStreamAsset* getStream() { return fStream.get(); } |
- SkStreamAsset const* getStream() const { return fStream.get(); } |
int getIndex() const { return fIndex; } |
int getAxisCount() const { return fAxisCount; } |
const SkFixed* getAxis() const { return fAxis.get(); } |
private: |
- std::unique_ptr<SkStreamAsset> fStream; |
+ SkAutoTDelete<SkStreamAsset> fStream; |
int fIndex; |
int fAxisCount; |
SkAutoSTMalloc<4, SkFixed> fAxis; |
@@ -63,19 +63,20 @@ |
const char* getFullName() const { return fFullName.c_str(); } |
const char* getPostscriptName() const { return fPostscriptName.c_str(); } |
bool hasFontData() const { return fFontData.get() != nullptr; } |
- std::unique_ptr<SkFontData> detachFontData() { return std::move(fFontData); } |
+ SkFontData* detachFontData() { return fFontData.release(); } |
void setFamilyName(const char* name) { fFamilyName.set(name); } |
void setFullName(const char* name) { fFullName.set(name); } |
void setPostscriptName(const char* name) { fPostscriptName.set(name); } |
- /** Set the font data only if it is necessary for serialization. */ |
- void setFontData(std::unique_ptr<SkFontData> data) { fFontData = std::move(data); } |
+ /** Set the font data only if it is necessary for serialization. |
+ * This method takes ownership of the font data. */ |
+ void setFontData(SkFontData* data) { fFontData.reset(data); } |
private: |
SkString fFamilyName; |
SkString fFullName; |
SkString fPostscriptName; |
- std::unique_ptr<SkFontData> fFontData; |
+ SkAutoTDelete<SkFontData> fFontData; |
SkFontStyle fStyle; |
}; |