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

Unified Diff: trunk/src/ports/SkFontHost_linux.cpp

Issue 13008019: remove SkFontHost::OpenStream(), now subsumed by SkTypeface::openStream() (Closed) Base URL: http://skia.googlecode.com/svn/
Patch Set: Created 7 years, 9 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 | « trunk/src/ports/SkFontHost_freetype_mac.cpp ('k') | trunk/src/ports/SkFontHost_mac.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/ports/SkFontHost_linux.cpp
===================================================================
--- trunk/src/ports/SkFontHost_linux.cpp (revision 8339)
+++ trunk/src/ports/SkFontHost_linux.cpp (working copy)
@@ -258,8 +258,7 @@
bool isSysFont() const { return fIsSysFont; }
FamilyRec* getFamily() const { return fFamilyRec; }
- // openStream returns a SkStream that has been ref-ed
- virtual SkStream* openStream() = 0;
+
virtual const char* getUniqueString() const = 0;
private:
@@ -279,10 +278,11 @@
public:
EmptyTypeface() : INHERITED(SkTypeface::kNormal, true, NULL, false) {}
- // overrides
- virtual SkStream* openStream() SK_OVERRIDE { return NULL; }
virtual const char* getUniqueString() SK_OVERRIDE const { return NULL; }
+protected:
+ virtual SkStream* onOpenStream(int*) const SK_OVERRIDE { return NULL; }
+
private:
typedef FamilyTypeface INHERITED;
};
@@ -299,13 +299,15 @@
fStream->unref();
}
- virtual SkStream* openStream() SK_OVERRIDE {
- // openStream returns a refed stream.
- fStream->ref();
- return fStream;
- }
virtual const char* getUniqueString() const SK_OVERRIDE { return NULL; }
+protected:
+ virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE {
+ *ttcIndex = 0;
+ fStream->ref();
+ return fStream;
+ }
+
private:
SkStream* fStream;
@@ -320,10 +322,6 @@
fPath.set(path);
}
- virtual SkStream* openStream() SK_OVERRIDE {
- return SkStream::NewFromFile(fPath.c_str());
- }
-
virtual const char* getUniqueString() const SK_OVERRIDE {
const char* str = strrchr(fPath.c_str(), '/');
if (str) {
@@ -332,6 +330,12 @@
return str;
}
+protected:
+ virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE {
+ *ttcIndex = 0;
+ return SkStream::NewFromFile(fPath.c_str());
+ }
+
private:
SkString fPath;
@@ -465,7 +469,7 @@
const bool isCustomFont = !((FamilyTypeface*)face)->isSysFont();
if (isCustomFont) {
// store the entire font in the fontData
- SkStream* fontStream = ((FamilyTypeface*)face)->openStream();
+ SkStream* fontStream = face->openStream(NULL);
const uint32_t length = fontStream->getLength();
stream->writePackedUInt(length);
@@ -529,17 +533,6 @@
return tf;
}
-SkStream* SkFontHost::OpenStream(uint32_t fontID) {
- FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID);
- SkStream* stream = tf ? tf->openStream() : NULL;
-
- if (stream && stream->getLength() == 0) {
- stream->unref();
- stream = NULL;
- }
- return stream;
-}
-
SkTypeface* SkFontHost::NextLogicalTypeface(SkFontID currFontID, SkFontID origFontID) {
return NULL;
}
« no previous file with comments | « trunk/src/ports/SkFontHost_freetype_mac.cpp ('k') | trunk/src/ports/SkFontHost_mac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698