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