Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Unified Diff: src/core/SkFontDescriptor.h

Issue 1128913008: Revert of Font variations. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkAdvancedTypefaceMetrics.h ('k') | src/core/SkFontDescriptor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkFontDescriptor.h
diff --git a/src/core/SkFontDescriptor.h b/src/core/SkFontDescriptor.h
index 933a36a0952d254d987b5b2dc12970fbc851268b..66707ddd3c5e10819ecd87e4d2352ed603c85817 100644
--- a/src/core/SkFontDescriptor.h
+++ b/src/core/SkFontDescriptor.h
@@ -12,42 +12,7 @@
#include "SkString.h"
#include "SkTypeface.h"
-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)
- {
- for (int i = 0; i < axisCount; ++i) {
- fAxis[i] = axis[i];
- }
- }
- SkFontData(const SkFontData& that)
- : fStream(that.fStream->duplicate())
- , fIndex(that.fIndex)
- , fAxisCount(that.fAxisCount)
- , fAxis(fAxisCount)
- {
- for (int i = 0; i < fAxisCount; ++i) {
- fAxis[i] = that.fAxis[i];
- }
- }
- bool hasStream() const { return fStream.get() != NULL; }
- SkStreamAsset* duplicateStream() const { return fStream->duplicate(); }
- SkStreamAsset* detachStream() { return fStream.detach(); }
- SkStreamAsset* getStream() { return fStream.get(); }
- int getIndex() const { return fIndex; }
- int getAxisCount() const { return fAxisCount; }
- const SkFixed* getAxis() const { return fAxis.get(); }
-
-private:
- SkAutoTDelete<SkStreamAsset> fStream;
- int fIndex;
- int fAxisCount;
- SkAutoSTMalloc<4, SkFixed> fAxis;
-};
-
-class SkFontDescriptor : SkNoncopyable {
+class SkFontDescriptor {
public:
SkFontDescriptor(SkTypeface::Style = SkTypeface::kNormal);
// Does not affect ownership of SkStream.
@@ -62,20 +27,25 @@
const char* getFullName() const { return fFullName.c_str(); }
const char* getPostscriptName() const { return fPostscriptName.c_str(); }
bool hasFontData() const { return fFontData.get() != NULL; }
- SkFontData* detachFontData() { return fFontData.detach(); }
+ // Transfers ownership to the caller.
+ SkStreamAsset* transferFontData() { return fFontData.detach(); }
+ int getFontIndex() const { return fFontIndex; }
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); }
+ * This method takes ownership of the stream (both reference and cursor).
+ */
+ void setFontData(SkStreamAsset* stream) { fFontData.reset(stream); }
+ void setFontIndex(int index) { fFontIndex = index; }
private:
SkString fFamilyName;
SkString fFullName;
SkString fPostscriptName;
- SkAutoTDelete<SkFontData> fFontData;
+ SkAutoTDelete<SkStreamAsset> fFontData;
+ int fFontIndex;
SkTypeface::Style fStyle;
};
« no previous file with comments | « src/core/SkAdvancedTypefaceMetrics.h ('k') | src/core/SkFontDescriptor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698