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

Unified Diff: src/core/SkFontDescriptor.h

Issue 567013002: Serialize the font index. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Move data into descriptor. Created 6 years, 3 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
Index: src/core/SkFontDescriptor.h
diff --git a/src/core/SkFontDescriptor.h b/src/core/SkFontDescriptor.h
index 5febfd81a3f36dd1af26154bd0672dd74c465f76..5a6ddd5e414ae6bc2d05ee1553530ce478b25ee5 100644
--- a/src/core/SkFontDescriptor.h
+++ b/src/core/SkFontDescriptor.h
@@ -8,10 +8,10 @@
#ifndef SkFontDescriptor_DEFINED
#define SkFontDescriptor_DEFINED
+#include "SkStream.h"
#include "SkString.h"
#include "SkTypeface.h"
-class SkStream;
class SkWStream;
class SkFontDescriptor {
@@ -24,21 +24,30 @@ public:
SkTypeface::Style getStyle() { return fStyle; }
void setStyle(SkTypeface::Style style) { fStyle = style; }
- const char* getFamilyName() { return fFamilyName.c_str(); }
- const char* getFullName() { return fFullName.c_str(); }
- const char* getPostscriptName() { return fPostscriptName.c_str(); }
- const char* getFontFileName() { return fFontFileName.c_str(); }
+ const char* getFamilyName() const { return fFamilyName.c_str(); }
+ const char* getFullName() const { return fFullName.c_str(); }
+ const char* getPostscriptName() const { return fPostscriptName.c_str(); }
+ const char* getFontFileName() const { return fFontFileName.c_str(); }
+ SkStream* getFontData() const { return fFontData; }
+ 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); }
void setFontFileName(const char* name) { fFontFileName.set(name); }
+ /** Set the font data only if it is necessary for serialization.
+ * This method takes ownership of the stream (both reference and cursor).
+ */
+ void setFontData(SkStream* stream) { fFontData.reset(stream); }
+ void setFontIndex(int index) { fFontIndex = index; }
private:
SkString fFamilyName;
SkString fFullName;
SkString fPostscriptName;
SkString fFontFileName;
+ SkAutoTUnref<SkStream> fFontData;
+ int fFontIndex;
SkTypeface::Style fStyle;
};

Powered by Google App Engine
This is Rietveld 408576698